protected function SimpleLdapServer::basedn in Simple LDAP 7
Same name and namespace in other branches
- 7.2 SimpleLdapServer.class.php \SimpleLdapServer::basedn()
Attempts to determine the server's baseDN.
Return value
mixed Returns the LDAP server base DN, or FALSE on failure.
1 call to SimpleLdapServer::basedn()
- SimpleLdapServer::__get in ./
SimpleLdapServer.class.php - Magic __get() function.
File
- ./
SimpleLdapServer.class.php, line 737 - Class to handle LDAP server connections and related operations.
Class
- SimpleLdapServer
- Simple LDAP server class.
Code
protected function basedn() {
// If the baseDN has already been checked, just return it.
if (isset($this->basedn)) {
return $this->basedn;
}
// Check if the basedn is specified in the module configuration.
$basedn = variable_get('simple_ldap_basedn');
if (!empty($basedn)) {
$this->basedn = $basedn;
return $this->basedn;
}
// The basedn is not specified, so attempt to detect it from the rootDSE.
try {
$this
->rootdse();
if (isset($this->rootdse['namingcontexts'])) {
$this->basedn = $this->rootdse['namingcontexts'][0];
return $this->basedn;
}
} catch (SimpleLdapException $e) {
}
// Unable to determine the baseDN.
return FALSE;
}