From: Steve Chew (stechew) Date: Thu, 3 Jun 2021 20:11:01 +0000 (+0000) Subject: Merge pull request #2921 in SNORT/snort3 from ~SBAIGAL/snort3:shelldef to master X-Git-Tag: 3.1.6.0~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a65c407900323ecd233862231cf863e836a1ab96;p=thirdparty%2Fsnort3.git Merge pull request #2921 in SNORT/snort3 from ~SBAIGAL/snort3:shelldef to master Squashed commit of the following: commit 43e72c52e4464cad36fefe63742db279192dfc66 Author: Steven Baigal (sbaigal) Date: Thu Jun 3 11:04:11 2021 -0400 control: allow compile with shell disabled --- diff --git a/src/control/CMakeLists.txt b/src/control/CMakeLists.txt index f58c705de..857ca316a 100644 --- a/src/control/CMakeLists.txt +++ b/src/control/CMakeLists.txt @@ -5,6 +5,7 @@ if ( ENABLE_SHELL ) endif ( ENABLE_SHELL ) add_library ( control OBJECT + control.h ${SHELL_SOURCES} ) diff --git a/src/control/control.h b/src/control/control.h index 42452a312..182740da7 100644 --- a/src/control/control.h +++ b/src/control/control.h @@ -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