]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Check file processing for response
authorhuica <huica@cisco.com>
Thu, 17 Sep 2015 19:34:06 +0000 (15:34 -0400)
committerhuica <huica@cisco.com>
Thu, 17 Sep 2015 19:34:06 +0000 (15:34 -0400)
src/service_inspectors/nhttp_inspect/nhttp_msg_body.cc
src/service_inspectors/nhttp_inspect/nhttp_msg_header.cc
src/service_inspectors/nhttp_inspect/nhttp_stream_splitter.cc

index 0b3e712f318ef8528f7650b07be7c040320ed846..96f9f35fdbbbee9f96f742e3c27b4c7f07e560fb 100644 (file)
@@ -93,7 +93,7 @@ void NHttpMsgBody::do_file_processing()
     {
         FileFlows* file_flows = FileFlows::get_file_flows(flow);
 
-        if (file_flows && file_flows->file_process(file_data.start, fp_length,
+        if (file_flows->file_process(file_data.start, fp_length,
             file_position, false, false))
         {
             session_data->file_depth_remaining[source_id] -= fp_length;
index 6bf44c04237e417f4ba47dee5433167bb6a80931..3441949ddca56915920493d4ad97b332506e75da 100644 (file)
@@ -126,18 +126,22 @@ void NHttpMsgHeader::setup_file_processing()
     // fully supports it remove the outer if statement that prevents it from being done.
     if (session_data->file_depth_remaining[1-source_id] == 0)
     {
-        FileFlows* file_flows = FileFlows::get_file_flows(flow);
-        if (!file_flows)
-            return;
-
         if ((session_data->file_depth_remaining[source_id] = FileService::get_max_file_depth()) < 0)
         {
            session_data->file_depth_remaining[source_id] = 0;
+           return;
         }
+
         if (source_id == SRC_CLIENT)
         {
             session_data->mime_state = new MimeSession(&decode_conf, &mime_conf);
         }
+        else
+        {
+            FileFlows* file_flows = FileFlows::get_file_flows(flow);
+            if (!file_flows)
+                session_data->file_depth_remaining[source_id] = 0;
+        }
     }
 }
 
index 57606d7795b8ead2b429795d2bcda073d706f3b4..39c01db8e9580d6387dd032c9ed936b244dfc514 100644 (file)
@@ -493,8 +493,7 @@ bool NHttpStreamSplitter::finish(Flow* flow)
         if (source_id == SRC_SERVER)
         {
             FileFlows* file_flows = FileFlows::get_file_flows(flow);
-            if (file_flows)
-                file_flows->file_process(nullptr, 0, SNORT_FILE_END, false, false);
+            file_flows->file_process(nullptr, 0, SNORT_FILE_END, false, false);
         }
         else
         {