parent
6668556e50
commit
9237c3e27d
|
@ -373,7 +373,25 @@ class LdapCapabilities
|
|||
(string) $connection->select()->from('*', $adFields)->where('nCName', $defaultNamingContext),
|
||||
$adFields
|
||||
);
|
||||
if (! $result) {
|
||||
if ($result) {
|
||||
$entry = ldap_first_entry($ds, $result);
|
||||
if ($entry === false) {
|
||||
throw new LdapException(
|
||||
'Configuration options not available (%s:%d). Discovery of "%s" probably not permitted.',
|
||||
$connection->getHostname(),
|
||||
$connection->getPort(),
|
||||
$partitions
|
||||
);
|
||||
}
|
||||
|
||||
$this->setAttributes((object) array_merge(
|
||||
(array) $this->attributes,
|
||||
(array) $connection->cleanupAttributes(ldap_get_attributes($ds, $entry), $adFields)
|
||||
));
|
||||
} else {
|
||||
if (ldap_errno($ds) !== 1) {
|
||||
// One stands for "operations error" which occurs if not bound non-anonymously.
|
||||
|
||||
throw new LdapException(
|
||||
'Configuration options query failed (%s:%d): %s. Check if hostname and port of the'
|
||||
. ' ldap resource are correct and if anonymous access is permitted.',
|
||||
|
@ -382,21 +400,7 @@ class LdapCapabilities
|
|||
ldap_error($ds)
|
||||
);
|
||||
}
|
||||
|
||||
$entry = ldap_first_entry($ds, $result);
|
||||
if ($entry === false) {
|
||||
throw new LdapException(
|
||||
'Configuration options not available (%s:%d). Discovery of "'
|
||||
. $partitions . '" probably not permitted.',
|
||||
$connection->getHostname(),
|
||||
$connection->getPort()
|
||||
);
|
||||
}
|
||||
|
||||
$this->setAttributes((object) array_merge(
|
||||
(array) $this->attributes,
|
||||
(array) $connection->cleanupAttributes(ldap_get_attributes($ds, $entry), $adFields)
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue