]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1479 in SNORT/snort3 from ~MASHASAN/snort3:socket_crash to master
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Thu, 10 Jan 2019 18:12:00 +0000 (13:12 -0500)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Thu, 10 Jan 2019 18:12:00 +0000 (13:12 -0500)
Squashed commit of the following:

commit ebcfc6b5298aeb1af5dac7570412fa95feeed1a0
Author: Masud Hasan <mashasan@cisco.com>
Date:   Tue Jan 8 10:16:36 2019 -0500

    control: Avoid deleting objects on write failures so that they get deleted from main thread during read polling

src/main/control.cc
src/main/control.h
src/main/control_mgmt.cc
src/main/request.cc
src/main/request.h

index dbc5a44c725cf8e2de3fcbcc7aec9711d544ea37..089fdbbe8be55e2581e5927a974a1b64866a6f42 100644 (file)
@@ -91,14 +91,11 @@ void ControlConn::unblock()
         ControlMgmt::delete_control(fd);
 }
 
-bool ControlConn::send_queued_response()
+void ControlConn::send_queued_response()
 {
-    if ( !request->send_queued_response() )
-    {
-        ControlMgmt::delete_control(fd);
-        return false;
-    }
-    return true;
+#ifdef SHELL
+    request->send_queued_response();
+#endif
 }
 
 // FIXIT-L would like to flush prompt w/o \n
index f3dbc0abe68745f022310ebb8408e0763ec02cee..269009fa8a2e5a8b07f7043d3900c7fa5b3af621 100644 (file)
@@ -41,7 +41,7 @@ public:
 
     void block();
     void unblock();
-    bool send_queued_response();
+    void send_queued_response();
     bool is_blocked() const { return blocked; }
 
     void configure() const;
index 32c6b82e279b83ecc8eecd36d98e6f64b94cf51e..0599a6a5e621ad4be072b88b72cfb64f1d1a535a 100644 (file)
@@ -288,13 +288,7 @@ void ACShellCmd::execute(Analyzer& analyzer)
     ControlConn* control = (control_fd >= 0)? (ControlMgmt::find_control(control_fd) ) : nullptr;
 
     if( control )
-    {
-        if ( !control->send_queued_response() )
-        {
-            control_fd = -1;
-            return;
-        }
-    }
+        control->send_queued_response();
 
     ac->execute(analyzer);
 }
index efed766da906a14c8e21381b8e84313f238923ec..4cfcb63cd04a9c44379cc87d9c948fa1159ab338 100644 (file)
@@ -101,15 +101,12 @@ void Request::respond(const char* s, bool queue_response)
 }
 
 #ifdef SHELL
-bool Request::send_queued_response()
+void Request::send_queued_response()
 {
-    bool ret = true;
     if ( queued_response )
     {
-        ret = write_response(queued_response);
+        write_response(queued_response);
         queued_response = nullptr;
     }
-
-    return ret;
 }
 #endif
index 61e048ba2a20d942198690f2ad0f09bdba91359e..e470c55e32e581f9611991a2db5476ce81a8e6a9 100644 (file)
@@ -34,7 +34,7 @@ public:
     bool write_response(const char* s) const;
     void respond(const char* s, bool queue_response = false);
 #ifdef SHELL
-    bool send_queued_response();
+    void send_queued_response();
 #endif
 
 private: