summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib_ldap.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-04-16 17:28:58 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-04-16 17:28:58 +0200
commit9cd5221d47c9b849f7f797a2075a5c310aec4ed3 (patch)
tree8536ed66c01d0aea2df46dfad2c38385aac9c005 /apps/user_ldap/lib_ldap.php
parented54de1bbfe0c137ddaec35085b240b07e825c0a (diff)
downloadnextcloud-server-9cd5221d47c9b849f7f797a2075a5c310aec4ed3.tar.gz
nextcloud-server-9cd5221d47c9b849f7f797a2075a5c310aec4ed3.zip
group ldap: check configuration
Diffstat (limited to 'apps/user_ldap/lib_ldap.php')
-rw-r--r--apps/user_ldap/lib_ldap.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php
index be85c5debe1..eb6a7214c1c 100644
--- a/apps/user_ldap/lib_ldap.php
+++ b/apps/user_ldap/lib_ldap.php
@@ -144,8 +144,19 @@ class OC_LDAP {
self::$ldapNoCase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0);
self::$ldapUserDisplayName = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME);
- //TODO: sanity checking
- self::$configured = true;
+ if(
+ !empty(self::$ldapHost)
+ && !empty(self::$ldapPort)
+ && (
+ (!empty(self::$ldapAgentName) && !empty(self::$ldapAgentPassword))
+ || ( empty(self::$ldapAgentName) && empty(self::$ldapAgentPassword))
+ )
+ && !empty(self::$ldapBase)
+ && !empty(self::$ldapUserDisplayName)
+ )
+ {
+ self::$configured = true;
+ }
}
}
@@ -153,6 +164,9 @@ class OC_LDAP {
* Connects and Binds to LDAP
*/
static private function establishConnection() {
+ if(!self::$configured) {
+ return false;
+ }
if(!self::$ldapConnectionRes) {
self::$ldapConnectionRes = ldap_connect(self::$ldapHost, self::$ldapPort);
if(ldap_set_option(self::$ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) {