Pārlūkot izejas kodu

Switched from ldap_get_attributes() to more reliable ldap_get_dn()

Ben Tyger 4 gadi atpakaļ
vecāks
revīzija
3c63025a15
1 mainītis faili ar 5 papildinājumiem un 5 dzēšanām
  1. 5 5
      app/Controllers/Auth/AuthController.php

+ 5 - 5
app/Controllers/Auth/AuthController.php

@@ -80,20 +80,20 @@ abstract class AuthController extends Controller
         //Dynamic LDAP User Binding
         //Dynamic LDAP User Binding
         if (@is_string($this->config['ldap']['search_filter'])) {
         if (@is_string($this->config['ldap']['search_filter'])) {
             //Replace ???? with username
             //Replace ???? with username
-            $searchFilter=str_replace('????', ldap_escape($username,null,LDAP_ESCAPE_FILTER), $this->config['ldap']['search_filter']);
-            $ldapAddributes=array ('dn');
-            $ldapSearchResp=ldap_search(
+            $searchFilter = str_replace('????', ldap_escape($username,null,LDAP_ESCAPE_FILTER), $this->config['ldap']['search_filter']);
+            $ldapAddributes = array ('dn');
+            $ldapSearchResp = ldap_search(
                 $server, 
                 $server, 
                 $this->config['ldap']['base_domain'], 
                 $this->config['ldap']['base_domain'], 
                 $searchFilter,
                 $searchFilter,
                 $ldapAddributes
                 $ldapAddributes
             );
             );
             if (ldap_count_entries($server, $ldapSearchResp) !== 1 ) {
             if (ldap_count_entries($server, $ldapSearchResp) !== 1 ) {
-                $this->logger->warn("$username not found or had multiple entries");
+                $this->logger->warn("LDAP search for $username not found or had multiple entries");
                 return null;
                 return null;
             }
             }
             $ldapEntry = ldap_first_entry($server, $$ldapSearchResp);
             $ldapEntry = ldap_first_entry($server, $$ldapSearchResp);
-            $bindString=@ldap_get_values($server, $ldapEntry, 'dn');
+            $bindString = ldap_get_dn($server, $ldapEntry);
             
             
             
             
         } else {
         } else {