View | Details | Raw Unified | Return to bug 6979
Collapse All | Expand All

(-)a/C4/Auth_with_ldap.pm (-6 / +7 lines)
Lines 124-129 sub checkpw_ldap { Link Here
124
	#$debug and $db->debug(5);
124
	#$debug and $db->debug(5);
125
    my $userldapentry;
125
    my $userldapentry;
126
126
127
    # first, LDAP authentication
127
    if ( $ldap->{auth_by_bind} ) {
128
    if ( $ldap->{auth_by_bind} ) {
128
        my $principal_name;
129
        my $principal_name;
129
        if ( $ldap->{anonymous_bind} ) {
130
        if ( $ldap->{anonymous_bind} ) {
Lines 182-192 sub checkpw_ldap { Link Here
182
		}
183
		}
183
        my $search = search_method($db, $userid) or return 0;   # warnings are in the sub
184
        my $search = search_method($db, $userid) or return 0;   # warnings are in the sub
184
        $userldapentry = $search->shift_entry;
185
        $userldapentry = $search->shift_entry;
185
		my $cmpmesg = $db->compare( $userldapentry, attr=>'userpassword', value => $password );
186
        my $dn = $userldapentry->dn;
186
		if ($cmpmesg->code != 6) {
187
        my $user_ldap_bind_ret = $db->bind($dn, password => $password);
187
			warn "LDAP Auth rejected : invalid password for user '$userid'. " . description($cmpmesg);
188
        if ($user_ldap_bind_ret->code) {
188
			return -1;
189
            warn "LDAP Auth rejected : invalid password for user '$userid'. " . description($user_ldap_bind_ret);
189
		}
190
            return -1;
191
        }
190
	}
192
	}
191
193
192
    # To get here, LDAP has accepted our user's login attempt.
194
    # To get here, LDAP has accepted our user's login attempt.
193
- 

Return to bug 6979