]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2921 in SNORT/snort3 from ~SBAIGAL/snort3:shelldef to master
authorSteve Chew (stechew) <stechew@cisco.com>
Thu, 3 Jun 2021 20:11:01 +0000 (20:11 +0000)
committerSteve Chew (stechew) <stechew@cisco.com>
Thu, 3 Jun 2021 20:11:01 +0000 (20:11 +0000)
Squashed commit of the following:

commit 43e72c52e4464cad36fefe63742db279192dfc66
Author: Steven Baigal (sbaigal) <sbaigal@cisco.com>
Date:   Thu Jun 3 11:04:11 2021 -0400

    control: allow compile with shell disabled

src/control/CMakeLists.txt
src/control/control.h

index f58c705de134dcaaf1747a9730350634c3d8a155..857ca316ad5c01bd88ef38147732555c46da1bd0 100644 (file)
@@ -5,6 +5,7 @@ if ( ENABLE_SHELL )
 endif ( ENABLE_SHELL )
 
 add_library ( control OBJECT
+    control.h
     ${SHELL_SOURCES}
 )
 
index 42452a3129bf6deef507e257fa85ef28f51e1dfc..182740da7d43339cf9e791be82c4a997e2ef85ef 100644 (file)
@@ -34,6 +34,7 @@ struct lua_State;
 class ControlConn
 {
 public:
+#ifdef SHELL
     ControlConn(int fd, bool local);
     ~ControlConn();
 
@@ -48,17 +49,16 @@ public:
 
     bool is_blocked() const { return blocked; }
     bool is_closed() const { return (fd == -1); }
-    SO_PUBLIC bool is_local() const { return local; }
-
     bool has_pending_command() const { return !pending_commands.empty(); }
 
     void configure() const;
     int read_commands();
     int execute_commands();
-    SO_PUBLIC bool respond(const char* format, va_list& ap);
-    SO_PUBLIC bool respond(const char* format, ...) __attribute__((format (printf, 2, 3)));
     void shutdown();
 
+    SO_PUBLIC bool is_local() const { return local; }
+    SO_PUBLIC bool respond(const char* format, va_list& ap);
+    SO_PUBLIC bool respond(const char* format, ...) __attribute__((format (printf, 2, 3)));
     SO_PUBLIC static ControlConn* query_from_lua(const lua_State*);
 
 private:
@@ -71,6 +71,12 @@ private:
     int fd;
     bool local;
     bool blocked = false;
+#else
+    SO_PUBLIC bool is_local() const { return false; }
+    SO_PUBLIC bool respond(const char* format, va_list& ap) { return false;}
+    SO_PUBLIC bool respond(const char* format, ...) __attribute__((format (printf, 2, 3))) { return false; }
+    SO_PUBLIC static ControlConn* query_from_lua(const lua_State*) { return nullptr; }
+#endif
 };
 
 #endif