summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2016-04-22 21:43:41 +0200
committerArthur Schiwon <blizzz@owncloud.com>2016-04-22 21:43:41 +0200
commit203b0e9cbad07caf581708ae1e384922b662fa90 (patch)
tree683438bf9a93638887f8f403a667b9eb02cdb80f /apps/user_ldap
parent5a8238788b190eda8a6db17a60d38058b0225f22 (diff)
downloadnextcloud-server-203b0e9cbad07caf581708ae1e384922b662fa90.tar.gz
nextcloud-server-203b0e9cbad07caf581708ae1e384922b662fa90.zip
on clone Connection, do not take over the existing LDAP resource
For one, it solves potential conflicts when using the resource. For the other, one on the login check (the only place where a clone happens currently) we do not need to rebind after confirming the user's login was successful.
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/lib/access.php4
-rw-r--r--apps/user_ldap/lib/connection.php10
2 files changed, 3 insertions, 11 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 135eca1e625..ad273845509 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -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();
}
/**
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index 53c9b3790a7..8b55e2598f4 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -49,9 +49,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;
/**
@@ -94,8 +91,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);
};
}
@@ -104,11 +100,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;
}
/**