public function bind($username, $password, $sasl = false)
{
if ($this->isUsingTLS()) {
$this->startTLS();
}
if ($sasl) {
return $this->bound = ldap_sasl_bind($this->getConnection(), null, null, 'GSSAPI');
}
return $this->bound = ldap_bind($this->getConnection(), $username, $password);
}
/** * This tests that an exception is thrown * when trying to perform an LDAP method while * showing errors. */ public function testConnectionShowErrors() { $ldap = new Ldap(); $ldap->showErrors(); $ldap->connect('test'); try { $ldap->bind('test', 'test'); $passes = false; } catch (\Exception $e) { $passes = true; } $this->assertTrue($passes); }