From: Russ Combs (rucombs) Date: Fri, 11 Dec 2015 16:54:33 +0000 (-0500) Subject: Merge pull request #189 in SNORT/snort3 from Oops_should_have_used_ParseWarning_not_L... X-Git-Tag: 3.0.0-233~678 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22809b7ae220ecb9c2ffa9d91586ad32fe1adbe5;p=thirdparty%2Fsnort3.git Merge pull request #189 in SNORT/snort3 from Oops_should_have_used_ParseWarning_not_LogMessage to master Squashed commit of the following: commit 1ddf9c26f265f96083835f459786ec8b4b5385a1 Author: Victor Roemer Date: Fri Dec 11 11:52:29 2015 -0500 WARN_CONF instead of WARN_PLUGINS commit 6389a2d30695082d0a80d6e7170addd0c2443a31 Author: Victor Roemer Date: Fri Dec 11 11:39:52 2015 -0500 WARN_CONF instead of WARN_PLUGINS commit dac35f30fab8c4578c32a31165600160a2f87709 Author: Victor Roemer Date: Thu Dec 10 16:41:34 2015 -0500 Call ParseWarning() instead of LogMessage(). --- diff --git a/src/log/messages.cc b/src/log/messages.cc index 0b56ae4e7..7c2b43d0a 100644 --- a/src/log/messages.cc +++ b/src/log/messages.cc @@ -88,7 +88,8 @@ void ParseMessage(const char* format, ...) unsigned file_line; get_parse_location(file_name, file_line); - if (file_name != NULL) + // FIXIT-L Plz how can same format filename/linenum as ParseWarning + if (file_name != NULL) LogMessage("%s(%d) %s\n", file_name, file_line, buf); else LogMessage("%s\n", buf); @@ -112,6 +113,7 @@ void ParseWarning(WarningGroup wg, const char* format, ...) unsigned file_line; get_parse_location(file_name, file_line); + // FIXIT-L Why `file_line` here and `file_name` in ParseMessage? if ( file_line ) LogMessage("WARNING: %s:%d %s\n", file_name, file_line, buf); else @@ -158,6 +160,7 @@ NORETURN void ParseAbort(const char* format, ...) unsigned file_line; get_parse_location(file_name, file_line); + // FIXIT-L Refer to ParseMessage above. if (file_name != NULL) FatalError("%s(%d) %s\n", file_name, file_line, buf); else diff --git a/src/network_inspectors/reputation/reputation_module.cc b/src/network_inspectors/reputation/reputation_module.cc index 73625ea4f..5c9ff991d 100644 --- a/src/network_inspectors/reputation/reputation_module.cc +++ b/src/network_inspectors/reputation/reputation_module.cc @@ -147,7 +147,7 @@ bool ReputationModule::end(const char*, int, SnortConfig*) EstimateNumEntries(conf); if (conf->numEntries <= 0) { - LogMessage("WARNING: Can't find any whitelist/blacklist entries. " + ParseWarning(WARN_CONF, "Can't find any whitelist/blacklist entries. " "Reputation Preprocessor disabled.\n"); return true; } @@ -156,9 +156,9 @@ bool ReputationModule::end(const char*, int, SnortConfig*) if ( (conf->priority == WHITELISTED_TRUST) && (conf->whiteAction == UNBLACK) ) { - LogMessage("WARNING: Keyword \"whitelist\" for \"priority\" is not applied " - "when white action is unblack.\n"); - conf->priority = WHITELISTED_UNBLACK; + ParseWarning(WARN_CONF, "Keyword \"whitelist\" for \"priority\" is " + "not applied when white action is unblack.\n"); + conf->priority = WHITELISTED_UNBLACK; } LoadListFile(conf->blacklist_path, conf->local_black_ptr, conf); diff --git a/src/service_inspectors/imap/imap_module.cc b/src/service_inspectors/imap/imap_module.cc index 6f2f41f59..330e4beb9 100644 --- a/src/service_inspectors/imap/imap_module.cc +++ b/src/service_inspectors/imap/imap_module.cc @@ -99,7 +99,7 @@ bool ImapModule::set(const char*, Value& v, SnortConfig*) { decode_depth = decode_depth - 4; // FIXIT-L what does this do? } - LogMessage("WARNING: IMAP: 'b64_decode_depth' is not a multiple of 4. " + ParseWarning(WARN_CONF, "IMAP: 'b64_decode_depth' is not a multiple of 4. " "Rounding up to the next multiple of 4. The new 'b64_decode_depth' is %d.\n", decode_depth); } diff --git a/src/service_inspectors/pop/pop_module.cc b/src/service_inspectors/pop/pop_module.cc index cea594cc3..ada0ed5a4 100644 --- a/src/service_inspectors/pop/pop_module.cc +++ b/src/service_inspectors/pop/pop_module.cc @@ -99,8 +99,10 @@ bool PopModule::set(const char*, Value& v, SnortConfig*) { decode_depth = decode_depth - 4; } - LogMessage("WARNING: POP: 'b64_decode_depth' is not a multiple of 4. " - "Rounding up to the next multiple of 4. The new 'b64_decode_depth' is %d.\n", + ParseWarning(WARN_CONF, + "POP: 'b64_decode_depth' is not a multiple of 4. " + "Rounding up to the next multiple of 4. " + "The new 'b64_decode_depth' is %d.\n", decode_depth); } config->decode_conf.set_b64_depth(decode_depth); diff --git a/src/service_inspectors/smtp/smtp_module.cc b/src/service_inspectors/smtp/smtp_module.cc index fb2bdcd0b..8b9af2f8a 100644 --- a/src/service_inspectors/smtp/smtp_module.cc +++ b/src/service_inspectors/smtp/smtp_module.cc @@ -238,7 +238,7 @@ bool SmtpModule::set(const char*, Value& v, SnortConfig*) { decode_depth = decode_depth - 4; } - LogMessage("WARNING: SMTP: 'b64_decode_depth' is not a multiple of 4. " + ParseWarning(WARN_CONF, "SMTP: 'b64_decode_depth' is not a multiple of 4. " "Rounding up to the next multiple of 4. The new 'b64_decode_depth' is %d.\n", decode_depth); }