]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/LdapCommon/LdapCommon.php
Merge branch '0.9.x' into 1.0.x
[quix0rs-gnu-social.git] / plugins / LdapCommon / LdapCommon.php
index 7dea1f0ed420e1c282f8d433a42666071200b304..579fe4b64b474fe649198170037e9c1ba1a6ad33 100644 (file)
@@ -126,11 +126,11 @@ class LdapCommon
                 }
                 throw new Exception('Could not connect to LDAP server: '.$err->getMessage());
             }
-            $c = common_memcache();
+            $c = Cache::instance();
             if (!empty($c)) {
                 $cacheObj = new MemcacheSchemaCache(
                     array('c'=>$c,
-                       'cacheKey' => common_cache_key('ldap_schema:' . $config_id)));
+                       'cacheKey' => Cache::key('ldap_schema:' . $config_id)));
                 $ldap->registerSchemaCache($cacheObj);
             }
             self::$ldap_connections[$config_id] = $ldap;
@@ -144,6 +144,12 @@ class LdapCommon
         if(!$entry){
             return false;
         }else{
+            if(empty($password)) {
+                //NET_LDAP2 will do an anonymous bind if bindpw is not set / empty string
+                //which causes all login attempts that involve a blank password to appear
+                //to succeed. Which is obviously not good.
+                return false;
+            }
             $config = $this->get_ldap_config();
             $config['binddn']=$entry->dn();
             $config['bindpw']=$password;