]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/LdapCommon/LdapCommon.php
better layout for single-bookmark page
[quix0rs-gnu-social.git] / plugins / LdapCommon / LdapCommon.php
index 7dea1f0ed420e1c282f8d433a42666071200b304..ef0343be435a356f5e700d8dbfd76c0147f4ca39 100644 (file)
@@ -140,10 +140,16 @@ class LdapCommon
 
     function checkPassword($username, $password)
     {
-        $entry = $this->get_user($username);
+        $entry = $this->get_user($username,array('dn' => 'dn'));
         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;
@@ -162,7 +168,7 @@ class LdapCommon
             //throw new Exception(_('Sorry, changing LDAP passwords is not supported at this time'));
             return false;
         }
-        $entry = $this->get_user($username);
+        $entry = $this->get_user($username,array('dn' => 'dn'));
         if(!$entry){
             return false;
         }else{