]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
fixed sc->output
authorrcombs <rcombs@sq18.sfeng.sourcefire.com>
Mon, 25 Aug 2014 19:26:25 +0000 (15:26 -0400)
committerrcombs <rcombs@sq18.sfeng.sourcefire.com>
Mon, 25 Aug 2014 19:26:25 +0000 (15:26 -0400)
lua/snort.lua
src/main/snort_config.cc
src/main/snort_config.h
src/managers/event_manager.cc
src/parser/config_file.cc

index 8c4e4ea4ebf9b8e36315acac4ea1918cf2b4a092..0675d91459a6779da69d0d4f20b8b454ddf89667 100644 (file)
@@ -502,7 +502,7 @@ alert_fast = { }
 --alert_csv = { file = 'alert.csv' }
 
 -- to use -A lualert, this must be configured
-lualert = { args = "foo = 'bar'" }
+--lualert = { args = "foo = 'bar'" }
 
 -- pcap
 --log_tcpdump = { file = 'snort++.pcap' }
index f0aaa40281b4e88acc5052fd714c52775ef51813..9cdf6f6a3699676c04cd7ca0d0288c97f83e3ec3 100644 (file)
@@ -269,6 +269,9 @@ void SnortConfFree(SnortConfig *sc)
     if (sc->gtp_ports)
         free(sc->gtp_ports);
 
+    if ( sc->output )
+        free(sc->output);
+
     free_file_config(sc->file_config);
 
     if ( sc->var_list )
@@ -344,6 +347,7 @@ SnortConfig* MergeSnortConfs(SnortConfig *cmd_line, SnortConfig *config_file)
 
     // only set by cmd_line to override other conf output settings
     config_file->output = cmd_line->output;
+    cmd_line->output = nullptr;
 
     /* Merge checksum flags.  If command line modified them, use from the
      * command line, else just use from config_file. */
index 3a3e9213ca146aee67e30bfd568fa0de1bf467d8..a7be1983178f5e89e2c49d24c0f4f1f90f50ad24 100644 (file)
@@ -147,7 +147,7 @@ struct SnortConfig
     char* respond_device;
     uint8_t *eth_dst;
 
-    const char* output;
+    char* output;
 
     //------------------------------------------------------
     // attribute tables stuff
index 19eac5cbe86c9e2de5bef945f9c33f44f7fda4be..1cb0766f0747c66789b517e5e4b2fce1f308dbde 100644 (file)
@@ -175,7 +175,7 @@ void EventManager::instantiate(
             s_loggers.outputs.push_back(p->handler);
     }
     else
-        FatalError("logger has no type %s\n", p->api->base.name);
+        ParseError("logger has no type %s\n", p->api->base.name);
 }
 
 // command line outputs
@@ -187,7 +187,7 @@ void EventManager::instantiate(
 
     if ( !mod || !p )
     {
-        FatalError("unknown logger %s\n", name);
+        ParseError("unknown logger %s\n", name);
         return;
     }
 
index 16d6cb0f5eccc01f09c20e3bc3f107093a034ebb..dc8bae8da6130ded6efb65d9d3977e95ccc8804f 100644 (file)
 #include "managers/event_manager.h"
 #include "detection/detect.h"
 
-#define LOG_NONE  "none"
-#define LOG_TEXT  "text"
-#define LOG_PCAP  "pcap"
+#define LOG_NONE    "none"
+#define LOG_TEXT    "text"
+#define LOG_PCAP    "pcap"
 
-#define ALERT_NONE    "none"
-#define ALERT_CMG     "cmg"
-#define ALERT_JH      "jh"
-#define ALERT_DJR     "djr"
-#define ALERT_AJK     "ajk"
+#define ALERT_NONE  "none"
+#define ALERT_CMG   "cmg"
+#define ALERT_JH    "jh"
+#define ALERT_DJR   "djr"
+#define ALERT_AJK   "ajk"
 
 #define OUTPUT_AJK  "unified2"
 #define OUTPUT_CMG  "alert_fast"
@@ -270,7 +270,7 @@ void ConfigGTPDecoding(SnortConfig *sc, const char*)
 
     if (portObject)
     {
-       sc->gtp_ports =  PortObjectCharPortArray(sc->gtp_ports,portObject, &numberOfPorts);
+       sc->gtp_ports = PortObjectCharPortArray(sc->gtp_ports,portObject, &numberOfPorts);
     }
 
     if (!sc->gtp_ports || (0 == numberOfPorts))
@@ -680,16 +680,16 @@ void config_alert_mode(SnortConfig* sc, const char* val)
              (strcasecmp(val, ALERT_JH) == 0) ||
              (strcasecmp(val, ALERT_DJR) == 0))
     {
-        sc->output = OUTPUT_CMG;
+        sc->output = SnortStrdup(OUTPUT_CMG);
         sc->output_flags |= OUTPUT_FLAG__SHOW_DATA_LINK;
         sc->output_flags |= OUTPUT_FLAG__APP_DATA;
     }
     else if (strcasecmp(val, ALERT_AJK) == 0)
     {
-        sc->output = OUTPUT_AJK;
+        sc->output = SnortStrdup(OUTPUT_AJK);
     }
     else
-        sc->output = val;
+        sc->output = SnortStrdup(val);
 }
 
 void config_log_mode(SnortConfig* sc, const char* val)
@@ -706,7 +706,7 @@ void config_log_mode(SnortConfig* sc, const char* val)
     }
     else if (strcasecmp(val, LOG_PCAP) == 0)
     {
-        sc->output = OUTPUT_PCAP;
+        sc->output = SnortStrdup(OUTPUT_PCAP);
         set_main_hook(snort_log);
     }
     else