@@ -, +, @@ --- C4/Auth_with_ldap.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/C4/Auth_with_ldap.pm +++ a/C4/Auth_with_ldap.pm @@ -112,10 +112,10 @@ sub checkpw_ldap { my $userldapentry; if ( $ldap->{auth_by_bind} ) { - # Perform an anonymous bind - my $res = $db->bind; + # Perform initial bind (anonymous or otherwise) + my $res = ($config{anonymous}) ? $db->bind : $db->bind($ldapname, password=>$ldappassword); if ( $res->code ) { - $debug and warn "Anonymous LDAP bind failed: ". description($res); + $debug and warn "LDAP bind failed as ldapuser " . ($ldapname || '[ANONYMOUS]') . ": " . description($res); return 0; } @@ -123,7 +123,7 @@ sub checkpw_ldap { my $search = search_method($db, $userid) or return 0; # warnings are in the sub $userldapentry = $search->shift_entry; - # Perform a LDAP bind for the given username using the matched DN + # Perform a LDAP (re)bind for the given username using the matched DN $res = $db->bind( $userldapentry->dn, password => $password ); if ( $res->code ) { $debug and warn "LDAP bind failed as kohauser $userid: ". description($res); --