summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-07-02 14:03:16 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-07-02 14:03:29 +0200
commit515adceaceea8de6e3264f17b2fe24419da10959 (patch)
tree5b1b04954098cbd09f7e5edea1f819e232d222d4
parent90331a3fa1c2bd7c1ec5efb6b9f55d02d1ffe273 (diff)
downloadnextcloud-server-515adceaceea8de6e3264f17b2fe24419da10959.tar.gz
nextcloud-server-515adceaceea8de6e3264f17b2fe24419da10959.zip
LDAP: reset resource on failed bind
check for resource
-rw-r--r--apps/user_ldap/lib_ldap.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php
index 21c4e57e293..152977ff7f7 100644
--- a/apps/user_ldap/lib_ldap.php
+++ b/apps/user_ldap/lib_ldap.php
@@ -474,17 +474,16 @@ class OC_LDAP {
// See if we have a resource
$link_resource = self::getConnectionResource();
- if($link_resource)
- {
+ if(is_resource($link_resource)) {
$sr = ldap_search($link_resource, $base, $filter, $attr);
$findings = ldap_get_entries($link_resource, $sr );
+
// if we're here, probably no connection resource is returned.
// to make ownCloud behave nicely, we simply give back an empty array.
if(is_null($findings)) {
return array();
}
- } else
- {
+ } else {
// Seems like we didn't find any resource.
// Return an empty array just like before.
return array();
@@ -690,6 +689,7 @@ class OC_LDAP {
$ldapLogin = @ldap_bind(self::$ldapConnectionRes, self::$ldapAgentName, self::$ldapAgentPassword );
if(!$ldapLogin) {
OCP\Util::writeLog('ldap', 'Bind failed: ' . ldap_errno(self::$ldapConnectionRes) . ': ' . ldap_error(self::$ldapConnectionRes), OCP\Util::ERROR);
+ self::$ldapConnectionRes = null;
return false;
}
}