Summary: | ActiveDirectory authentication thru LDAP doesn't work when principal_name is used with update or replicate | ||
---|---|---|---|
Product: | Koha | Reporter: | Rex Wallen Tan <wallen_tan> |
Component: | Authentication | Assignee: | Galen Charlton <gmcharlt> |
Status: | CLOSED DUPLICATE | QA Contact: | Bugs List <koha-bugs> |
Severity: | blocker | ||
Priority: | P5 - low | CC: | dpavlin |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: |
Description
Rex Wallen Tan
2011-10-27 07:37:51 UTC
Cause: $userldapentry remains unset when authenticating by bind if ( $ldap->{auth_by_bind} ) { my $principal_name = $ldap->{principal_name}; if ($principal_name and $principal_name =~ /\%/) { $principal_name = sprintf($principal_name,$userid); } else { $principal_name = $userid; } my $res = $db->bind( $principal_name, password => $password ); if ( $res->code ) { $debug and warn "LDAP bind failed as kohauser $principal_name: ". description($res); return 0; } } this is called in sub ldap_entry_2_hash ($$) and will cause the code to fail. Proposed solution: --- Auth_with_ldap.pm.old 2011-10-27 15:30:52.808209008 +0800 +++ Auth_with_ldap.pm 2011-10-27 15:23:00.788208927 +0800 @@ -55,7 +55,7 @@ my $base = $ldap->{base} or die ldapserver_error('base'); $ldapname = $ldap->{user} ; $ldappassword = $ldap->{pass} ; -our %mapping = %{$ldap->{mapping}} || (); # or die ldapserver_error('mapping'); +our %mapping = %{$ldap->{mapping}}; # or die ldapserver_error('mapping'); my @mapkeys = keys %mapping; $debug and print STDERR "Got ", scalar(@mapkeys), " ldap mapkeys ( total ): ", join ' ', @mapkeys, "\n"; @mapkeys = grep {defined $mapping{$_}->{is}} @mapkeys; @@ -119,6 +119,10 @@ $debug and warn "LDAP bind failed as kohauser $principal_name: ". description($res); return 0; } + + #Create an entry for userldapentry even during principal name auth + my $search = search_method($db, $userid) or return 0; # warnings are in the sub + $userldapentry = $search->shift_entry; } else { my $search = search_method($db, $userid) or return 0; # warnings are in the sub $userldapentry = $search->shift_entry; current master includes fix from bug 5094. From your Koha version (4.02), I assume that you are not using koha from http://git.koha-community.org ? *** This bug has been marked as a duplicate of bug 5094 *** |