From: arjen Date: Mon, 1 Sep 2003 06:57:14 +0000 (+0000) Subject: Reject log entries that are found to be invalid. X-Git-Tag: V0_0_8~14 X-Git-Url: http://www.andromeda.nl/gitweb/?p=gnucomo.git;a=commitdiff_plain;h=a93f2024c989d5033f4db96722afc7c764ee4154 Reject log entries that are found to be invalid. --- diff --git a/src/gcm_input/message.cpp b/src/gcm_input/message.cpp index 93560a3..596aba5 100644 --- a/src/gcm_input/message.cpp +++ b/src/gcm_input/message.cpp @@ -8,7 +8,7 @@ *********************** ** FILE NAME : message.cpp ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring -** VERSION NUMBER : $Revision: 1.13 $ +** VERSION NUMBER : $Revision: 1.14 $ ** ** DESCRIPTION : Implementation of the message handling classes ** @@ -26,7 +26,10 @@ /***************************** $Log: message.cpp,v $ - Revision 1.13 2003-08-16 15:28:45 arjen + Revision 1.14 2003-09-01 06:57:14 arjen + Reject log entries that are found to be invalid. + + Revision 1.13 2003/08/16 15:28:45 arjen Fixed a namespace problem Revision 1.12 2003/08/11 16:56:16 arjen @@ -83,7 +86,7 @@ *****************************/ -static const char *RCSID = "$Id: message.cpp,v 1.13 2003-08-16 15:28:45 arjen Exp $"; +static const char *RCSID = "$Id: message.cpp,v 1.14 2003-09-01 06:57:14 arjen Exp $"; #include #include @@ -440,7 +443,7 @@ double client_message::classify(String host, UTC arriv, String serv) } else if (!arrival.proper()) { - *log << "Arrival time is not knwon.\n"; + *log << "Arrival time is not known.\n"; certainty = 0.0; } else @@ -786,45 +789,50 @@ int client_message::enter() #ifdef DEBUG std::cerr << "\ncooker check: " << pan->check_pattern(line) << "\n"; #endif - pan->cook_this(line, arrival); - - if (pan->hostname() == hostname(0,~pan->hostname())) + if (pan->cook_this(line, arrival)) { + if (pan->hostname() == hostname(0,~pan->hostname())) + { #ifdef DEBUG - std::cerr << " Information from cooker:\n"; - std::cerr << " timestamp = " << pan->timestamp() << "\n"; - std::cerr << " hostname = " << pan->hostname() << "\n"; - std::cerr << " service = " << pan->service() << "\n"; + std::cerr << " Information from cooker:\n"; + std::cerr << " timestamp = " << pan->timestamp() << "\n"; + std::cerr << " hostname = " << pan->hostname() << "\n"; + std::cerr << " service = " << pan->service() << "\n"; #endif - /* Insert a new record into the log table */ + /* Insert a new record into the log table */ - insertion += "'" + objectid + "',"; - insertion += "'" + pan->service() + "',"; - insertion += "'" + pan->timestamp().format("%Y-%m-%d %T") + "',"; - insertion += "'" + arrival.format("%Y-%m-%d %T") + "',"; - insertion += "'" + SQL_Escape(line) + "',FALSE"; - insertion += ")"; + insertion += "'" + objectid + "',"; + insertion += "'" + pan->service() + "',"; + insertion += "'" + pan->timestamp().format("%Y-%m-%d %T") + "',"; + insertion += "'" + arrival.format("%Y-%m-%d %T") + "',"; + insertion += "'" + SQL_Escape(line) + "',FALSE"; + insertion += ")"; - if (testmode) - { - *log << insertion << "\n"; + if (testmode) + { + *log << insertion << "\n"; + } + else + { + database.Query(insertion); + } + + if (verbose) + { + *log << "\n\n"; + } + + nr_lines++; } else { - database.Query(insertion); + *log << " Hostname " << pan->hostname() << " does not match.\n"; } - - if (verbose) - { - *log << "\n\n"; - } - - nr_lines++; } else { - *log << " Hostname " << pan->hostname() << " does not match.\n"; + *log << "gcm_input WARNING: Not a valid line: " << line << "\n"; } break;