Lines 82-92
sub search_method {
Link Here
|
82 |
my $userid = shift or return; |
82 |
my $userid = shift or return; |
83 |
my $uid_field = $mapping{userid}->{is} or die ldapserver_error("mapping for 'userid'"); |
83 |
my $uid_field = $mapping{userid}->{is} or die ldapserver_error("mapping for 'userid'"); |
84 |
my $filter = Net::LDAP::Filter->new("$uid_field=$userid") or die "Failed to create new Net::LDAP::Filter"; |
84 |
my $filter = Net::LDAP::Filter->new("$uid_field=$userid") or die "Failed to create new Net::LDAP::Filter"; |
85 |
my $res = ($config{anonymous}) ? $db->bind : $db->bind($ldapname, password=>$ldappassword); |
|
|
86 |
if ($res->code) { # connection refused |
87 |
warn "LDAP bind failed as ldapuser " . ($ldapname || '[ANONYMOUS]') . ": " . description($res); |
88 |
return 0; |
89 |
} |
90 |
my $search = $db->search( |
85 |
my $search = $db->search( |
91 |
base => $base, |
86 |
base => $base, |
92 |
filter => $filter, |
87 |
filter => $filter, |
Lines 128-133
sub checkpw_ldap {
Link Here
|
128 |
$userldapentry = $search->shift_entry; |
123 |
$userldapentry = $search->shift_entry; |
129 |
|
124 |
|
130 |
} else { |
125 |
} else { |
|
|
126 |
my $res = ($config{anonymous}) ? $db->bind : $db->bind($ldapname, password=>$ldappassword); |
127 |
if ($res->code) { # connection refused |
128 |
warn "LDAP bind failed as ldapuser " . ($ldapname || '[ANONYMOUS]') . ": " . description($res); |
129 |
return 0; |
130 |
} |
131 |
my $search = search_method($db, $userid) or return 0; # warnings are in the sub |
131 |
my $search = search_method($db, $userid) or return 0; # warnings are in the sub |
132 |
$userldapentry = $search->shift_entry; |
132 |
$userldapentry = $search->shift_entry; |
133 |
my $cmpmesg = $db->compare( $userldapentry, attr=>'userpassword', value => $password ); |
133 |
my $cmpmesg = $db->compare( $userldapentry, attr=>'userpassword', value => $password ); |
134 |
- |
|
|