packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/ldap.php
changeset 8 f68fdcc18df9
parent 4 2212b2ded8bf
--- a/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/ldap.php	Fri Jan 18 19:59:50 2013 -0500
+++ b/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/ldap.php	Sat Feb 23 14:26:05 2013 -0500
@@ -62,13 +62,17 @@
 {
 	global $_ldapconn, $ldap_user_basedn;
 	
+	static $cache = array();
+	if ( isset($cache[$username]) )
+		return $cache[$username];
+	
 	$search_filter = sprintf("(&(uid=%s)(objectClass=posixAccount))", ldap_escape($username));
 	
 	$search_result = ldap_search($_ldapconn, $ldap_user_basedn, $search_filter);
 	if ( ldap_count_entries($_ldapconn, $search_result) !== 1 )
 		return false;
 	
-	return ldap_array_cleanup(ldap_get_attributes($_ldapconn, ldap_first_entry($_ldapconn, $search_result)));
+	return $cache[$username] = ldap_array_cleanup(ldap_get_attributes($_ldapconn, ldap_first_entry($_ldapconn, $search_result)));
 }
 
 function ldap_get_group($group)