From 536fbb918919b3eb4c8d58b1d4e540c772353b07 Mon Sep 17 00:00:00 2001
From: Arthur Schiwon <blizzz@owncloud.com>
Date: Wed, 22 Aug 2012 15:22:52 +0200
Subject: [PATCH] LDAP: fix potentially unavailable LDAP resource, which can
 prevent successful login

---
 apps/user_ldap/lib/connection.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index 503245a339..9bb012e910 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -91,6 +91,9 @@ class Connection {
 	public function getConnectionResource() {
 		if(!$this->ldapConnectionRes) {
 			$this->init();
+		} else if(!is_resource($this->ldapConnectionRes)) {
+			$this->ldapConnectionRes = null;
+			$this->establishConnection();
 		}
 		if(is_null($this->ldapConnectionRes)) {
 			\OCP\Util::writeLog('user_ldap', 'Connection could not be established', \OCP\Util::ERROR);
-- 
GitLab