Create an AcctUniqueId before adding a row in radacct in log_badlogins.
authorkkalev <kkalev>
Sat, 19 Apr 2003 16:26:10 +0000 (16:26 +0000)
committerkkalev <kkalev>
Sat, 19 Apr 2003 16:26:10 +0000 (16:26 +0000)
dialup_admin/Changelog
dialup_admin/bin/log_badlogins

index 78d5435..44a4eaf 100644 (file)
@@ -20,6 +20,7 @@ Ver 1.63:
 * Add a <?php tag instead of a <?. Bug noted by Isam Ishaq <isam@planet.edu>
 * 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
index 3f69158..092c56a 100755 (executable)
@@ -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;