]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
tweaked parse errors/warnings and FIXIT-T
authorRuss Combs <rucombs@cisco.com>
Mon, 6 Oct 2014 23:06:32 +0000 (19:06 -0400)
committerRuss Combs <rucombs@cisco.com>
Mon, 6 Oct 2014 23:06:32 +0000 (19:06 -0400)
ChangeLog
src/main.cc
src/parser/parser.cc
src/parser/parser.h
src/service_inspectors/nhttp_inspect/nhttp_test_input.cc
src/stream/tcp/tcp_module.cc

index 44717235a9cfdb299f3a4ba51fb271c2fb71e720..74cd7f6a4782667994af12be804b10116441d9d1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@
 -- tweaked stats output - no section if all counts zero
 -- fixed pause/resume
 -- comment out assert that doesn't apply to alert_sf_socket
+-- split parse warning count out of error count
+-- added workaround and FIXIT-T for nhttp test
 
 122
 -- pulled thread pinning from Josh
index 292d9730062bfaa98eb99a10491a3b98796051c7..dc00a9dd3299fdb0b0062810454b928f87118ce3 100644 (file)
@@ -646,6 +646,15 @@ static bool set_mode()
         FatalError("see prior %d errors\n", k);
         return false;
     }
+    if ( ScConfErrorOut() )
+    {
+        if ( int k = get_parse_warnings() )
+        {
+            FatalError("see prior %d warnings\n", k);
+            return false;
+        }
+    }
+
     if ( ScTestMode() ||
         (!Trough_GetQCount() && !(snort_conf->run_flags & RUN_FLAG__SHELL)) )
     {
index c0854161d8c3a6f6a7673296f6dcc8d7c33aa791..2f51dcd63406a5fc2e5aa0c6187b543aa9dfe84e 100644 (file)
@@ -84,6 +84,7 @@
 #include "target_based/sftarget_reader.h"
 
 static unsigned parse_errors = 0;
+static unsigned parse_warnings = 0;
 
 rule_index_map_t *ruleIndexMap = NULL;   /* rule index -> sid:gid map */
 
@@ -102,6 +103,13 @@ unsigned get_parse_errors()
     return tmp;
 }
 
+unsigned get_parse_warnings()
+{
+    unsigned tmp = parse_warnings;
+    parse_warnings = 0;
+    return tmp;
+}
+
 //-------------------------------------------------------------------------
 // private / implementation methods
 //-------------------------------------------------------------------------
@@ -1138,8 +1146,7 @@ void ParseWarning(const char *format, ...)
     else
         LogMessage("WARNING: %s\n", buf);
 
-    if ( ScConfErrorOut() )
-        parse_errors++;
+    parse_warnings++;
 }
 
 void ParseMessage(const char *format, ...)
index 507a008e83d05427cac0fb04e8bcfa22f95597f3..e50d18015db9d18f4fced7d6a662a601bb009fec 100644 (file)
 #include "detection/sfrim.h"
 
 unsigned get_parse_errors();
+unsigned get_parse_warnings();
+
 const char* get_parse_file();
 void get_parse_location(const char*& name, unsigned& line);
 void push_parse_location(const char* name, unsigned line = 1);
+
 void pop_parse_location();
 void inc_parse_position();
 
index 116859346bb3fb9e75312695eae868fa7b075504..6ff63b571b05c1683201a25d16b4a9077980d29c 100644 (file)
@@ -39,6 +39,8 @@
 using namespace NHttpEnums;
 
 NHttpTestInput::NHttpTestInput(const char *file_name) {
+    if ( !NHttpTestManager::use_test_input() )  // FIXIT-T workaround
+        return;
     if ((test_data_file = fopen(file_name, "r")) == nullptr) throw std::runtime_error("Cannot open test input file");
 }
 
index 1b6d8267ae22e04373c4796f535a0c5b796c7ca2..b41474e5f4d7ffb046ffce569285b95dc31d79e4 100644 (file)
@@ -140,7 +140,7 @@ static const Parameter s_params[] =
     { "session_timeout", Parameter::PT_INT, "1:86400", "30",
       "session tracking timeout" },
 
-    { "footprint", Parameter::PT_INT, "0:", "false",
+    { "footprint", Parameter::PT_INT, "0:", "0",
       "use zero for production, non-zero for testing at given size" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }