From: huica Date: Fri, 24 Jul 2015 14:35:59 +0000 (-0400) Subject: minor mime log cleanup X-Git-Tag: 3.0.0-233~828^2~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=436d27ba237abe5c641e56c259b4f0b59e6b41dd;p=thirdparty%2Fsnort3.git minor mime log cleanup --- diff --git a/src/file_api/file_mime_log.cc b/src/file_api/file_mime_log.cc index 7c8cf97c8..48a210962 100644 --- a/src/file_api/file_mime_log.cc +++ b/src/file_api/file_mime_log.cc @@ -136,9 +136,9 @@ int MailLogState::log_file_name(const uint8_t* start, int length, bool* disp_con length = ret; - alt_buf = log_state.filenames; + alt_buf = filenames; alt_size = MAX_FILE; - alt_len = &(log_state.file_logged); + alt_len = &(file_logged); log_avail = alt_size - *alt_len; if (!alt_buf || (log_avail <= 0)) @@ -162,7 +162,7 @@ int MailLogState::log_file_name(const uint8_t* start, int length, bool* disp_con return -1; } - log_state.file_current = *alt_len; + file_current = *alt_len; *alt_len += length; log_flags |= MIME_FLAG_FILENAME_PRESENT; @@ -175,10 +175,10 @@ void MailLogState::set_file_name_from_log(void* pv) { Flow* ssn = (Flow*)pv; // FIXIT-M eliminate need for cast - if (log_state.file_logged > log_state.file_current) + if (file_logged > file_current) { - file_api->set_file_name(ssn, log_state.filenames + log_state.file_current, - log_state.file_logged -log_state.file_current); + file_api->set_file_name(ssn, filenames + file_current, + file_logged - file_current); } else { @@ -304,8 +304,8 @@ int MailLogState::log_email_id(const uint8_t* start, int length, EmailUserType t void MailLogState::get_file_name(uint8_t** buf, uint32_t* len) { - *buf = log_state.filenames; - *len = log_state.file_logged; + *buf = filenames; + *len = file_logged; } void MailLogState::get_email_hdrs(uint8_t** buf, uint32_t* len) @@ -369,16 +369,18 @@ MailLogState::MailLogState(MailLogConfig* conf) { log_depth = conf->email_hdrs_log_depth; recipients = buf; - rcpts_logged = 0; senders = buf + MAX_EMAIL; - snds_logged = 0; - log_state.filenames = buf + (2*MAX_EMAIL); - log_state.file_logged = 0; - log_state.file_current = 0; + filenames = buf + (2*MAX_EMAIL); emailHdrs = buf + (2*MAX_EMAIL) + MAX_FILE; - hdrs_logged = 0; + } } + + rcpts_logged = 0; + snds_logged = 0; + file_logged = 0; + file_current = 0; + hdrs_logged = 0; } MailLogState::~MailLogState() diff --git a/src/file_api/file_mime_log.h b/src/file_api/file_mime_log.h index bac55c93c..2b44f5ef8 100644 --- a/src/file_api/file_mime_log.h +++ b/src/file_api/file_mime_log.h @@ -35,13 +35,6 @@ enum EmailUserType EMAIL_RECIPIENT }; -struct FileLogState -{ - uint8_t* filenames; - uint16_t file_logged; - uint16_t file_current; -}; - class MailLogState { public: @@ -62,16 +55,18 @@ public: private: int extract_file_name(const char** start, int length, bool* disp_cont); - FileLogState log_state; int log_flags = 0; uint8_t* buf = NULL; unsigned char* emailHdrs; uint32_t log_depth; uint32_t hdrs_logged; - uint8_t* recipients; + uint8_t* recipients = NULL; uint16_t rcpts_logged; - uint8_t* senders; + uint8_t* senders = NULL; uint16_t snds_logged; + uint8_t* filenames = NULL; + uint16_t file_logged; + uint16_t file_current; }; struct MailLogConfig