Changeset:
        67bb72966a5a
        
https://sourceforge.net/p/mrbs/hg-code/ci/67bb72966a5a674844ed6f0c9f0b073fe126b0f3
Author:
        John Beranek <[email protected]>
Date:
        Fri Nov 13 18:48:49 2015 +0000
Log message:

Improved debugging in auth_ldap a bit, to show errors from
the ldap extension.

diffstat:

 web/auth/auth_ldap.inc |  26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diffs (53 lines):

diff -r e406bf4124dd -r 67bb72966a5a web/auth/auth_ldap.inc
--- a/web/auth/auth_ldap.inc    Mon Nov 09 11:19:44 2015 +0000
+++ b/web/auth/auth_ldap.inc    Fri Nov 13 18:48:49 2015 +0000
@@ -176,10 +176,15 @@
           // Anonymous bind
           $res = @ldap_bind($ldap);
         }
-        authLdapDebug("authLdapAction: Result of initial bind is $res");
 
-        if ($res)
+        if (!$res)
         {
+          authLdapDebug("authLdapAction: Initial bind failed: 
".ldap_error($ldap));
+        }
+        else
+        {
+          authLdapDebug("authLdapAction: Initial bind was successful");
+
           $res = @ldap_search($ldap,
                               $all_ldap_opts['ldap_base_dn'][$idx],
                               "(". 
$all_ldap_opts['ldap_dn_search_attrib'][$idx] ."=$user)");
@@ -221,11 +226,18 @@
         }
       }
 
-      $res = $callback($ldap, $all_ldap_opts['ldap_base_dn'][$idx], $dn,
-                       $user_search, $user, $object);
-      if ($res)
+      if (!$dn)
       {
-        return $res;
+        authLdapDebug("authLdapAction: No DN determined, not calling 
callback");
+      }
+      else
+      {
+        $res = $callback($ldap, $all_ldap_opts['ldap_base_dn'][$idx], $dn,
+                         $user_search, $user, $object);
+        if ($res)
+        {
+          return $res;
+        }
       }
 
     } // if ($ldap)
@@ -440,7 +452,7 @@
   }
   else
   {
-    authLdapDebug("authValidateUserCallback: Bind to '$dn' failed");
+    authLdapDebug("authValidateUserCallback: Bind to '$dn' failed: 
".ldap_error($ldap));
   }
 
   if ($ldap_unbind_between_attempts)

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to