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

View File

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