Merge pull request #24236 from owncloud/backport-24214-stable9

[stable9] on clone Connection, do not take over the existing LDAP resource
This commit is contained in:
Thomas Müller 2016-04-25 23:03:05 +02:00
commit b425a0e307
2 changed files with 3 additions and 11 deletions

View File

@ -1295,9 +1295,7 @@ class Access extends LDAPUtility implements user\IUserTools {
if(!$testConnection->setConfiguration($credentials)) {
return false;
}
$result=$testConnection->bind();
$this->ldap->unbind($this->connection->getConnectionResource());
return $result;
return $testConnection->bind();
}
/**

View File

@ -47,9 +47,6 @@ class Connection extends LDAPUtility {
private $configPrefix;
private $configID;
private $configured = false;
//whether connection should be kept on __destruct
private $dontDestruct = false;
private $hasPagedResultSupport = true;
/**
@ -91,8 +88,7 @@ class Connection extends LDAPUtility {
}
public function __destruct() {
if(!$this->dontDestruct &&
$this->ldap->isResource($this->ldapConnectionRes)) {
if($this->ldap->isResource($this->ldapConnectionRes)) {
@$this->ldap->unbind($this->ldapConnectionRes);
};
}
@ -101,11 +97,9 @@ class Connection extends LDAPUtility {
* defines behaviour when the instance is cloned
*/
public function __clone() {
//a cloned instance inherits the connection resource. It may use it,
//but it may not disconnect it
$this->dontDestruct = true;
$this->configuration = new Configuration($this->configPrefix,
!is_null($this->configID));
$this->ldapConnectionRes = null;
}
/**