Ver código fonte

Clearing Debugging in LDAP

svalavuo 6 dias atrás
pai
commit
9743d36dde
1 arquivos alterados com 7 adições e 12 exclusões
  1. 7 12
      includes/ldap.php

+ 7 - 12
includes/ldap.php

@@ -133,24 +133,18 @@ class LDAPAuth {
             }
             
             if (!$bind_result) {
-                $error = 'LDAP bind failed';
-                error_log("LDAP Connection Test Error: $error - Host: {$this->config['host']}, Port: {$this->config['port']}, Base DN: {$this->config['base_dn']}");
-                throw new Exception($error);
+                throw new Exception('LDAP bind failed');
             }
             
             // Test search
             $search = ldap_search($this->connection, $this->config['base_dn'], '(objectClass=*)', ['dn']);
             if (!$search) {
-                $error = 'LDAP search failed';
-                error_log("LDAP Connection Test Error: $error - Host: {$this->config['host']}, Port: {$this->config['port']}, Base DN: {$this->config['base_dn']}");
-                throw new Exception($error);
+                throw new Exception('LDAP search failed');
             }
             
             return true;
             
         } catch (Exception $e) {
-            $error = 'Connection failed: ' . $e->getMessage();
-            error_log("LDAP Connection Test Error: $error - Host: {$this->config['host']}, Port: {$this->config['port']}, Base DN: {$this->config['base_dn']}");
             return false;
         } finally {
             $this->disconnect();
@@ -164,9 +158,7 @@ class LDAPAuth {
         $this->connection = @ldap_connect($connection_string);
         
         if (!$this->connection) {
-            $error = 'Failed to connect to LDAP server';
-            error_log("LDAP Connection Error: $error - Host: {$this->config['host']}, Port: {$this->config['port']}, Base DN: {$this->config['base_dn']}");
-            throw new Exception($error);
+            throw new Exception('Failed to connect to LDAP server');
         }
         
         // Set LDAP options
@@ -230,7 +222,10 @@ class LDAPAuth {
                 throw new Exception('LDAP search failed');
             }
             
-            ldap_control_paged_result($this->connection, $limit);
+            // Use pagination for large result sets
+if (function_exists('ldap_control_paged_result')) {
+    ldap_control_paged_result($this->connection, $limit);
+}
             $entries = ldap_get_entries($this->connection, $search);
             
             $users = [];