]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #366 in SNORT/snort3 from crc/nfa_etc to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Thu, 24 Mar 2016 17:58:47 +0000 (13:58 -0400)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Thu, 24 Mar 2016 17:58:47 +0000 (13:58 -0400)
Squashed commit of the following:

commit 9866576bab1cfb5f99c643aa3dd427738147f98a
Author: Russ Combs <rucombs@cisco.com>
Date:   Thu Mar 24 11:16:30 2016 -0400

    activate nfa searches

commit decb72f9d5fcb94948595d5a6f7dd7a812844daf
Author: Russ Combs <rucombs@cisco.com>
Date:   Thu Mar 24 06:48:38 2016 -0400

    remove cruft

commit 5ff93224fbc428dfcb254c45a9dad9301f30c1d5
Author: Russ Combs <rucombs@cisco.com>
Date:   Wed Mar 23 14:06:34 2016 -0400

    remove extraneous newlines

20 files changed:
src/detection/fp_create.cc
src/ips_options/ips_isdataat.cc
src/ips_options/sd_pattern_match.cc
src/loggers/alert_sf_socket.cc
src/managers/codec_manager.cc
src/managers/event_manager.cc
src/network_inspectors/binder/bind_module.cc
src/parser/vars.cc
src/search_engines/ac_banded.cc
src/search_engines/ac_full.cc
src/search_engines/ac_sparse.cc
src/search_engines/ac_sparse_bands.cc
src/search_engines/acsmx2.cc
src/search_engines/acsmx2.h
src/service_inspectors/sip/ips_sip_method.cc
src/service_inspectors/sip/ips_sip_stat_code.cc
src/service_inspectors/sip/sip_config.cc
src/stream/base/stream_base.cc
src/stream/stream.h
src/utils/util.cc

index 3635e64d6a7ece2455a2dc8b2cd43286ef2c98a7..21f906363131bec13aec9efa94116a23a8c74df0 100644 (file)
@@ -594,7 +594,7 @@ static int fpFinishPortGroupRule(
 
             if ( !pg->mpse[pmd->pm_type] )
             {
-                ParseError("Failed to create pattern matcher for %d\n", pmd->pm_type);
+                ParseError("Failed to create pattern matcher for %d", pmd->pm_type);
                 return -1;
             }
             mpse_count++;
@@ -1493,7 +1493,7 @@ static void fpBuildServicePortGroups(
 
         if ( !pg )
         {
-            ParseError("*** failed to create and find a port group for '%s'\n",srvc);
+            ParseError("*** failed to create and find a port group for '%s'",srvc);
             continue;
         }
         int16_t id = FindProtocolReference(srvc);
index e03622e075a165dd8718ac230c9de23a288842ef..5e35028df6043f9da1d8f4312f98c0d4104c2858 100644 (file)
@@ -213,7 +213,7 @@ static void isdataat_parse(const char* data, IsDataAtData* idx)
 
         if (offset == endp)
         {
-            ParseError("unable to parse as byte value %s\n", toks[0]);
+            ParseError("unable to parse as byte value %s", toks[0]);
             return;
         }
 
index 17f6fef51866bab82be7b6798aca98f258e76232..934eb05b509196ef4b793d5d2783746424137b26 100644 (file)
@@ -101,7 +101,7 @@ static void ExpandBrackets(char **pii)
     // Brackets at the beginning have nothing to modify.
     if (bracket_index == *pii)
     {
-        ParseError("sd_pattern \"%s\" starts with curly brackets which have nothing to modify.\n", *pii);
+        ParseError("sd_pattern \"%s\" starts with curly brackets which have nothing to modify.", *pii);
     }
 
     // Check for various error cases. Total up the # of bytes needed in new pattern
@@ -120,18 +120,18 @@ static void ExpandBrackets(char **pii)
             (*(bracket_index-1) == '}') &&
             (*(bracket_index-2) != '\\') )
         {
-            ParseError("sd_pattern \"%s\" contains curly brackets which have nothing to modify.\n", *pii);
+            ParseError("sd_pattern \"%s\" contains curly brackets which have nothing to modify.", *pii);
         }
 
         // Get the number from inside the brackets
         repetitions = strtoul(bracket_index+1, &endptr, 10);
         if (*endptr != '}' && *endptr != '\0')
         {
-            ParseError("sd_pattern \"%s\" contains curly brackets with non-digits inside.\n", *pii);
+            ParseError("sd_pattern \"%s\" contains curly brackets with non-digits inside.", *pii);
         }
         else if (*endptr == '\0')
         {
-            ParseError("sd_pattern \"%s\" contains an unterminated curly bracket.\n", *pii);
+            ParseError("sd_pattern \"%s\" contains an unterminated curly bracket.", *pii);
         }
 
         // The brackets look OK. Increase the rep count.
index 06966e2d46d81eb84a281ea3d75963a0c55d02ac..bf3de09d4b8a02d77d99553e4d33e01259bc6398 100644 (file)
@@ -356,7 +356,7 @@ void SfSocketLogger::configure(RuleId& r)
     OptTreeNode* otn = OptTreeNode_Search(r.gid, r.sid);
 
     if ( !otn )
-        ParseError("Unable to find OptTreeNode for %u:%u\n", r.gid, r.sid);
+        ParseError("Unable to find OptTreeNode for %u:%u", r.gid, r.sid);
 
     else
         EventManager::add_output(&otn->outputFuncs, this);
index 364e21e6d211418eb34a52c87c87861ac0a21e3d..f88660fcb04cf12bb95630a65ea1e015854c79f9 100644 (file)
@@ -101,11 +101,10 @@ CodecManager::CodecApiWrapper& CodecManager::get_api_wrapper(const CodecApi* cd_
 void CodecManager::add_plugin(const CodecApi* api)
 {
     if (!api->ctor)
-        ParseError("CodecApi ctor() for Codec %s: ctor() must be implemented\n",
-            api->base.name);
+        ParseError("CodecApi ctor() for Codec %s: ctor() must be implemented", api->base.name);
+
     if (!api->dtor)
-        ParseError("CodecApi ctor() for Codec %s: ctor() must be implemented\n",
-            api->base.name);
+        ParseError("CodecApi ctor() for Codec %s: ctor() must be implemented", api->base.name);
 
     CodecApiWrapper wrap;
     wrap.api = api;
@@ -156,7 +155,7 @@ void CodecManager::instantiate(CodecApiWrapper& wrap, Module* m, SnortConfig*)
         const CodecApi* const cd_api = wrap.api;
 
         if (codec_id >= s_protocols.size())
-            ParseError("A maximum of 256 codecs can be registered\n");
+            ParseError("A maximum of 256 codecs can be registered");
 
         if (cd_api->pinit)
             cd_api->pinit();
@@ -235,7 +234,7 @@ void CodecManager::thread_init(SnortConfig* sc)
     }
 
     if (!grinder)
-        ParseError("Unable to find a Codec with data link type %d\n", daq_dlt);
+        ParseError("Unable to find a Codec with data link type %d", daq_dlt);
 
     if ( s_rand )
         rand_close(s_rand);
@@ -246,7 +245,7 @@ void CodecManager::thread_init(SnortConfig* sc)
     s_rand = rand_open();
 
     if ( !s_rand )
-        ParseError("rand_open() failed.\n");
+        ParseError("rand_open() failed.");
 
     rand_get(s_rand, s_id_pool.data(), s_id_pool.size());
 }
index 248c53966802466868a9fc4c1742e28f73759c3a..827bf4530b50edf7f7276e600e441b87b0a2bb7d 100644 (file)
@@ -199,7 +199,7 @@ void EventManager::instantiate(
 
     if ( !p )
     {
-        ParseError("unknown logger %s\n", name);
+        ParseError("unknown logger %s", name);
         return;
     }
 
index 43707c86acd09abfce950f630a15140835266fe7..0c9087bc4c241536f9d916e1fb507a99979833fa 100644 (file)
@@ -213,7 +213,7 @@ bool BinderModule::end(const char* fqn, int idx, SnortConfig* sc)
     {
         if ( !work )
         {
-            ParseError("invalid %s[%d]\n", fqn, idx);
+            ParseError("invalid %s[%d]", fqn, idx);
             return true;
         }
 
index a04a301254257a3452f1fbc8996e77f785d18a10..5467c0aa86035068619befa5b1642a7870003403 100644 (file)
@@ -101,7 +101,7 @@ void config_set_var(SnortConfig* sc, const char* val)
             {
                 if (strncasecmp(tmp->name, val, equal_ptr - val) == 0)
                 {
-                    ParseError("Duplicate variable name: %s.\n", tmp->name);
+                    ParseError("Duplicate variable name: %s.", tmp->name);
                     free(node);
                     return;
                 }
index 74e568737d9e8251414a866db439e2c8d9467db2..2dcde3cd8f5e252b696c1d933c5fdb1cab31fd52 100644 (file)
@@ -48,7 +48,7 @@ public:
     { acsmFree2(obj); }
 
     void set_opt(int) override
-    { acsm_enable_dfa(obj); }
+    { obj->enable_dfa(); }
 
     int add_pattern(
         SnortConfig*, const uint8_t* P, unsigned m,
@@ -64,7 +64,15 @@ public:
         const uint8_t* T, int n, MpseMatch match,
         void* context, int* current_state) override
     {
-        return acsmSearchSparseDFA_Banded(obj, T, n, match, context, current_state);
+#if 1
+        return acsm_search_dfa_banded(obj, T, n, match, context, current_state);
+#else
+        if ( obj->dfa_enabled() )
+            return acsm_search_dfa_banded(obj, T, n, match, context, current_state);
+
+        // FIXIT-L banded will crash in get_next_state_nfa()
+        return acsm_search_nfa(obj, T, n, match, context, current_state);
+#endif
     }
 
     int print_info() override
index b94ee476a4c50b56da1233d203969ffaab56a013..1726c297080449a9ce4634aa405afa586bb56297 100644 (file)
@@ -49,7 +49,7 @@ public:
     void set_opt(int flag) override
     {
         acsmCompressStates(obj, flag);
-        acsm_enable_dfa(obj);
+        obj->enable_dfa();
     }
 
     int add_pattern(
@@ -66,14 +66,20 @@ public:
         const uint8_t* T, int n, MpseMatch match,
         void* context, int* current_state) override
     {
-        return acsmSearchSparseDFA_Full(obj, T, n, match, context, current_state);
+        if ( obj->dfa_enabled() )
+            return acsm_search_dfa_full(obj, T, n, match, context, current_state);
+
+        return acsm_search_nfa(obj, T, n, match, context, current_state);
     }
 
     int search_all(
         const uint8_t* T, int n, MpseMatch match,
         void* context, int* current_state) override
     {
-        return acsmSearchSparseDFA_Full_All(obj, T, n, match, context, current_state);
+        if ( !obj->dfa_enabled() )
+            return 0;  // nfa + all not supported
+
+        return acsm_search_dfa_full_all(obj, T, n, match, context, current_state);
     }
 
     int print_info() override
index 25bdf68bf123744c1383253f98a249169ee095e7..41351b894d1e36e945c1ad890bc2652fec502b93 100644 (file)
@@ -47,7 +47,7 @@ public:
     { if (obj) acsmFree2(obj); }
 
     void set_opt(int) override
-    { acsm_enable_dfa(obj); }
+    { obj->enable_dfa(); }
 
     int add_pattern(
         SnortConfig*, const uint8_t* P, unsigned m,
@@ -63,7 +63,10 @@ public:
         const uint8_t* T, int n, MpseMatch match,
         void* context, int* current_state) override
     {
-        return acsmSearchSparseDFA(obj, T, n, match, context, current_state);
+        if ( obj->dfa_enabled() )
+            return acsm_search_dfa_sparse(obj, T, n, match, context, current_state);
+
+        return acsm_search_nfa(obj, T, n, match, context, current_state);
     }
 
     int print_info() override
index 035e14c9c4b4409ea9c3e124b55ffe509467afab..57417fc73d3c3c4ad4c2eb4136dd9aad23fb4854 100644 (file)
@@ -47,7 +47,7 @@ public:
     { acsmFree2(obj); }
 
     void set_opt(int) override
-    { acsm_enable_dfa(obj); }
+    { obj->enable_dfa(); }
 
     int add_pattern(
         SnortConfig*, const uint8_t* P, unsigned m,
@@ -63,7 +63,10 @@ public:
         const uint8_t* T, int n, MpseMatch match,
         void* context, int* current_state) override
     {
-        return acsmSearchSparseDFA(obj, T, n, match, context, current_state);
+        if ( obj->dfa_enabled() )
+            return acsm_search_dfa_sparse(obj, T, n, match, context, current_state);
+
+        return acsm_search_nfa(obj, T, n, match, context, current_state);
     }
 
     int print_info() override
index 4396028f1f12dfd50dfcd9dfef387790d2e15d85..7c58c23bf169d7aa138ce8012f4c7cd69ac727c9 100644 (file)
@@ -1096,9 +1096,6 @@ ACSM_STRUCT2* acsmNew2(const MpseAgent* agent, int format)
     return p;
 }
 
-void acsm_enable_dfa(ACSM_STRUCT2* acsm)
-{ acsm->dfa = true; }
-
 /*
 *   Add a pattern to the list of patterns for this state machine
 *
@@ -1358,7 +1355,7 @@ int acsmCompile2(
 /*
 *   Get the NextState from the NFA, all NFA storage formats use this
 */
-static inline acstate_t SparseGetNextStateNFA(acstate_t* ps, acstate_t state, unsigned input)
+static inline acstate_t get_next_state_nfa(acstate_t* ps, acstate_t state, unsigned input)
 {
     acstate_t fmt;
     acstate_t n;
@@ -1490,7 +1487,8 @@ static inline acstate_t SparseGetNextStateNFA(acstate_t* ps, acstate_t state, un
 /*
 *   Get the NextState from the DFA Next State Transition table
 *   Full and banded are supported separately, this is for
-*   sparse and sparse-bands
+*   sparse and sparse-bands.  But note that for optimization
+*   purposes, a given row may be full.
 */
 static inline acstate_t SparseGetNextStateDFA(
     acstate_t* ps, acstate_t, unsigned input)
@@ -1500,19 +1498,6 @@ static inline acstate_t SparseGetNextStateDFA(
 
     switch ( ps[0] )
     {
-    case  ACF_BANDED:
-    {
-        /* n=ps[2] : number of entries in the band
-           index=ps[3] : index of the 1st entry, sequential thereafter */
-
-        if ( input  <  ps[3]        )
-            return 0;
-        if ( input >= (unsigned)(ps[3]+ps[2]) )
-            return 0;
-
-        return ps[4+input-ps[3]];
-    }
-
     case ACF_FULL:
     {
         return ps[2+input];
@@ -1572,7 +1557,7 @@ static inline acstate_t SparseGetNextStateDFA(
 *
 *   Sparse & Sparse-Banded Matrix search
 */
-int acsmSearchSparseDFA(
+int acsm_search_dfa_sparse(
     ACSM_STRUCT2* acsm, const uint8_t* Tx, int n, MpseMatch match,
     void* context, int* current_state)
 {
@@ -1660,7 +1645,7 @@ void acsmx2_print_qinfo(void)
         state = ps[2u + sindex]; \
     }
 
-int acsmSearchSparseDFA_Full(
+int acsm_search_dfa_full(
     ACSM_STRUCT2* acsm, const uint8_t* Tx, int n, MpseMatch match,
     void* context, int* current_state
     )
@@ -1761,7 +1746,7 @@ int acsmSearchSparseDFA_Full(
         state = ps[2u + sindex]; \
     }
 
-int acsmSearchSparseDFA_Full_All(
+int acsm_search_dfa_full_all(
     ACSM_STRUCT2* acsm, const uint8_t* Tx, int n, MpseMatch match,
     void* context, int* current_state)
 {
@@ -1839,7 +1824,7 @@ int acsmSearchSparseDFA_Full_All(
 *   ps[2] = # elements in band
 *   ps[3] = index of 1st element
 */
-int acsmSearchSparseDFA_Banded(
+int acsm_search_dfa_banded(
     ACSM_STRUCT2* acsm, const uint8_t* Tx, int n, MpseMatch match,
     void* context, int* current_state)
 {
@@ -1911,12 +1896,9 @@ int acsmSearchSparseDFA_Banded(
     return nfound;
 }
 
-/*
-*   Search Text or Binary Data for Pattern matches
-*
-*   Sparse Storage Version
-*/
-int acsmSearchSparseNFA(
+// Search Text or Binary Data for Pattern matches
+
+int acsm_search_nfa(
     ACSM_STRUCT2* acsm, const uint8_t* Tx, int n, MpseMatch match,
     void* context, int* current_state)
 {
@@ -1947,7 +1929,7 @@ int acsmSearchSparseNFA(
 
         Tchar = xlatcase[ *T ];
 
-        while ( (nstate=SparseGetNextStateNFA(NextState[state],state,Tchar))==ACSM_FAIL_STATE2 )
+        while ( (nstate=get_next_state_nfa(NextState[state],state,Tchar))==ACSM_FAIL_STATE2 )
             state = FailState[state];
 
         state = nstate;
@@ -2293,33 +2275,23 @@ static int acsmSearch2(
     void* context, int* current_state)
 {
     if ( !acsm->dfa )
-        return acsmSearchSparseNFA(acsm, Tx, n, match, context, current_state);
+        return acsm_search_nfa(acsm, Tx, n, match, context, current_state);
 
     switch ( acsm->acsmFormat )
     {
     case ACF_FULL:
-        return acsmSearchSparseDFA_Full(acsm, Tx, n, match, context, current_state);
+        return acsm_search_dfa_full(acsm, Tx, n, match, context, current_state);
 
     case ACF_BANDED:
-        return acsmSearchSparseDFA_Banded(acsm, Tx, n, match, context, current_state);
+        return acsm_search_dfa_banded(acsm, Tx, n, match, context, current_state);
 
     case ACF_SPARSE:
     case ACF_SPARSE_BANDS:
-        return acsmSearchSparseDFA(acsm, Tx, n, match, context, current_state);
+        return acsm_search_dfa_sparse(acsm, Tx, n, match, context, current_state);
     }
     return 0;
 }
 
-static int acsmSearchAll2(
-    ACSM_STRUCT2* acsm, uint8_t* Tx, int n, MpseMatch match,
-    void* context, int* current_state)
-{
-    if ( acsm->acsmFormat == ACF_FULL )
-        return acsmSearchSparseDFA_Full_All(acsm, Tx, n, match, context, current_state);
-
-    return acsmSearch2(acsm, Tx, n, match, context, current_state);
-}
-
 /*
 *  Text Data Buffer
 */
index 70d0e8fff48705579a109817faf2192c9b2cc876..f95ae707242003b73633c0311e0e8c1c00285097 100644 (file)
@@ -125,6 +125,12 @@ struct ACSM_STRUCT2
     int compress_states;
 
     bool dfa;
+
+    void enable_dfa()
+    { dfa = true; }
+
+    bool dfa_enabled()
+    { return dfa; }
 };
 
 /*
@@ -140,25 +146,24 @@ int acsmAddPattern2(
 
 int acsmCompile2(struct SnortConfig*, ACSM_STRUCT2*);
 
-int acsmSearchSparseDFA_Full(
+int acsm_search_nfa(
     ACSM_STRUCT2*, const uint8_t* T, int n, MpseMatch, void* context, int* current_state);
 
-int acsmSearchSparseDFA_Banded(
+int acsm_search_dfa_sparse(
     ACSM_STRUCT2*, const uint8_t* T, int n, MpseMatch, void* context, int* current_state);
 
-int acsmSearchSparseDFA(
+int acsm_search_dfa_banded(
     ACSM_STRUCT2*, const uint8_t* T, int n, MpseMatch, void* context, int* current_state);
 
-int acsmSearchSparseNFA(
+int acsm_search_dfa_full(
     ACSM_STRUCT2*, const uint8_t* T, int n, MpseMatch, void* context, int* current_state);
 
-int acsmSearchSparseDFA_Full_All(
+int acsm_search_dfa_full_all(
     ACSM_STRUCT2*, const uint8_t* Tx, int n, MpseMatch, void* context, int* current_state);
 
 void acsmFree2(ACSM_STRUCT2*);
 int acsmPatternCount2(ACSM_STRUCT2*);
 void acsmCompressStates(ACSM_STRUCT2*, int);
-void acsm_enable_dfa(ACSM_STRUCT2*);
 
 void acsmPrintInfo2(ACSM_STRUCT2* p);
 
index b6428fe3deb092ddcb1c35b92fa54af635e761f0..05a7d8547d36453617341510439747ef3760a0d2 100644 (file)
@@ -175,13 +175,13 @@ bool SipMethodModule::set(const char*, Value& v, SnortConfig*)
 
         /*Only one method is allowed with !*/
         if (negated && (++num_tokens > 1))
-            ParseError("Only one method is allowed with ! for sip_method\n");
+            ParseError("Only one method is allowed with ! for sip_method");
 
         method = add_sip_method(tok);
 
         if(!method)
         {
-            ParseError("Failed to add a new method to sip_method\n");
+            ParseError("Failed to add a new method to sip_method");
             return false;
         }
 
index c425c526ff47aad3518b334b3ae2f64ff4aa8bc1..e370c192d369ef6cee13ad7a5b27e51d530ce778 100644 (file)
@@ -167,7 +167,7 @@ bool SipStatCodeModule::set(const char*, Value& v, SnortConfig*)
             if ((statCode > MAX_STAT_CODE) || ((statCode > NUM_OF_RESPONSE_TYPES - 1) &&
                 (statCode < MIN_STAT_CODE)))
             {
-                ParseError("Status code specified is not a 3 digit number or 1\n");
+                ParseError("Status code specified is not a 3 digit number or 1");
                 return false;
             }
             ssod.stat_codes[num_tokens] = (uint16_t)statCode;
index c34b15a47ec21f9ae6eb6e1c2a3c38e8fe223f43..31fb65f88386acb2ff964272bf3bbf0b5c806248 100644 (file)
@@ -122,14 +122,14 @@ void SIP_ParseMethods(const char* cur_tokenp, uint32_t* methodsConfig, SIPMethod
         if (SIP_AddMethodToList(cur_tokenp,
             StandardMethods[i_method].methodFlag, pmethods) == NULL)
         {
-            ParseError("Failed to add SIP method: %s.\n", cur_tokenp);
+            ParseError("Failed to add SIP method: %s.", cur_tokenp);
         }
     }
     else
     {
         if (SIP_AddUserDefinedMethod(cur_tokenp, methodsConfig, pmethods) == NULL)
         {
-            ParseError("Failed to add user defined SIP method: %s.\n", cur_tokenp);
+            ParseError("Failed to add user defined SIP method: %s.", cur_tokenp);
         }
     }
 }
index 7e386b351fa56c74313c8f4a6103cc130fbcf607..3db7b0523a783997de26525b9b40b3ca6598a2c1 100644 (file)
@@ -125,12 +125,6 @@ static inline bool is_eligible(Packet* p)
     return true;
 }
 
-StreamGlobalConfig::StreamGlobalConfig()
-{
-    flags = 0;
-    prune_log_max = 1048576;
-}
-
 //-------------------------------------------------------------------------
 // inspector stuff
 //-------------------------------------------------------------------------
index eac91f0b254e4805dcc683fb16ede2f50e5445b7..450c11b23e2b22217fb6d98dc835f0e17d442e83 100644 (file)
 #define STREAM_CONFIG_IPS                      0x00000400
 #define STREAM_CONFIG_NO_ASYNC_REASSEMBLY      0x00000800
 
-// FIXIT-L some of this stuff can be better encapsulated
-
-struct StreamGlobalConfig
-{
-    uint32_t prune_log_max;
-    uint32_t flags;
-
-    StreamGlobalConfig();
-};
-
-struct StreamConfig
-{
-    class FlowControl* fc;
-    class Stream* stream;
-
-    struct StreamGlobalConfig* global_config;
-};
-
 // shared stream state
 extern THREAD_LOCAL class FlowControl* flow_con;
 extern const PegInfo base_pegs[];
index 34f812a015e8c53dfe09ea632a692e2213cef621..8a30df369978b7decf7089c1e1635dca01b4e99f 100644 (file)
@@ -282,7 +282,7 @@ void CreatePidFile(pid_t pid)
             if (fcntl(lock_fd, F_SETLK, &lock) == -1)
             {
                 ClosePidFile();
-                ParseError("Failed to Lock PID File \"%s\" for PID \"%d\"\n",
+                ParseError("Failed to Lock PID File \"%s\" for PID \"%d\"",
                     snort_conf->pid_filename.c_str(), (int)pid);
                 return;
             }
@@ -354,7 +354,7 @@ void SetUidGid(int user_id, int group_id)
                 " support unprivileged operation.\n", DAQ_GetType());
 
         else if (setgid(group_id) < 0)
-            ParseError("Cannot set gid: %d\n", group_id);
+            ParseError("Cannot set gid: %d", group_id);
 
         else
             LogMessage("Set gid to %d\n", group_id);
@@ -367,7 +367,7 @@ void SetUidGid(int user_id, int group_id)
                 " support unprivileged operation.\n", DAQ_GetType());
 
         else if (setuid(user_id) < 0)
-            ParseError("Can not set uid: %d\n", user_id);
+            ParseError("Can not set uid: %d", user_id);
 
         else
             LogMessage("Set uid to %d\n", user_id);
@@ -481,13 +481,13 @@ char* read_infile(const char* key, const char* fname)
 
     if (fd < 0)
     {
-        ParseError("can't open %s = %s: %s\n", key, fname, get_error(errno));
+        ParseError("can't open %s = %s: %s", key, fname, get_error(errno));
         return nullptr;
     }
 
     if (fstat(fd, &buf) < 0)
     {
-        ParseError("can't stat %s: %s\n", fname, get_error(errno));
+        ParseError("can't stat %s: %s", fname, get_error(errno));
         return nullptr;
     }
 
@@ -497,14 +497,14 @@ char* read_infile(const char* key, const char* fname)
 
     if (cc < 0)
     {
-        ParseError("read %s: %s\n", fname, get_error(errno));
+        ParseError("read %s: %s", fname, get_error(errno));
         free(cp);
         return nullptr;
     }
 
     if (cc != buf.st_size)
     {
-        ParseError("short read %s (%d != %d)\n", fname, cc, (int)buf.st_size);
+        ParseError("short read %s (%d != %d)", fname, cc, (int)buf.st_size);
         free(cp);
         return nullptr;
     }
@@ -824,7 +824,7 @@ void SetChroot(std::string directory, std::string& logstore)
 
     if ( logstore.empty() )
     {
-        ParseError("Null log directory\n");
+        ParseError("Null log directory");
         return;
     }
 
@@ -837,7 +837,7 @@ void SetChroot(std::string directory, std::string& logstore)
     /* change to the directory */
     if (chdir(directory.c_str()) != 0)
     {
-        ParseError("SetChroot: Can not chdir to \"%s\": %s\n", directory.c_str(),
+        ParseError("SetChroot: Can not chdir to \"%s\": %s", directory.c_str(),
             get_error(errno));
         return;
     }
@@ -847,7 +847,7 @@ void SetChroot(std::string directory, std::string& logstore)
 
     if (absdir == NULL)
     {
-        ParseError("NULL Chroot found\n");
+        ParseError("NULL Chroot found");
         return;
     }
 
@@ -858,7 +858,7 @@ void SetChroot(std::string directory, std::string& logstore)
     /* make the chroot call */
     if (chroot(absdir) < 0)
     {
-        ParseError("Can not chroot to \"%s\": absolute: %s: %s\n",
+        ParseError("Can not chroot to \"%s\": absolute: %s: %s",
             directory.c_str(), absdir, get_error(errno));
         return;
     }
@@ -869,7 +869,7 @@ void SetChroot(std::string directory, std::string& logstore)
     /* change to "/" in the new directory */
     if (chdir("/") < 0)
     {
-        ParseError("Can not chdir to \"/\" after chroot: %s\n",
+        ParseError("Can not chdir to \"/\" after chroot: %s",
             get_error(errno));
         return;
     }