[Koha-patches] [PATCH] Bug 9611: Database update, changing password from varchar(30) to varchar(60)

Srdjan srdjan at catalyst.net.nz
Mon Sep 30 02:56:08 CEST 2013


From: Chris Cormack <chris at bigballofwax.co.nz>

This is necessary because Bcrypt hashes are longer than MD5 hashes.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel at gmail.com>
Signed-off-by: Mason James <mtj at kohaaloha.com>
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
---
 installer/data/mysql/kohastructure.sql | 2 +-
 installer/data/mysql/updatedatabase.pl | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index fdab879..3b21470 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -246,7 +246,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons
   `ethnicity` varchar(50) default NULL, -- unused in Koha
   `ethnotes` varchar(255) default NULL, -- unused in Koha
   `sex` varchar(1) default NULL, -- patron/borrower's gender
-  `password` varchar(30) default NULL, -- patron/borrower's encrypted password
+  `password` varchar(60) default NULL, -- patron/borrower's encrypted password
   `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
   `userid` varchar(75) default NULL, -- patron/borrower's opac and/or staff client log in
   `opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index a37ea02..b826e76 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -7155,6 +7155,13 @@ if ( CheckVersion($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.13.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("ALTER TABLE borrowers CHANGE password password VARCHAR(60);");
+    print "Upgrade to $DBversion done (Bug 9611 upgrading password storage system)\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
-- 
1.8.1.2


More information about the Koha-patches mailing list