From 7c11f1f3ef8f06d4c695c9e26986109d1d30b5bb Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Sat, 21 Sep 2013 00:15:59 -0400 Subject: [PATCH 3/3] Bug 10900 - Incorrect calling conventions accessing C4::Context First there was the :: vs -> calling problem. The first patch solves that. Then, a set of wrong parameters was discovered. The second patch solves that. This third patch intentionally went looking for other bad parameters to fix for the set_userenv routine in C4::Context. The biggest problems were missing surnames or branch names. --- C4/Auth.pm | 14 +++++++------- installer/InstallAuth.pm | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index e9f459b..3263613 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1485,33 +1485,33 @@ sub checkpw { # INTERNAL AUTH my $sth = $dbh->prepare( -"select password,cardnumber,borrowernumber,userid,firstname,surname,branchcode,flags from borrowers where userid=?" +"select password,cardnumber,borrowernumber,userid,firstname,surname,borrowers.branchcode,branches.branchname,flags from borrowers join branches on borrowers.branchcode=branches.branchcode where userid=?" ); $sth->execute($userid); if ( $sth->rows ) { my ( $md5password, $cardnumber, $borrowernumber, $userid, $firstname, - $surname, $branchcode, $flags ) + $surname, $branchcode, $branchname, $flags ) = $sth->fetchrow; if ( md5_base64($password) eq $md5password and $md5password ne "!") { C4::Context->set_userenv( "$borrowernumber", $userid, $cardnumber, - $firstname, $surname, $branchcode, $flags ); + $firstname, $surname, $branchcode, $branchname, $flags ); return 1, $cardnumber, $userid; } } $sth = $dbh->prepare( -"select password,cardnumber,borrowernumber,userid, firstname,surname,branchcode,flags from borrowers where cardnumber=?" +"select password,cardnumber,borrowernumber,userid,firstname,surname,borrowers.branchcode,branches.branchname,flags from borrowers join branches on borrowers.branchcode=branches.branchcode where cardnumber=?" ); $sth->execute($userid); if ( $sth->rows ) { my ( $md5password, $cardnumber, $borrowernumber, $userid, $firstname, - $surname, $branchcode, $flags ) + $surname, $branchcode, $branchname, $flags ) = $sth->fetchrow; if ( md5_base64($password) eq $md5password ) { C4::Context->set_userenv( $borrowernumber, $userid, $cardnumber, - $firstname, $surname, $branchcode, $flags ); + $firstname, $surname, $branchcode, $branchname, $flags ); return 1, $cardnumber, $userid; } } @@ -1520,7 +1520,7 @@ sub checkpw { { # Koha superuser account -# C4::Context->set_userenv(0,0,C4::Context->config('user'),C4::Context->config('user'),C4::Context->config('user'),"",1); +# C4::Context->set_userenv(0,0,C4::Context->config('user'),C4::Context->config('user'),C4::Context->config('user'),"","",1); return 2; } if ( $userid && $userid eq 'demo' diff --git a/installer/InstallAuth.pm b/installer/InstallAuth.pm index 1aafe70..fb68e0d 100644 --- a/installer/InstallAuth.pm +++ b/installer/InstallAuth.pm @@ -417,7 +417,7 @@ sub checkpw { C4::Context->config('user'), C4::Context->config('user'), C4::Context->config('user'), - "", 1 + "", "NO_LIBRARY_SET", 1 ); return 2; } -- 1.7.9.5