* Add limit of results returned in accounting.php3
* Fix a bug in time2strclock() in lib/functions.php3. Seconds ammount more than 9 would not show.
Bug noted by Timophey <bcloud@mail.ru>
-* Reaarange a few things in user_admin. Put Subscription Analysis and 'Account Status' second. Make a
+* 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).
Ver 1.29:
* Add general_ld_library_path directive and set LD_LIBRARY_PATH accordingly (used in snmpfinger and
radaclient).
invalid-user, outside of allowed login time and multiple-login cases to the radacct table with
acctstarttime=acctstoptime, acctsessiontime=0 and acctterminatecause containing the reason.
If the failing module sent back a module message then it will also appear in the terminate cause.
+ You will need to setup the $mysql and $tmpfile variables to suite your mysql installation and needs.
+ Perl module Date::Manip is needed by the script.
* bin/clean_radacct: It will delete all entries in the radacct table with a starttime > 1 day and
stoptime = 0. It will not do an harm even if it deletes valid entries since radiusd will fall
back to insert if update fails.
#!/usr/bin/perl
-use DBI;
use Date::Manip qw(ParseDate UnixDate);
$|=1;
$file=shift||'none';
$conf=shift||'/src/cvs/radiusd/dialup_admin/conf/admin.conf';
$domain='company.com';
+$mysql='/usr/local/mysql/bin/mysql';
+$tmpfile='/tmp/mysql.input';
open CONF, "<$conf"
or die "Could not open configuration file\n";
$sql_accounting_table = $val if ($key eq 'sql_accounting_table');
}
close CONF;
+$pass = ($sql_password ne '') ? "-p$sql_password" : '';
-$dbh = DBI->connect("DBI:mysql:$sql_database:$sql_server","$sql_username","$sql_password")
- or die "Could not connect to SQL database: $DBI::errtstr\n";
open LOG, "<$file"
or die "Could not open file $file\n";
seek LOG, 0, 2;
$addr = gethostbyname $nas;
($a,$b,$c,$d)=unpack('C4',$addr);
$addr = "$a.$b.$c.$d";
-$dbh->do("INSERT INTO $sql_accounting_table (UserName,NASIPAddress,NASPortId,AcctStartTime,AcctStopTime,AcctSessionTime,AcctInputOctets,AcctOutputOctets,CallingStationId,AcctTerminateCause) VALUES ('$user','$addr','$port','$time','$time','0','0','0','$caller','$cause');");
+ open TMP, ">$tmpfile"
+ or die "Could not open temporary file\n";
+ print TMP "INSERT INTO $sql_accounting_table (UserName,NASIPAddress,NASPortId,AcctStartTime,AcctStopTime,AcctSessionTime,AcctInputOctets,AcctOutputOctets,CallingStationId,AcctTerminateCause) VALUES ('$user','$addr','$port','$time','$time','0','0','0','$caller','$cause');";
+ close TMP;
+ `$mysql -h$sql_server -u$sql_username $pass $sql_database <$tmpfile`;
}
}
}
sleep 2;
seek LOG,0,1;
}
-$dbh->disconnect();