lib/Auth

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Wed Sep 5 10:03:19 CEST 2012


 lib/Auth/LDAP.php |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit e0ad3543b135342cbf15da350683cb3813aa8b0e
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Sep 5 09:01:08 2012 +0100

    Do not log the $result unless indeed we have a result (#986)

diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 14059c6..2afd737 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -502,7 +502,7 @@ class LDAP extends Net_LDAP3 {
         }
 
         $base_dn = $this->_subject_base_dn("role");
-
+        Log::trace("Auth::LDAP::list_roles() using \$base_dn: " . var_export($base_dn, TRUE));
         // TODO: From config
         $filter  = "(&(objectclass=ldapsubentry)(objectclass=nsroledefinition))";
 
@@ -904,7 +904,9 @@ class LDAP extends Net_LDAP3 {
             if (empty($subject_base_dn)) {
                 $subject_base_dn = $this->conf->get_raw("ldap", $subject . "_base_dn");
             }
-            $base_dn = $this->conf->expand($subject_base_dn, array("base_dn" => $base_dn));
+            if (!empty($subject_base_dn)) {
+                $base_dn = $this->conf->expand($subject_base_dn, array("base_dn" => $base_dn));
+            }
         }
 
         $this->_log(LOG_DEBUG, "subject_base_dn for subject $subject results in $base_dn");
@@ -1384,9 +1386,12 @@ class LDAP extends Net_LDAP3 {
 
         $result = $this->search($entry_dn, '(objectclass=*)', 'base');
 
-        $this->_log(LOG_DEBUG, "Auth::LDAP::_read() result: " . var_export($result->entries(TRUE), TRUE));
-
-        return $result ? $result->entries(TRUE) : FALSE;
+        if ($result) {
+            $this->_log(LOG_DEBUG, "Auth::LDAP::_read() result: " . var_export($result->entries(TRUE), TRUE));
+            return $result->entries(TRUE);
+        } else {
+            return FALSE;
+        }
     }
 
     private function _search($base_dn, $filter = '(objectclass=*)', $attributes = Array('*')) {





More information about the commits mailing list