From 6ef22c1500345b76e40b17bb71e09a1c341aef46 Mon Sep 17 00:00:00 2001 From: kkalev Date: Tue, 11 Jun 2002 17:09:56 +0000 Subject: [PATCH] * 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 --- Changelog | 8 +++-- htdocs/user_admin.php3 | 60 +++++++++++++++++++++--------------- htdocs/user_finger.php3 | 2 +- lib/add_badusers.php3 | 3 +- lib/ldap/password_check.php3 | 2 ++ 5 files changed, 46 insertions(+), 29 deletions(-) diff --git a/Changelog b/Changelog index 7275a73..6598c63 100644 --- a/Changelog +++ b/Changelog @@ -4,8 +4,12 @@ Ver 1.30: Bug noted by Timophey * 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). diff --git a/htdocs/user_admin.php3 b/htdocs/user_admin.php3 index e84b641..b9c7492 100644 --- a/htdocs/user_admin.php3 +++ b/htdocs/user_admin.php3 @@ -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] = "" . time2str($used[$i]) . ""; 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 = "$daily_used"; } } @@ -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 = "$weekly_used"; } $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 =<<$server_name[$j]
$server_model[$j]$server_loggedin[$j] users connected$server_rem[$j] free lines -
+
diff --git a/lib/add_badusers.php3 b/lib/add_badusers.php3 index 7ed0574..2235772 100644 --- a/lib/add_badusers.php3 +++ b/lib/add_badusers.php3 @@ -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 "Lock Message should not be empty
\n"; else{ diff --git a/lib/ldap/password_check.php3 b/lib/ldap/password_check.php3 index 41dcb9d..6893d82 100644 --- a/lib/ldap/password_check.php3 +++ b/lib/ldap/password_check.php3 @@ -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 = 'YES It is that'; -- 2.39.5
#userip addresscaller idnameduration