]> source.dussan.org Git - nextcloud-server.git/commitdiff
LDAP: better check for emptiness, fixes #3815
authorArthur Schiwon <blizzz@owncloud.com>
Fri, 21 Jun 2013 21:19:53 +0000 (23:19 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Fri, 21 Jun 2013 21:19:53 +0000 (23:19 +0200)
apps/user_ldap/lib/connection.php

index 46bbbb17a4601b61910c09c82394928115430082..cf39329f150f93c7c40b755be3d582a76559f2d9 100644 (file)
@@ -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'];
                }