]> source.dussan.org Git - nextcloud-server.git/commitdiff
LDAP: Fall back to Base DN if user/group base settings are blanked
authorArthur Schiwon <blizzz@owncloud.com>
Mon, 7 May 2012 16:37:44 +0000 (18:37 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Mon, 7 May 2012 16:38:02 +0000 (18:38 +0200)
apps/user_ldap/lib_ldap.php

index c71c0cb7e543d88a31f1cd4fc4c3f01baafff638..4c2c22cbbeeba7ffc8f4036d43789eaf31d29f31 100755 (executable)
@@ -568,6 +568,15 @@ class OC_LDAP {
                        self::$ldapUserFilter       = OCP\Config::getAppValue('user_ldap', 'ldap_userlist_filter','objectClass=person');
                        self::$ldapGroupDisplayName = OCP\Config::getAppValue('user_ldap', 'ldap_group_display_name', LDAP_GROUP_DISPLAY_NAME_ATTR);
 
+                       if(empty(self::$ldapBaseUsers)) {
+                               OCP\Util::writeLog('ldap', 'Base for Users is empty, using Base DN', OCP\Util::INFO);
+                               self::$ldapBaseUsers = self::$ldapBase;
+                       }
+                       if(empty(self::$ldapBaseGroups)) {
+                               OCP\Util::writeLog('ldap', 'Base for Groups is empty, using Base DN', OCP\Util::INFO);
+                               self::$ldapBaseGroups = self::$ldapBase;
+                       }
+
                        if(
                                   !empty(self::$ldapHost)
                                && !empty(self::$ldapPort)
@@ -576,8 +585,6 @@ class OC_LDAP {
                                        || ( empty(self::$ldapAgentName) &&  empty(self::$ldapAgentPassword))
                                )
                                && !empty(self::$ldapBase)
-                               && !empty(self::$ldapBaseUsers)
-                               && !empty(self::$ldapBaseGroups)
                                && !empty(self::$ldapUserDisplayName)
                        )
                        {
@@ -591,6 +598,7 @@ class OC_LDAP {
         */
        static private function establishConnection() {
                if(!self::$configured) {
+                       OCP\Util::writeLog('ldap', 'Configuration is invalid, cannot connect', OCP\Util::INFO);
                        return false;
                }
                if(!self::$ldapConnectionRes) {