From 08ff050efc63045d7c3bd54a35add68c3f90ada2 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sat, 29 Aug 2009 16:24:03 -0400
Subject: [PATCH] - allow empty LDAP 'filter' (#1485184)

---
 program/include/rcube_ldap.php |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index 762e6e3..e735086 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -244,7 +244,7 @@
       $filter = $this->prop['filter'];
       $this->set_search_set($filter);
     }
-    
+
     // exec LDAP search if no result resource is stored
     if ($this->conn && !$this->ldap_result)
       $this->_exec_search();
@@ -381,7 +381,7 @@
     $res = null;
     if ($this->conn && $dn)
     {
-      $this->ldap_result = ldap_read($this->conn, base64_decode($dn), "(objectclass=*)", array_values($this->fieldmap));
+      $this->ldap_result = ldap_read($this->conn, base64_decode($dn), '(objectclass=*)', array_values($this->fieldmap));
       $entry = @ldap_first_entry($this->conn, $this->ldap_result);
 
       if ($entry && ($rec = ldap_get_attributes($this->conn, $entry)))
@@ -554,10 +554,11 @@
    */
   function _exec_search()
   {
-    if ($this->ready && $this->filter)
+    if ($this->ready)
     {
+      $filter = $this->filter ? $this->filter : '(objectclass=*)';
       $function = $this->prop['scope'] == 'sub' ? 'ldap_search' : ($this->prop['scope'] == 'base' ? 'ldap_read' : 'ldap_list');
-      $this->ldap_result = $function($this->conn, $this->prop['base_dn'], $this->filter, array_values($this->fieldmap), 0, 0);
+      $this->ldap_result = $function($this->conn, $this->prop['base_dn'], $filter, array_values($this->fieldmap), 0, 0);
       return true;
     }
     else

--
Gitblit v1.9.1