From: Hui Cao (huica) Date: Wed, 5 Oct 2016 18:54:33 +0000 (-0400) Subject: Merge pull request #656 in SNORT/snort3 from file_work to master X-Git-Tag: 3.0.0-233~238 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5191a27a9074727cab697b130ed46aa8be2f81b3;p=thirdparty%2Fsnort3.git Merge pull request #656 in SNORT/snort3 from file_work to master Squashed commit of the following: commit 6209eecf88de7423e8f3bb70a62b6d02c13d9b4e Author: huica Date: Tue Oct 4 16:56:44 2016 -0400 Update comments for http upload --- diff --git a/src/service_inspectors/http_inspect/http_msg_body.cc b/src/service_inspectors/http_inspect/http_msg_body.cc index 60cbdac83..55f69bc67 100644 --- a/src/service_inspectors/http_inspect/http_msg_body.cc +++ b/src/service_inspectors/http_inspect/http_msg_body.cc @@ -140,7 +140,7 @@ void HttpMsgBody::do_file_processing() if (!session_data->mime_state) { FileFlows* file_flows = FileFlows::get_file_flows(flow); - bool download = (source_id == SRC_SERVER); + const bool download = (source_id == SRC_SERVER); if (file_flows->file_process(file_data.start, fp_length, file_position, !download)) diff --git a/src/service_inspectors/http_inspect/http_msg_header.cc b/src/service_inspectors/http_inspect/http_msg_header.cc index 6411354eb..abffe42b7 100644 --- a/src/service_inspectors/http_inspect/http_msg_header.cc +++ b/src/service_inspectors/http_inspect/http_msg_header.cc @@ -199,6 +199,7 @@ void HttpMsgHeader::setup_file_processing() { // FIXIT-M Bidirectional file processing is problematic so we don't do it. When the library // fully supports it remove the outer if statement that prevents it from being done. + // In addition, mime_state needs to become bidirectional. if (session_data->file_depth_remaining[1-source_id] <= 0) { if ((session_data->file_depth_remaining[source_id] = FileService::get_max_file_depth()) < 0) @@ -206,10 +207,11 @@ void HttpMsgHeader::setup_file_processing() session_data->file_depth_remaining[source_id] = 0; return; } - // FIXIT check boundary to make sure this is not MIME for sure + // FIXIT-M check boundary to make sure this is not MIME for sure if ((source_id == SRC_CLIENT) and (get_header_value_norm(HEAD_CONTENT_TYPE).length > 0 )) { session_data->mime_state = new MimeSession(&decode_conf, &mime_conf); + // FIX-H use specific header instead of classic raw header const Field& headers = get_classic_raw_header(); if (headers.length > 0) { diff --git a/src/service_inspectors/http_inspect/http_stream_splitter_scan.cc b/src/service_inspectors/http_inspect/http_stream_splitter_scan.cc index 4a3db64da..1eea161a2 100644 --- a/src/service_inspectors/http_inspect/http_stream_splitter_scan.cc +++ b/src/service_inspectors/http_inspect/http_stream_splitter_scan.cc @@ -256,7 +256,7 @@ bool HttpStreamSplitter::finish(Flow* flow) if (!session_data->mime_state) { FileFlows* file_flows = FileFlows::get_file_flows(flow); - bool download = (source_id == SRC_SERVER); + const bool download = (source_id == SRC_SERVER); file_flows->file_process(nullptr, 0, SNORT_FILE_END, !download); } else