aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/connection.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-08-20 12:39:24 +0200
committerArthur Schiwon <blizzz@owncloud.com>2013-09-27 13:34:15 +0200
commit52454e39b7e04869f2cb3253d6978bbef5ece7fc (patch)
treeacb6ee9b633dfbab5c468ba93d8be66394b7bc96 /apps/user_ldap/lib/connection.php
parentd34fbf3a8647806779d908b599068b9000d0c4e4 (diff)
downloadnextcloud-server-52454e39b7e04869f2cb3253d6978bbef5ece7fc.tar.gz
nextcloud-server-52454e39b7e04869f2cb3253d6978bbef5ece7fc.zip
LDAP: move is_resource check to ldap wrapper to make it mockable
Diffstat (limited to 'apps/user_ldap/lib/connection.php')
-rw-r--r--apps/user_ldap/lib/connection.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index 42139274666..6a0d00405c0 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -92,7 +92,8 @@ class Connection extends BackendBase {
}
public function __destruct() {
- if(!$this->dontDestruct && is_resource($this->ldapConnectionRes)) {
+ if(!$this->dontDestruct &&
+ $this->ldap->isResource($this->ldapConnectionRes)) {
@$this->ldap->unbind($this->ldapConnectionRes);
};
}
@@ -149,7 +150,7 @@ class Connection extends BackendBase {
public function getConnectionResource() {
if(!$this->ldapConnectionRes) {
$this->init();
- } else if(!is_resource($this->ldapConnectionRes)) {
+ } else if(!$this->ldap->isResource($this->ldapConnectionRes)) {
$this->ldapConnectionRes = null;
$this->establishConnection();
}
@@ -624,7 +625,7 @@ class Connection extends BackendBase {
if(!$this->config['ldapOverrideMainServer'] && !$this->getFromCache('overrideMainServer')) {
$this->doConnect($this->config['ldapHost'], $this->config['ldapPort']);
$bindStatus = $this->bind();
- $error = is_resource($this->ldapConnectionRes) ? ldap_errno($this->ldapConnectionRes) : -1;
+ $error = $this->ldap->isResource($this->ldapConnectionRes) ? ldap_errno($this->ldapConnectionRes) : -1;
} else {
$bindStatus = false;
$error = null;
@@ -679,7 +680,7 @@ class Connection extends BackendBase {
$getConnectionResourceAttempt = true;
$cr = $this->getConnectionResource();
$getConnectionResourceAttempt = false;
- if(!is_resource($cr)) {
+ if(!$this->ldap->isResource($cr)) {
return false;
}
$ldapLogin = @$this->ldap->bind($cr, $this->config['ldapAgentName'], $this->config['ldapAgentPassword']);