function ldapauth_auth in LDAP integration 5.2
Same name and namespace in other branches
- 5 ldapauth.module \ldapauth_auth()
1 call to ldapauth_auth()
File
- ./
ldapauth.module, line 535
Code
function ldapauth_auth($name, $pass, $server) {
global $ldap;
$ok = false;
$login_name = $server ? "{$name}@{$server}" : $name;
if (function_exists('ldapauth_transform_login_name')) {
$login_name = call_user_func('ldapauth_transform_login_name', $login_name);
}
$dn = _ldapauth_login2dn($login_name);
// Not allowing empty passwords because they cause problems
// on some setups. See http://drupal.org/node/87831
if ($dn && $pass) {
$ok = $ldap
->connect($dn, $pass);
}
if ($ok && function_exists('ldapauth_user_filter')) {
$ok = $ok && call_user_func('ldapauth_user_filter', $ldap
->retrieveAttributes($dn));
}
return $ok;
}