Merge pull request #24214 from owncloud/fix-ldap-connection-unbind-on-login
on clone Connection, do not take over the existing LDAP resource
This commit is contained in:
commit
7a22e3f083
|
@ -1295,9 +1295,7 @@ class Access extends LDAPUtility implements user\IUserTools {
|
||||||
if(!$testConnection->setConfiguration($credentials)) {
|
if(!$testConnection->setConfiguration($credentials)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$result=$testConnection->bind();
|
return $testConnection->bind();
|
||||||
$this->ldap->unbind($this->connection->getConnectionResource());
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,9 +49,6 @@ class Connection extends LDAPUtility {
|
||||||
private $configPrefix;
|
private $configPrefix;
|
||||||
private $configID;
|
private $configID;
|
||||||
private $configured = false;
|
private $configured = false;
|
||||||
|
|
||||||
//whether connection should be kept on __destruct
|
|
||||||
private $dontDestruct = false;
|
|
||||||
private $hasPagedResultSupport = true;
|
private $hasPagedResultSupport = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,8 +91,7 @@ class Connection extends LDAPUtility {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
if(!$this->dontDestruct &&
|
if($this->ldap->isResource($this->ldapConnectionRes)) {
|
||||||
$this->ldap->isResource($this->ldapConnectionRes)) {
|
|
||||||
@$this->ldap->unbind($this->ldapConnectionRes);
|
@$this->ldap->unbind($this->ldapConnectionRes);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -104,11 +100,9 @@ class Connection extends LDAPUtility {
|
||||||
* defines behaviour when the instance is cloned
|
* defines behaviour when the instance is cloned
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
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,
|
$this->configuration = new Configuration($this->configPrefix,
|
||||||
!is_null($this->configID));
|
!is_null($this->configID));
|
||||||
|
$this->ldapConnectionRes = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue