From 5f5e3f2d46b1ca70138deb28816def74c5c696c4 Mon Sep 17 00:00:00 2001 From: arjen Date: Thu, 24 Mar 2011 09:46:36 +0000 Subject: [PATCH] Resolve a hostname before adding to the abuses. --- src/gcm_daemon/gcm_daemon.php | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/src/gcm_daemon/gcm_daemon.php b/src/gcm_daemon/gcm_daemon.php index f36143c..d4292e1 100755 --- a/src/gcm_daemon/gcm_daemon.php +++ b/src/gcm_daemon/gcm_daemon.php @@ -20,7 +20,10 @@ Gnucomo-0.0.8: September 4th 2003 $Log: gcm_daemon.php,v $ - Revision 1.25 2007-12-12 09:06:21 arjen + Revision 1.26 2011-03-24 09:46:36 arjen + Resolve a hostname before adding to the abuses. + + Revision 1.25 2007/12/12 09:06:21 arjen Added a new script gcm_maintenance.php to cleanup the database and check referential integrity. Purging old log entries is removed from the gcm_daemon script. @@ -89,12 +92,12 @@ */ -// $Id: gcm_daemon.php,v 1.25 2007-12-12 09:06:21 arjen Exp $ +// $Id: gcm_daemon.php,v 1.26 2011-03-24 09:46:36 arjen Exp $ ini_set('include_path', '.:./classes:../phpclasses'); ini_set('html_errors', 'false'); -define("BATCHSIZE", 10000); +define("BATCHSIZE", 50000); //Tell the log that we're up. define_syslog_variables(); @@ -225,7 +228,6 @@ do echo "Processing logs...\n"; process_log (); service_check(); - find_notifications(); //mail_notifications(); // Gather the statistics for each object @@ -487,7 +489,7 @@ function match_log_patterns($logstart) if (record_abuse($logentry->logid, $logentry->objectid, $srv_pat->argument, 1) >= 32) { - $source_ip = $srv_pat->argument; + $source_ip = gethostbyname($srv_pat->argument); $notif = 'abuses exceeded'; if (!isset($notifications[$logentry->objectid][$notif][$source_ip])) { @@ -693,30 +695,6 @@ function service_check() $dbms->query($qry); } -function find_notifications () -{ - -/* - * Do something with notification checks. - * - * INPUT : NONE - * OUTPUT : NONE - */ - - global $dbms; - - // Find checks that have to be executed. - $local_sql = "select * from notification_check where - age(last_execution) > time_between_executions"; - $dbms->query($local_sql); - - for ($i=0; $i<$dbms->num_rows(); $i++) - { - // A check has been found that has to be executed - $dbms->fetch_row(); - } -} - /* * find open notifications and send an email to the object's users. */ -- 2.11.0