From bfa715768a22430273db956a14ed1a3cb964c743 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Sat, 25 May 2013 11:02:51 +0200 Subject: [PATCH 1/4] LDAP: fix handling when LDAP Host is offline --- apps/user_ldap/lib/connection.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index ba4de13534..8a61775a6f 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -601,14 +601,13 @@ class Connection { $error = null; } - $error = null; //if LDAP server is not reachable, try the Backup (Replica!) Server - if((!$bindStatus && ($error === -1)) + if((!$bindStatus && ($error !== 0)) || $this->config['ldapOverrideMainServer'] || $this->getFromCache('overrideMainServer')) { $this->doConnect($this->config['ldapBackupHost'], $this->config['ldapBackupPort']); $bindStatus = $this->bind(); - if($bindStatus && $error === -1) { + if(!$bindStatus && $error === -1) { //when bind to backup server succeeded and failed to main server, //skip contacting him until next cache refresh $this->writeToCache('overrideMainServer', true); From 86d72b9a61f5e8a9b57c6f0bb431eb6722aa12a3 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Sat, 25 May 2013 11:03:58 +0200 Subject: [PATCH 2/4] LDAP: fix possible recursion --- apps/user_ldap/lib/connection.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index 8a61775a6f..409f375879 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -635,10 +635,17 @@ class Connection { * Binds to LDAP */ public function bind() { + static $getConnectionResourceAttempt = false; if(!$this->config['ldapConfigurationActive']) { return false; } + if($getConnectionResourceAttempt) { + $getConnectionResourceAttempt = false; + return false; + } + $getConnectionResourceAttempt = true; $cr = $this->getConnectionResource(); + $getConnectionResourceAttempt = false; if(!is_resource($cr)) { return false; } From 4a0e69f94180725552ed35ba9cc81eeb6a71c3aa Mon Sep 17 00:00:00 2001 From: Florin Peter Date: Fri, 31 May 2013 11:55:40 +0200 Subject: [PATCH 3/4] fix login errors while filesystem is not loaded --- apps/files_encryption/hooks/hooks.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 955425595b..743593d798 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -46,6 +46,11 @@ class Hooks { $view = new \OC_FilesystemView('/'); + // ensure filesystem is loaded + if(!\OC\Files\Filesystem::$loaded) { + \OC_Util::setupFS($params['uid']); + } + $util = new Util($view, $params['uid']); // setup user, if user not ready force relogin From 1c4c89418bfb42017a61c71d27cc965fbb896793 Mon Sep 17 00:00:00 2001 From: Florin Peter Date: Fri, 31 May 2013 12:56:08 +0200 Subject: [PATCH 4/4] also fix login errors while filesystem is not loaded in app.php --- apps/files_encryption/appinfo/app.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php index d9bb4d5e74..99bdc2c247 100644 --- a/apps/files_encryption/appinfo/app.php +++ b/apps/files_encryption/appinfo/app.php @@ -25,6 +25,12 @@ stream_wrapper_register('crypt', 'OCA\Encryption\Stream'); // check if we are logged in if (OCP\User::isLoggedIn()) { + + // ensure filesystem is loaded + if(!\OC\Files\Filesystem::$loaded) { + \OC_Util::setupFS(); + } + $view = new OC_FilesystemView('/'); $session = new \OCA\Encryption\Session($view);