Revision: 2281
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2281&view=rev
Author:   cimorrison
Date:     2012-04-08 16:16:07 +0000 (Sun, 08 Apr 2012)
Log Message:
-----------
Fixed performance issue when using LDAP authentication and HTTP sessions.   
Thanks to dwpoon.   See SF ID: 3515309

Modified Paths:
--------------
    mrbs/trunk/web/session_http.inc

Modified: mrbs/trunk/web/session_http.inc
===================================================================
--- mrbs/trunk/web/session_http.inc     2012-04-04 15:57:55 UTC (rev 2280)
+++ mrbs/trunk/web/session_http.inc     2012-04-08 16:16:07 UTC (rev 2281)
@@ -46,23 +46,32 @@
 function getUserName()
 {
   global $PHP_AUTH_USER;
+  
+  // We save the results of the user validation so that we avoid any 
performance
+  // penalties in authValidateUser, which can be severe if for example we are 
using
+  // LDAP authentication
+  static $authorised_user = NULL;
+
   if (isset($PHP_AUTH_USER))
   {
     $user = unslashes($PHP_AUTH_USER);
 
-    if (authValidateUser($user,getAuthPassword()))
+    if ((isset($authorised_user) && ($authorised_user == $user)) ||
+        authValidateUser($user,getAuthPassword()))
     {
-      return $user;
+      $authorised_user = $user;
     }
     else
     {
-      return null;
+      $authorised_user = NULL;
     }
   }
   else
   {
-    return null;
+    $authorised_user = NULL;
   }
+  
+  return $authorised_user;
 }
 
 // Print the logon entry on the top banner.

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to