Lines 115-120
sub checkpw_ldap {
Link Here
|
115 |
#$debug and $db->debug(5); |
115 |
#$debug and $db->debug(5); |
116 |
my $userldapentry; |
116 |
my $userldapentry; |
117 |
|
117 |
|
|
|
118 |
# first, LDAP authentication |
118 |
if ( $ldap->{auth_by_bind} ) { |
119 |
if ( $ldap->{auth_by_bind} ) { |
119 |
my $principal_name; |
120 |
my $principal_name; |
120 |
if ( $ldap->{anonymous_bind} ) { |
121 |
if ( $ldap->{anonymous_bind} ) { |
Lines 173-183
sub checkpw_ldap {
Link Here
|
173 |
} |
174 |
} |
174 |
my $search = search_method($db, $userid) or return 0; # warnings are in the sub |
175 |
my $search = search_method($db, $userid) or return 0; # warnings are in the sub |
175 |
$userldapentry = $search->shift_entry; |
176 |
$userldapentry = $search->shift_entry; |
176 |
my $cmpmesg = $db->compare( $userldapentry, attr=>'userpassword', value => $password ); |
177 |
my $dn = $userldapentry->dn; |
177 |
if ($cmpmesg->code != 6) { |
178 |
my $user_ldap_bind_ret = $db->bind($dn, password => $password); |
178 |
warn "LDAP Auth rejected : invalid password for user '$userid'. " . description($cmpmesg); |
179 |
if ($user_ldap_bind_ret->code) { |
179 |
return -1; |
180 |
warn "LDAP Auth rejected : invalid password for user '$userid'. " . description($user_ldap_bind_ret); |
180 |
} |
181 |
return -1; |
|
|
182 |
} |
181 |
} |
183 |
} |
182 |
|
184 |
|
183 |
# To get here, LDAP has accepted our user's login attempt. |
185 |
# To get here, LDAP has accepted our user's login attempt. |
184 |
- |
|
|