function ldap_server::bind in Lightweight Directory Access Protocol (LDAP) 6
* Bind (authenticate) against an active LDAP database. * *
Parameters
$userdn: * The DN to bind against. If NULL, we use $this->binddn * @param $pass * The password search base. If NULL, we use $this->bindpw
Return value
Result of bind; TRUE if successful, FALSE otherwise.
1 call to ldap_server::bind()
- ldap_server::__invoke in includes/
ldap.server.inc - Invoke Method
File
- includes/
ldap.server.inc, line 159 - Defines server classes and related functions.
Class
- ldap_server
- LDAP Server Class
Code
function bind($userdn = NULL, $pass = NULL) {
$userdn = $userdn != NULL ? $userdn : $this->binddn;
$pass = $pass != NULL ? $pass : $this->bindpw;
// Ensure that we have an active server connection.
if (!$this->connection) {
watchdog('ldap', "LDAP bind failure for user %user. Not connected to LDAP server.", array(
'%user' => $dn,
));
return FALSE;
}
if (!ldap_bind($this->connection, $userdn, $pass)) {
watchdog('ldap', "LDAP bind failure for user %user. Error %errno: %error", array(
'%user' => $user,
'$errno' => ldap_errno($this->connection),
'%error' => ldap_error($this->connection),
));
return FALSE;
}
return TRUE;
}