From: Russ Combs Date: Mon, 6 Oct 2014 23:06:32 +0000 (-0400) Subject: tweaked parse errors/warnings and FIXIT-T X-Git-Tag: 3.0.0-233~1383^2~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=46d115369527bbce04b0e06475cabb55161ccd2a;p=thirdparty%2Fsnort3.git tweaked parse errors/warnings and FIXIT-T --- diff --git a/ChangeLog b/ChangeLog index 44717235a..74cd7f6a4 100644 --- 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 diff --git a/src/main.cc b/src/main.cc index 292d97300..dc00a9dd3 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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)) ) { diff --git a/src/parser/parser.cc b/src/parser/parser.cc index c0854161d..2f51dcd63 100644 --- a/src/parser/parser.cc +++ b/src/parser/parser.cc @@ -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, ...) diff --git a/src/parser/parser.h b/src/parser/parser.h index 507a008e8..e50d18015 100644 --- a/src/parser/parser.h +++ b/src/parser/parser.h @@ -38,9 +38,12 @@ #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(); diff --git a/src/service_inspectors/nhttp_inspect/nhttp_test_input.cc b/src/service_inspectors/nhttp_inspect/nhttp_test_input.cc index 116859346..6ff63b571 100644 --- a/src/service_inspectors/nhttp_inspect/nhttp_test_input.cc +++ b/src/service_inspectors/nhttp_inspect/nhttp_test_input.cc @@ -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"); } diff --git a/src/stream/tcp/tcp_module.cc b/src/stream/tcp/tcp_module.cc index 1b6d8267a..b41474e5f 100644 --- a/src/stream/tcp/tcp_module.cc +++ b/src/stream/tcp/tcp_module.cc @@ -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 }