From e209ff08a5c7707d5c08a794f5b4b77f8b0c1870 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 29 Aug 2014 13:37:07 +0200 Subject: [PATCH] Bug 12831 - local only logins should work with LDAP This fixes regression introducted in Bug 8148. If ldap is enabled, and using auth_by_bind, one will not be able to login using any local accounts which do not appear in the ldap directory. This is problematic because a number of koha system accounts are unlikely to have a parallel in the active directory.. for instance SIP Service User accounts. --- C4/Auth_with_ldap.pm | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index b42506d..c313af9 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -146,7 +146,11 @@ sub checkpw_ldap { my $res = $db->bind( $principal_name, password => $password ); if ( $res->code ) { warn "LDAP bind failed as kohauser $userid: " . description($res); - return -1; + if ( $res->code == 34 ) { # invalid DN, probably local user + return 0; # fallback to local auth + } else { + return -1; # invalid password + } } if ( !defined($userldapentry) && ( $config{update} or $config{replicate} ) ) -- 1.7.2.5