Don't crash on single ldap capability entries

refs #8490
This commit is contained in:
Matthias Jentsch 2015-02-27 16:59:50 +01:00
parent e93a5f16d9
commit 65821863fa
2 changed files with 11 additions and 20 deletions

View File

@ -101,24 +101,16 @@ class Capability {
{
$this->attributes = $attributes;
if (isset($attributes->supportedControl)) {
foreach ($attributes->supportedControl as $oid) {
$this->oids[$oid] = true;
}
}
if (isset($attributes->supportedExtension)) {
foreach ($attributes->supportedExtension as $oid) {
$this->oids[$oid] = true;
}
}
if (isset($attributes->supportedFeatures)) {
foreach ($attributes->supportedFeatures as $oid) {
$this->oids[$oid] = true;
}
}
if (isset($attributes->supportedCapabilities)) {
foreach ($attributes->supportedCapabilities as $oid) {
$this->oids[$oid] = true;
$keys = array('supportedControl', 'supportedExtension', 'supportedFeatures', 'supportedCapabilities');
foreach ($keys as $key) {
if (isset($attributes->$key)) {
if (is_array($attributes->$key)) {
foreach ($attributes->$key as $oid) {
$this->oids[$oid] = true;
}
} else {
$this->oids[$attributes->$key] = true;
}
}
}
}
@ -160,7 +152,7 @@ class Capability {
*/
public function hasLdapV3()
{
if (!isset($this->attributes)) {
if (! isset($this->attributes) || ! isset($this->attributes->supportedLDAPVersion)) {
// Default to true, if unknown
return true;
}

View File

@ -469,7 +469,6 @@ class Connection
protected function prepareNewConnection()
{
$use_tls = false;
$force_tls = true;
$force_tls = false;
if ($use_tls) {