You are here

function LDAPInterface::connectAndBind in LDAP integration 6

Same name and namespace in other branches
  1. 5.2 ldap_integration/LDAPInterface.php \LDAPInterface::connectAndBind()
  2. 5 ldap_integration/LDAPInterface.php \LDAPInterface::connectAndBind()
1 call to LDAPInterface::connectAndBind()
LDAPInterface::connect in includes/LDAPInterface.inc

File

includes/LDAPInterface.inc, line 178
LDAPInterface class definition.

Class

LDAPInterface
@file LDAPInterface class definition.

Code

function connectAndBind($dn = '', $pass = '') {
  $this
    ->initConnection();
  if ($this->connection) {
    if (!$this
      ->bind($dn, $pass)) {
      watchdog('ldap', 'LDAP Bind failure for user %user. Error %errno: %error', array(
        '%user' => $dn,
        '%errno' => ldap_errno($this->connection),
        '%error' => ldap_error($this->connection),
      ));
      return NULL;
    }
    return $this->connection;
  }
  else {
    return $false;
  }
}