]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2945 in SNORT/snort3 from ~SBAIGAL/snort3:shell3 to master
authorSteve Chew (stechew) <stechew@cisco.com>
Tue, 15 Jun 2021 22:10:26 +0000 (22:10 +0000)
committerSteve Chew (stechew) <stechew@cisco.com>
Tue, 15 Jun 2021 22:10:26 +0000 (22:10 +0000)
Squashed commit of the following:

commit 3a742fa01840835d4c7f92caac80e8ded9176d1b
Author: Steven Baigal (sbaigal) <sbaigal@cisco.com>
Date:   Tue Jun 15 09:08:33 2021 -0400

    control: remove SHELL compile flag from header

src/control/CMakeLists.txt
src/control/control.cc
src/control/control.h
src/host_tracker/test/host_cache_module_test.cc
src/network_inspectors/rna/test/rna_module_mock.h

index 857ca316ad5c01bd88ef38147732555c46da1bd0..6b22e80394baa29fbfa322a9d600e9b76edb0677 100644 (file)
@@ -1,11 +1,11 @@
 set ( CONTROL_INCLUDES  control.h )
 
 if ( ENABLE_SHELL )
-    set ( SHELL_SOURCES control.cc control_mgmt.cc control_mgmt.h )
+    set ( SHELL_SOURCES control_mgmt.cc control_mgmt.h )
 endif ( ENABLE_SHELL )
 
 add_library ( control OBJECT
-    control.h
+    control.cc
     ${SHELL_SOURCES}
 )
 
index e2d34cca10c2b169174f8c4d6250b58e1c60cbd4..2a074eebef66feb07a4fc41d69eb0a94a3aeabb1 100644 (file)
@@ -37,7 +37,12 @@ using namespace snort;
 
 ControlConn* ControlConn::query_from_lua(const lua_State* L)
 {
+#ifdef SHELL
     return ControlMgmt::find_control(L);
+#else
+    UNUSED(L);
+    return nullptr;
+#endif
 }
 
 //------------------------------------------------------------------------
index 09bc40ca2ed80fe8949f3782175257f7618ea857..29333df2d8566fd5db7c1e145ae8e8c11caec33e 100644 (file)
@@ -34,7 +34,6 @@ struct lua_State;
 class ControlConn
 {
 public:
-#ifdef SHELL
     ControlConn(int fd, bool local);
     ~ControlConn();
 
@@ -69,14 +68,8 @@ private:
     std::string next_command;
     class Shell *shell;
     int fd;
-    bool local;
+    bool local = false;
     bool blocked = false;
-#else
-    SO_PUBLIC bool is_local() const { return false; }
-    SO_PUBLIC bool respond(const char*, va_list&) { return false;}
-    SO_PUBLIC bool respond(const char*, ...) __attribute__((format (printf, 2, 3))) { return false; }
-    SO_PUBLIC static ControlConn* query_from_lua(const lua_State*) { return nullptr; }
-#endif
 };
 
 #endif
index 1ca95e28978a7a9f889e505d2de8133b04f1eb69..63d0b7c28370dccfe891833e5c52b2e69f8b85d7 100644 (file)
@@ -44,13 +44,13 @@ using namespace snort;
 static HostCacheModule module;
 #define LOG_MAX 128
 static char logged_message[LOG_MAX+1];
-#ifdef SHELL
+
 static ControlConn ctrlcon(1, true);
 ControlConn::ControlConn(int, bool) {}
 ControlConn::~ControlConn() {}
 ControlConn* ControlConn::query_from_lua(const lua_State*) { return &ctrlcon; }
 bool ControlConn::respond(const char*, ...) { return true; }
-#endif
+
 namespace snort
 {
 const SnortConfig* SnortConfig::get_conf()
index 042928ec7e6d555f4b45abc60c303e7c0e8fb43b..75eed5935595933eed59f2c2818a3f40d38d5c75 100644 (file)
@@ -105,13 +105,13 @@ private:
 } // end of namespace snort
 
 void snort::main_broadcast_command(snort::AnalyzerCommand*, ControlConn*) {}
-#ifdef SHELL
+
 static ControlConn s_ctrlcon(1, true);
 ControlConn::ControlConn(int, bool) {}
 ControlConn::~ControlConn() {}
 ControlConn* ControlConn::query_from_lua(const lua_State*) { return &s_ctrlcon; }
 bool ControlConn::respond(const char*, ...) { return true; }
-#endif
+
 HostCacheMac* get_host_cache_mac() { return nullptr; }
 
 DataPurgeAC::~DataPurgeAC() = default;