From: kkalev Date: Sat, 19 Apr 2003 16:26:10 +0000 (+0000) Subject: Create an AcctUniqueId before adding a row in radacct in log_badlogins. X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=0a0469179fc237aeca1def90610b404a8e174b6b;p=freeradius-dialup-admin.git Create an AcctUniqueId before adding a row in radacct in log_badlogins. --- diff --git a/Changelog b/Changelog index 78d5435..44a4eaf 100644 --- a/Changelog +++ b/Changelog @@ -20,6 +20,7 @@ Ver 1.63: * Add a * Add support for regexp and like operators in accounting report generator * Limit the split() to 2 elements in lib/defaults.php3 +* Create a AcctUniqueId before adding a row in radacct in log_badlogins. Ver 1.62: * Remove one sql query from user_admin which was not needed. * Instead of a query like "LIKE 'YYYY-MM-DD%'" use "AcctStopTime >= 'YYYY-MM-DD 00:00:00 AND AcctStopTime diff --git a/bin/log_badlogins b/bin/log_badlogins index 3f69158..092c56a 100755 --- a/bin/log_badlogins +++ b/bin/log_badlogins @@ -13,6 +13,7 @@ # all: no. Go to the end of the file. Don't read it all. use Date::Manip qw(ParseDate UnixDate); +use Digest::MD5; $|=1; $file=shift||'none'; @@ -124,7 +125,14 @@ for(;;){ unlink "$tmpfile.$server" if ($delete{$server}); open TMP, ">>$tmpfile.$server" 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');"; + $ctx = Digest::MD5->new; + $ctx->add($user); + $ctx->add($addr); + $ctx->add($port); + $ctx->add($time); + $ctx->add('badlogin'); + $uniqueid = $ctx->hexdigest; + print TMP "INSERT INTO $sql_accounting_table (UserName,AcctUniqueId,NASIPAddress,NASPortId,AcctStartTime,AcctStopTime,AcctSessionTime,AcctInputOctets,AcctOutputOctets,CallingStationId,AcctTerminateCause) VALUES ('$user','$uniqueid','$addr','$port','$time','$time','0','0','0','$caller','$cause');"; close TMP; `$mysql -h$server $opt -u$sql_username $pass $sql_database <$tmpfile.$server`; $exit = $? >> 8;