From 7535c60f1d1d9a7b8360b905a707cef6e800f8f9 Mon Sep 17 00:00:00 2001 From: Oliver Bock Date: Fri, 7 Jul 2017 08:56:25 +0200 Subject: [PATCH] Bug 18880: Regression breaks local authentication fallback for all external authentications A regression in commit cfc484b17 / bug #18314 breaks the local authentication fallback for all external authentications like LDAP, CAS and Shibboleth. The regression itself is a logical error as "@return = (0)" is considered to be "false" when checked with "unless" (line 1814). That's wrong as "unless" tests the number of elements in a list. Thus the "falsy" condition has to established with "@return = ()" instead. Signed-off-by: Lee Jamison --- C4/Auth.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index e7b0895..2e014c2 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1764,14 +1764,14 @@ sub checkpw { my $patron = Koha::Patrons->find({ userid => $userid }); if ( $patron and $patron->account_locked ) { - @return = (0); + @return = (); } elsif ($ldap) { $debug and print STDERR "## checkpw - checking LDAP\n"; my ( $retval, $retcard, $retuserid ) = checkpw_ldap(@_); # EXTERNAL AUTH if ( $retval ) { @return = ( $retval, $retcard, $retuserid ); } else { - @return = (0); + @return = (); } } elsif ( $cas && $query && $query->param('ticket') ) { @@ -1784,7 +1784,7 @@ sub checkpw { if ( $retval ) { @return = ( $retval, $retcard, $retuserid ); } else { - @return = (0); + @return = (); } } @@ -1805,7 +1805,7 @@ sub checkpw { if ( $retval ) { @return = ( $retval, $retcard, $retuserid ); } else { - @return = (0); + @return = (); } } } -- 2.1.4