From 4797f9d7db8b48c977e34303a9c80eaea704af19 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 21 Jun 2013 23:19:53 +0200 Subject: [PATCH] LDAP: better check for emptiness, fixes #3815 --- apps/user_ldap/lib/connection.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index 46bbbb17a46..cf39329f150 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -421,11 +421,21 @@ class Connection { private function validateConfiguration() { // first step: "soft" checks: settings that are not really // necessary, but advisable. If left empty, give an info message - if(empty($this->config['ldapBaseUsers'])) { + if(empty($this->config['ldapBaseUsers']) || + // this part handles return of preg_split in readConfiguration + (count($this->config['ldapBaseUsers'][0]) === 1 + && isset($this->config['ldapBaseUsers'][0]) + && empty($this->config['ldapBaseUsers'][0])) + ) { \OCP\Util::writeLog('user_ldap', 'Base tree for Users is empty, using Base DN', \OCP\Util::INFO); $this->config['ldapBaseUsers'] = $this->config['ldapBase']; } - if(empty($this->config['ldapBaseGroups'])) { + if(empty($this->config['ldapBaseGroups']) || + // this part handles return of preg_split in readConfiguration + (count($this->config['ldapBaseGroups'][0]) === 1 + && isset($this->config['ldapBaseGroups'][0]) + && empty($this->config['ldapBaseGroups'][0])) + ) { \OCP\Util::writeLog('user_ldap', 'Base tree for Groups is empty, using Base DN', \OCP\Util::INFO); $this->config['ldapBaseGroups'] = $this->config['ldapBase']; } -- 2.39.5