pluf2

pluf2 Commit Details


Date:2010-11-10 13:43:41 (14 years 1 month ago)
Author:Carlo Kok
Branch:master
Commit:f7d009f0d04add6419979a746d03ccb1bcd34d37
Parents: 708733499915bf8b703f22b94a2ba6217fd74505
Message:Fixed to correctly support bind authentication without throwing an exception.

Changes:

File differences

src/Pluf/Auth/LdapBackend.php
6666
6767
6868
69
69
7070
7171
7272
......
7979
8080
8181
82
82
83
84
8385
8486
8587
......
8991
9092
9193
92
93
94
94
95
96
97
98
9599
96100
97101
......
105109
106110
107111
108
112
109113
110114
111115
$ldap_password_key = Pluf::f('auth_ldap_password_key', null);
$ldap_surname_key = Pluf::f('auth_ldap_surname_key', 'sn');
$ldap_givenname_key = Pluf::f('auth_ldap_givenname_key', 'cn');
$ldap_email_key = Pluf::f('auth_ldap_email_key', 'email');
$ldap_email_key = Pluf::f('auth_ldap_email_key', 'mail');
$ldap = ldap_connect(Pluf::f('auth_ldap_host', 'localhost'));
}
// Go for a search
$search = ldap_search($ldap, $ldap_dn,
$ldap_user_id.'='.$login);
'('.$ldap_user_key.'='.$login.')',
array($ldap_user_key, $ldap_surname_key,
$ldap_givenname_key, $ldap_email_key));
$n = ldap_get_entries($ldap, $search);
if ($n['count'] != 1) {
ldap_close($ldap);
// We get all the data first, the bind or hash control is done
// later. If we control with bind now, we need to search again
// to have an $entry resource to get the values.
list($family_name,) = ldap_get_values($ldap, $entry, $ldap_surname_key);
list($first_name,) = ldap_get_values($ldap, $entry, $ldap_givenname_key);
list($email,) = ldap_get_values($ldap, $entry, $ldap_email_key);
list($family_name,) = @ldap_get_values($ldap, $entry, $ldap_surname_key);
list($first_name,) = @ldap_get_values($ldap, $entry, $ldap_givenname_key);
list($email,) = @ldap_get_values($ldap, $entry, $ldap_email_key);
$user_dn = ldap_get_dn($ldap, $entry);
if ($ldap_password_key) {
// Password authentication.
}
} else {
// Bind authentication
if (!ldap_bind($lda, $login, $password)) {
if (!@ldap_bind($ldap, $user_dn, $password)) {
ldap_close($ldap);
return false;
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05419s using 13 queries.