]> git.entuzijast.net Git - freeradius-dialup-admin.git/commitdiff
* html fixes in user_finger.php3
authorkkalev <kkalev>
Tue, 11 Jun 2002 17:09:56 +0000 (17:09 +0000)
committerkkalev <kkalev>
Tue, 11 Jun 2002 17:09:56 +0000 (17:09 +0000)
* Fix a bug in lib/add_badusers.php3 which did not allow inserts in the badusers table.
* Make lib/ldap/password_check.php3 behave properly when it is passed a null password
* Allow for daily/weekly/monthly limits to be set to none and show correct results in the show user page

Changelog
htdocs/user_admin.php3
htdocs/user_finger.php3
lib/add_badusers.php3
lib/ldap/password_check.php3

index 7275a739eb3fe11b10173841abd6efa6903df5c9..6598c6335a1c7c8266b86e8b8b651de7cc3e72db 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -4,8 +4,12 @@ Ver 1.30:
   Bug noted by Timophey <bcloud@mail.ru>
 * Reaarange a few things in user_admin. Put Subscription Analysis first and 'Account Status' second. Make a
   few things bold.
-* Change log_badlogins to use the mysql binary instead of the DBI module. That way we don't have any dependencies
-  and we don't need to bother with connection maintainance (dead mysql connections etc).
+* Change log_badlogins to use the mysql binary instead of the DBI module. That way we don't have any
+  dependencies and we don't need to bother with connection maintainance (dead mysql connections etc).
+* html fixes in user_finger.php3
+* Fix a bug in lib/add_badusers.php3 which did not allow inserts in the badusers table.
+* Make lib/ldap/password_check.php3 behave properly when it is passed a null password
+* Allow for daily/weekly/monthly limits to be set to none and show correct results in the show user page
 Ver 1.29:
 * Add general_ld_library_path directive and set LD_LIBRARY_PATH accordingly (used in snmpfinger and
   radaclient).
index e84b641b0495dd2a674fd8aaf6ba11e2f9d1e270..b9c74923feefb6d4fb0566b165c575731b5442da 100644 (file)
@@ -45,12 +45,16 @@ EOM;
        exit();
 }
 
+$monthly_limit = ($item_vals['Max-Weekly-Session'][0] != '') ? $item_vals['Max-Weekly-Session'][0] : $default_vals['Max-Weekly-Session'];
+$monthly_limit = ($monthly_limit) ? $monthly_limit : $config[counter_default_monthly];
 $weekly_limit = ($item_vals['Max-Weekly-Session'][0] != '') ? $item_vals['Max-Weekly-Session'][0] : $default_vals['Max-Weekly-Session'];
 $weekly_limit = ($weekly_limit) ? $weekly_limit : $config[counter_default_weekly];
 $daily_limit = ($item_vals['Max-Daily-Session'][0] != '') ? $item_vals['Max-Daily-Session'][0] : $default_vals['Max-Daily-Session'];
 $daily_limit = ($daily_limit) ? $daily_limit : $config[counter_default_daily];
 $session_limit = ($item_vals['Session-Timeout'][0] != '') ? $item_vals['Session-Timeout'][0] : $default_vals['Session-Timeout'];
 $session_limit = ($session_limit) ? $session_limit : 'none';
+$remaining = 'unlimited time';
+$log_color = 'green';
 
 $now = time();
 $week = $now - 604800;
@@ -104,20 +108,22 @@ if ($link){
                if ($search){
                        $row = @da_sql_fetch_array($search,$config);
                        $used[$i] = $row['sum(AcctSessionTime)'];
-                       if ($used[$i] > $daily_limit)
+                       if ($daily_limit != 'none' && $used[$i] > $daily_limit)
                                $used[$i] = "<font color=red>" . time2str($used[$i]) . "</font>";
                        else
                                $used[$i] = time2str($used[$i]);
                        if ($today == $i){
                                $daily_used = $row['sum(AcctSessionTime)'];
-                               $remaining = $daily_limit - $daily_used;
-                               if ($remaining <=0)
-                                       $remaining = 0;
-                               $log_color = ($remaining) ? 'green' : 'red';
-                               if (!$remaining)
-                                       $extra_msg = '(Out of daily quota)';
+                               if ($daily_limit != 'none'){
+                                       $remaining = $daily_limit - $daily_used;
+                                       if ($remaining <=0)
+                                               $remaining = 0;
+                                       $log_color = ($remaining) ? 'green' : 'red';
+                                       if (!$remaining)
+                                               $extra_msg = '(Out of daily quota)';
+                               }
                                $daily_used = time2str($daily_used);
-                               if (!$remaining)
+                               if ($daily_limit != 'none' && !$remaining)
                                        $daily_used = "<font color=red>$daily_used</font>";
                        }
                }
@@ -129,16 +135,18 @@ if ($link){
        if ($search){
                $row = @da_sql_fetch_array($search,$config);
                $weekly_used = $row['sum(AcctSessionTime)'];
-               $tmp = $weekly_limit - $weekly_used;
-               if ($tmp <=0){
-                       $tmp = 0;
-                       $extra_msg .= '(Out of weekly quota)';
+               if ($weekly_limit != 'none'){
+                       $tmp = $weekly_limit - $weekly_used;
+                       if ($tmp <=0){
+                               $tmp = 0;
+                               $extra_msg .= '(Out of weekly quota)';
+                       }
+                       if ($remaining > $tmp)
+                               $remaining = $tmp;
+                       $log_color = ($remaining) ? 'green' : 'red';
                }
-               if ($remaining > $tmp)
-                       $remaining = $tmp;
-               $log_color = ($remaining) ? 'green' : 'red';
                $weekly_used = time2str($weekly_used);
-               if (!$tmp)
+               if ($weekly_limit != 'none' && !$tmp)
                        $weekly_used = "<font color=red>$weekly_used</font>";
        }
        $search = @da_sql_query($link,$config,
@@ -153,10 +161,12 @@ if ($link){
                        $lastlog_server_ip = $row['NASIPAddress'];
                        $lastlog_server_port = $row['NASPortId'];
                        $lastlog_session_time = date2timediv($lastlog_time);
-                       $remaining = $daily_limit - $lastlog_session_time;
-                       if ($remaining < 0)
-                               $remaining = 0;
-                       $log_color = ($remaining) ? 'green' : 'red'; 
+                       if ($daily_limit != 'none'){
+                               $remaining = $daily_limit - $lastlog_session_time;
+                               if ($remaining < 0)
+                                       $remaining = 0;
+                               $log_color = ($remaining) ? 'green' : 'red'; 
+                       }
                        $lastlog_session_time_jvs = 1000 * $lastlog_session_time;
                        $lastlog_session_time = time2strclock($lastlog_session_time);
                        $lastlog_client_ip = $row['FramedIPAddress'];   
@@ -200,11 +210,11 @@ if ($link){
        }
 }
 
-$monthly_limit = time2str($monthly_limit);
-$weekly_limit = time2str($weekly_limit);
-$daily_limit = time2str($daily_limit);
-$session_limit = time2str($session_limit);
-$remaining = time2str($remaining);
+$monthly_limit = (is_numeric($monthly_limit)) ? time2str($monthly_limit) : $monthly_limit;
+$weekly_limit = (is_numeric($weekly_limit)) ? time2str($weekly_limit) : $weekly_limit;
+$daily_limit = (is_numeric($daily_limit)) ? time2str($daily_limit) : $daily_limit;
+$session_limit = (is_numeric($session_limit)) ? time2str($session_limit) : $session_limit;
+$remaining = (is_numeric($remaining)) ? time2str($remaining) : $remaining;
 
 if ($item_vals['Dialup-Access'][0] == 'FALSE')
        $msg =<<<EON
index b8dc33d40bc765342cbee82507213f60aa64564c..efff83106f43ea5fd4e99cd9de03c75e85fbf734 100644 (file)
@@ -122,7 +122,7 @@ EOM;
        <th align=left>$server_name[$j]<br><font color="green">$server_model[$j]</font></th><th align=right><font color="red">$server_loggedin[$j] users connected</font></th><th><font color="green">$server_rem[$j] free lines</font></th>
        </tr>
        </table>
-       <div height="$height[$j]" style="height:$height[$j];overflow:auto;">
+       <div height="$height[$j]" style="height:$height[$j]">
        <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
        <tr bgcolor="#d0ddb0">
        <th>#</th><th>user</th><th>ip address</th><th>caller id</th><th>name</th><th>duration</th>
index 7ed057446a68cc8b224da25d6ec94eea0c0b0cac..22357723f24cca87afa38d2702df01f8da1c97fa 100644 (file)
@@ -7,7 +7,8 @@ else{
 }
 
 $date=date($config[sql_full_date_format]);
-$msg = $$attrmap['Dialup-Lock-Msg'];
+$lockmsg_name = $attrmap['Dialup-Lock-Msg'] . '0';
+$msg = $$lockmsg_name;
 if ($msg == '')
        echo "<b>Lock Message should not be empty</b><br>\n";
 else{
index 41dcb9d47b40a3eb40644d9135423a444679c102..6893d82986dd9d3f336d2e1cfe425c4825b6faf3 100644 (file)
@@ -5,6 +5,8 @@ if ($action == 'checkpass'){
        $ds=@ldap_connect("$config[ldap_server]");  // must be a valid ldap server!
        if ($ds){
                if ($dn != ''){
+                       if ($passwd == '')
+                               $passwd = 'not_exist';
                        $r = @ldap_bind($ds,$dn,$passwd);
                        if ($r)
                                $msg = '<font color=blue><b>YES It is that</b></font>';