]> git.entuzijast.net Git - freeradius-dialup-admin.git/commitdiff
* In lib/ldap/functions.php3 only ask for the cn attribute in ldap_search not the...
authorkkalev <kkalev>
Sun, 29 Sep 2002 11:39:42 +0000 (11:39 +0000)
committerkkalev <kkalev>
Sun, 29 Sep 2002 11:39:42 +0000 (11:39 +0000)
  user_finger a lot faster when the user database is in ldap
* In lib/functions.php3 pass a second argument to date2timediv with the current time. user_finger calls that
  function for each online user so we now don't need to do a lot of calls to time() but only one. That should make
  user_finger somewhat faster.

Changelog
htdocs/user_admin.php3
htdocs/user_finger.php3
lib/functions.php3
lib/ldap/functions.php3

index 21f3c34b5698fb1d81f0066628e937d60dc8badf..701231fd23fa2437654de2e7116e86d3559b7d61 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -14,6 +14,11 @@ Ver 1.60:
 * html fixes in accounting.php3
 * Fix a problem in user_accounting when NASIPAddress is not set.
 * Use CISCO-AAA-SESSION-MIB in snmpfinger
+* In lib/ldap/functions.php3 only ask for the cn attribute in ldap_search not the whole entry. That should make
+  user_finger a lot faster when the user database is in ldap
+* In lib/functions.php3 pass a second argument to date2timediv with the current time. user_finger calls that
+  function for each online user so we now don't need to do a lot of calls to time() but only one. That should make
+  user_finger somewhat faster.
 Ver 1.59:
 * Small html fixes in user_edit.php3 and password.php3
 * Show number of failed logins in the last 7 days in the user admin page
index 703120293e233627dbb4bf5584d151144ad8b415..e6491fc9a1f4bafa04d262e0c55c22cbe1960922 100644 (file)
@@ -170,7 +170,7 @@ if ($link){
                        $lastlog_time = $row['AcctStartTime'];
                        $lastlog_server_ip = $row['NASIPAddress'];
                        $lastlog_server_port = $row['NASPortId'];
-                       $lastlog_session_time = date2timediv($lastlog_time);
+                       $lastlog_session_time = date2timediv($lastlog_time,0);
                        if ($daily_limit != 'none'){
                                $remaining = $remaining - $lastlog_session_time;
                                if ($remaining < 0)
index 35a1419f0246ecc3b8092e116049b780f49f95fa..9d242050bf93d09a7e1fae6e61cf9bd453807607 100644 (file)
@@ -74,6 +74,7 @@ if ($link){
                AcctStopTime = '0' AND NASIPAddress = '$name_data' $extra
                GROUP BY UserName ORDER BY AcctStartTime;");
                if ($search){
+                       $now = time();
                        while($row = @da_sql_fetch_array($search,$config)){
                                $num++;
                                $h += 21;
@@ -82,7 +83,7 @@ if ($link){
                                if ($finger_info[$servers_num][$num]['ip'] == '')
                                        $finger_info[$servers_num][$num]['ip'] = '-';
                                $session_time = $row['AcctStartTime'];
-                               $session_time = date2timediv($session_time);
+                               $session_time = date2timediv($session_time,$now);
                                $finger_info[$servers_num][$num]['session_time'] = time2strclock($session_time);
                                $finger_info[$servers_num][$num]['user'] = $user;
                                $finger_info[$servers_num][$num]['callerid'] = $row['CallingStationId'];
index 1a60c1f3fa57ae019fd88b31482c78517d60e8c4..88cd1975d97b1b115815cb07055ad42f5a0cbe60 100644 (file)
@@ -64,13 +64,14 @@ function time2strclock($time)
        return $ret;
 }
 
-function date2timediv($date)
+function date2timediv($date,$now)
 {
        list($day,$time)=explode(' ',$date);
        $day = explode('-',$day);
        $time = explode(':',$time);
        $timest = mktime($time[0],$time[1],$time[2],$day[1],$day[2],$day[0]);
-       $now = time();
+       if (!$now)
+               $now = time();
        return ($now - $timest);
 }
 
index d480bf31d7c319d796a021daf4c1a6f0f13d4d44..14481f418a28bf204b55c7f6baba66fe5d898194 100644 (file)
@@ -38,7 +38,8 @@ function connect2db($config)
 function get_user_info($ds,$user,$config)
 {
        if ($ds){
-               $sr=@ldap_search($ds,"$config[ldap_base]", "uid=" . $user);
+               $attrs = array('cn');
+               $sr=@ldap_search($ds,"$config[ldap_base]", "uid=" . $user,$attrs);
                $info = @ldap_get_entries($ds, $sr);
                $cn = $info[0]["cn"][0];
                if ($cn == '')