MimeBoundaryState boundary_state;
};
-typedef int (*Handle_header_line_func)(void* conf, void* pkt, const uint8_t* ptr,
+typedef int (*Handle_header_line_func)(void* conf, const uint8_t* ptr,
const uint8_t* eol, int
max_header_len, void* mime_ssn);
-typedef int (*Normalize_data_func)(void* conf, void* pkt, const uint8_t* ptr,
+typedef int (*Normalize_data_func)(void* conf, const uint8_t* ptr,
const uint8_t* data_end);
typedef void (*Decode_alert_func)(void* decode_state);
typedef void (*Reset_state_func)(void* ssn);
typedef void (*Log_file_action_func)(Flow* flow, int action);
// FIXIT-L constify file_data et al
-typedef int (*File_process_func)(
- Packet* p, uint8_t* file_data, int data_size, FilePosition,
+typedef bool (*File_process_func)(
+ Flow* flow, uint8_t* file_data, int data_size, FilePosition,
bool upload, bool suspend_block_verdict);
typedef int (*Get_file_name_func)(Flow* flow, uint8_t** file_name, uint32_t* name_len);
typedef int (*Parse_mime_decode_args_func)(DecodeConfig* decode_conf, char* arg, const
char* preproc_name);
typedef void (*Check_decode_config_func)(DecodeConfig* decode_conf);
-typedef const uint8_t* (*Process_mime_data_func)(void* packet, const uint8_t* start, const
+typedef const uint8_t* (*Process_mime_data_func)(Flow* flow, const uint8_t* start, const
uint8_t* end,
- MimeState* mime_ssn, bool upload, bool paf_enabled);
+ MimeState* mime_ssn, bool upload, FilePosition position);
typedef void (*Free_mime_session_func)(MimeState* mime_ssn);
typedef bool (*Is_decoding_enabled_func)(DecodeConfig* decode_conf);
typedef bool (*Is_decoding_conf_changed_func)(DecodeConfig* configNext, DecodeConfig* config,
typedef struct FileContext* (*Create_file_context_func)(Flow*);
typedef struct FileContext* (*Get_file_context_func)(Flow*);
typedef bool (*Set_file_context_func)(Flow*, FileContext*);
-typedef int (*Process_file_func)(FileContext* ctx, Packet* p,
- uint8_t* file_data, int data_size, FilePosition position,
- bool suspend_block_verdict);
+
typedef int64_t (*Get_max_file_capture_size)(Flow* flow);
typedef struct _file_api
* uint8_t **file_name: address for file name to be saved
* uint32_t *name_len: address to save file name length
* Returns
- * 1: file name available,
- * 0: file name is unavailable
+ * true: file name available,
+ * false: file name is unavailable
*/
Get_file_name_func get_file_name;
*/
Get_file_context_func get_main_file_context;
- /* Process file function, called by preprocessors that provides file data
- *
- * Arguments:
- * void* ctx: file context that will be processed
- * void* p: packet pointer
- * uint8_t* file_data: file data
- * int data_size: file data size
- * FilePosition: file position
- * bool suspend_block_verdict: used for smb to allow file pass
- * Returns:
- * 1: continue processing/log/block this file
- * 0: ignore this file (no further processing needed)
- */
- Process_file_func process_file;
/* Return a unique file instance number
*
* @return i index into p->payload where we stopped looking at data
*/
static const uint8_t* process_mime_header(
- Packet* p, const uint8_t* ptr,
+ const uint8_t* ptr,
const uint8_t* data_end_marker, MimeState* mime_ssn)
{
const uint8_t* eol = data_end_marker;
if (mime_ssn->methods && mime_ssn->methods->handle_header_line)
{
- int ret = mime_ssn->methods->handle_header_line(mime_ssn->config, p, ptr, eol, max_header_name_len,
+ int ret = mime_ssn->methods->handle_header_line(mime_ssn->config, ptr, eol, max_header_name_len,
mime_ssn);
if (ret < 0)
return NULL;
* @param i index into p->payload buffer to start looking at data
* @return i index into p->payload where we stopped looking at data
*/
-static const uint8_t* process_mime_body(Packet*, const uint8_t* ptr,
+static const uint8_t* process_mime_body(const uint8_t* ptr,
const uint8_t* data_end, MimeState* mime_ssn, bool is_data_end)
{
Email_DecodeState* decode_state = (Email_DecodeState*)(mime_ssn->decode_state);
*
* This should be called when mime data is available
*/
-const uint8_t* process_mime_data_paf(void* packet, const uint8_t* start, const uint8_t* end,
+const uint8_t* process_mime_data_paf(Flow* flow, const uint8_t* start, const uint8_t* end,
MimeState* mime_ssn, bool upload, FilePosition position)
{
- Packet* p = (Packet*)packet;
bool done_data = false;
if (mime_ssn->methods && mime_ssn->methods->is_end_of_data)
{
- done_data = mime_ssn->methods->is_end_of_data(p->flow);
+ done_data = mime_ssn->methods->is_end_of_data(flow);
}
/* if we've just entered the data state, check for a dot + end of line
* and dot to alt buffer */
if (mime_ssn->methods && mime_ssn->methods->normalize_data)
{
- if (mime_ssn->methods->normalize_data(mime_ssn->config, p, start, end) < 0)
+ if (mime_ssn->methods->normalize_data(mime_ssn->config, start, end) < 0)
return NULL;
}
}
#endif
- start = process_mime_header(p, start, end, mime_ssn);
+ start = process_mime_header(start, end, mime_ssn);
if (start == NULL)
return NULL;
}
if (mime_ssn->methods && mime_ssn->methods->normalize_data)
{
- if (mime_ssn->methods->normalize_data(mime_ssn->config, p, start, end) < 0)
+ if (mime_ssn->methods->normalize_data(mime_ssn->config, start, end) < 0)
return NULL;
}
/* now we shouldn't have to worry about copying any data to the alt buffer
{
case STATE_MIME_HEADER:
DEBUG_WRAP(DebugMessage(DEBUG_FILE, "MIME HEADER STATE ~~~~~~~~~~~~~~~~~~~~~~\n"); );
- start = process_mime_header(p, start, end, mime_ssn);
+ start = process_mime_header(start, end, mime_ssn);
break;
case STATE_DATA_BODY:
DEBUG_WRAP(DebugMessage(DEBUG_FILE, "DATA BODY STATE ~~~~~~~~~~~~~~~~~~~~~~~~\n"); );
- start = process_mime_body(p, start, end, mime_ssn, isFileEnd(position) );
+ start = process_mime_body(start, end, mime_ssn, isFileEnd(position) );
break;
}
}
}
/*Process file type/file signature*/
- if (file_api->file_process(p, (uint8_t*)ds->decodePtr,
+ if (file_api->file_process(flow, (uint8_t*)ds->decodePtr,
(uint16_t)ds->decoded_bytes, position, upload, false)
&& (isFileStart(position))&& mime_ssn->log_state)
{
- set_file_name_from_log(&(mime_ssn->log_state->file_log), p->flow);
+ set_file_name_from_log(&(mime_ssn->log_state->file_log), flow);
}
ResetDecodedBytes((Email_DecodeState*)(mime_ssn->decode_state));
}
{
reset_mime_state(mime_ssn);
if (mime_ssn->methods && mime_ssn->methods->reset_state)
- mime_ssn->methods->reset_state(p->flow);
+ mime_ssn->methods->reset_state(flow);
}
return end;
* *
* * This should be called when mime data is available
* */
-const uint8_t* process_mime_data(void* packet, const uint8_t* start,
- const uint8_t* data_end_marker, MimeState* mime_ssn, bool upload, bool paf_enabled)
+const uint8_t* process_mime_data(Flow* flow, const uint8_t* start,
+ const uint8_t* data_end_marker, MimeState* mime_ssn, bool upload, FilePosition position)
{
const uint8_t* attach_start = start;
const uint8_t* attach_end;
- Packet* p = (Packet*)packet;
- FilePosition position = SNORT_FILE_START;
- if (paf_enabled)
+ if (position != SNORT_FILE_POSITION_UNKNOWN)
{
- position = file_api->get_file_position(p);
- process_mime_data_paf(packet, attach_start, data_end_marker,
+ //FilePosition position = file_api->get_file_position(p);
+ process_mime_data_paf(flow, attach_start, data_end_marker,
mime_ssn, upload, position);
return data_end_marker;
}
- initFilePosition(&position, file_api->get_file_processed_size(p->flow));
+ initFilePosition(&position, file_api->get_file_processed_size(flow));
/* look for boundary */
while (start < data_end_marker)
{
{
attach_end = start;
finalFilePosition(&position);
- process_mime_data_paf(packet, attach_start, attach_end,
+ process_mime_data_paf(flow, attach_start, attach_end,
mime_ssn, upload, position);
position = SNORT_FILE_START;
attach_start = start + 1;
if ((start == data_end_marker) && (attach_start < data_end_marker))
{
- updateFilePosition(&position, file_api->get_file_processed_size(p->flow));
- process_mime_data_paf(packet, attach_start, data_end_marker,
+ updateFilePosition(&position, file_api->get_file_processed_size(flow));
+ process_mime_data_paf(flow, attach_start, data_end_marker,
mime_ssn, upload, position);
}
int set_log_buffers(MAIL_LogState** log_state, MAIL_LogConfig* conf);
void init_mime(void);
void free_mime(void);
-const uint8_t* process_mime_data(void *packet, const uint8_t *start, const uint8_t *end,
- MimeState *mime_ssn, bool upload, bool paf_enabled);
+const uint8_t* process_mime_data(Flow *flow, const uint8_t *start, const uint8_t *end,
+ MimeState *mime_ssn, bool upload, FilePosition position);
void free_mime_session(MimeState* mime_ssn);
void finalize_mime_position(Flow* flow, void* decode_state, FilePosition* position);
void reset_mime_paf_state(MimeDataPafInfo *data_info);
Log_file_action_func log_file_action = NULL;
/*Main File Processing functions */
-static int file_process(Packet* p, uint8_t* file_data, int data_size,
+static bool file_process(Flow* flow, uint8_t* file_data, int data_size,
FilePosition position, bool upload, bool suspend_block_verdict);
/*File properties*/
FileContext* create_file_context(Flow* flow);
bool set_current_file_context(Flow* flow, FileContext* ctx);
FileContext* get_main_file_context(Flow* flow);
-static int process_file_context(FileContext* ctx, Packet* p, uint8_t* file_data,
+static bool process_file_context(FileContext* ctx, Packet* p, uint8_t* file_data,
int data_size, FilePosition position, bool suspend_block_verdict);
static FilePosition get_file_position(Packet* pkt);
static bool check_paf_abort(Flow* flow);
fileAPI.set_current_file_context = &set_current_file_context;
fileAPI.get_current_file_context = &get_current_file_context;
fileAPI.get_main_file_context = &get_main_file_context;
- fileAPI.process_file = &process_file_context;
fileAPI.get_file_position = &get_file_position;
fileAPI.reset_mime_paf_state = &reset_mime_paf_state;
fileAPI.process_mime_paf_data = &process_mime_paf_data;
return context;
}
-static inline FileContext* find_main_file_context(Packet* p, FilePosition position,
+static inline FileContext* find_main_file_context(Flow* flow, FilePosition position,
bool upload)
{
FileContext* context = NULL;
- Packet* pkt = (Packet*)p;
- Flow* flow = pkt->flow;
+
FileSession* file_session = get_file_session (flow);
/* Attempt to get a previously allocated context. */
if (context and ((position == SNORT_FILE_MIDDLE)or
(position == SNORT_FILE_END)))
return context;
- else if (context)
+ else if ((context) && (context->verdict != FILE_VERDICT_PENDING))
{
- /*Push file event when there is another file in the same packet*/
- if (pkt->packet_flags & PKT_FILE_EVENT_SET)
- {
- SnortEventqLog(pkt);
- SnortEventqReset();
- pkt->packet_flags &= ~PKT_FILE_EVENT_SET;
- }
-
- if (context->verdict != FILE_VERDICT_PENDING)
- {
- /* Reuse the same context */
- file_context_reset(context);
- file_stats.files_total++;
- init_file_context(flow, upload, context);
- context->file_id = file_session->max_file_id++;
- return context;
- }
+ /* Reuse the same context */
+ file_context_reset(context);
+ file_stats.files_total++;
+ init_file_context(flow, upload, context);
+ context->file_id = file_session->max_file_id++;
+ return context;
}
context = create_file_context(flow);
{
File_Verdict verdict = FILE_VERDICT_UNKNOWN;
+ if (!pkt)
+ return;
+
if (file_signature_cb)
{
verdict = file_signature_cb(pkt, pkt->flow, context->sha256,
/*
* Return:
- * 1: continue processing/log/block this file
- * 0: ignore this file
+ * true: continue processing/log/block this file
+ * false: ignore this file
*/
-static int process_file_context(FileContext* context, Packet* pkt, uint8_t* file_data,
- int data_size, FilePosition position, bool suspend_block_verdict)
+static bool process_file_context(FileContext* context, Packet* pkt, Flow* flow, uint8_t* file_data,
+ int data_size, FilePosition position, bool suspend_block_verdict)
{
if ( FileConfig::trace_stream )
{
DumpHex(stdout, file_data, data_size);
- DEBUG_WRAP(DebugMessage(DEBUG_FILE, "stream pointer %p\n", pkt->flow); );
}
- Flow* flow = pkt->flow;
-
if (!context)
- return 0;
+ return false;
set_current_file_context(flow, context);
file_stats.file_data_total += data_size;
if ((!context->file_type_enabled)and (!context->file_signature_enabled))
{
updateFileSize(context, data_size, position);
- return 0;
+ return false;
}
/* if file config is changed, update it*/
context->file_type_context = NULL;
}
- if (check_http_partial_content(pkt))
+ if (pkt and check_http_partial_content(pkt))
{
context->file_type_enabled = false;
context->file_signature_enabled = false;
- return 0;
+ return false;
}
/*file type id*/
context->file_signature_enabled = false;
updateFileSize(context, data_size, position);
file_capture_stop(context);
- return 0;
+ return false;
}
if (context->file_type_id != SNORT_FILE_TYPE_CONTINUE)
{
- if (file_type_cb)
+ if (pkt and file_type_cb)
{
verdict = file_type_cb(pkt, pkt->flow, context->file_type_id,
context->upload, context->file_id);
file_eventq_add(GENERATOR_FILE_TYPE, context->file_type_id,
RULE_TYPE__ALERT);
context->file_signature_enabled = false;
- pkt->packet_flags |= PKT_FILE_EVENT_SET;
}
else if (verdict == FILE_VERDICT_BLOCK)
{
RULE_TYPE__DROP);
updateFileSize(context, data_size, position);
context->file_signature_enabled = false;
- add_file_to_block(pkt, verdict, context->file_type_id, NULL);
+ if (pkt)
+ add_file_to_block(pkt, verdict, context->file_type_id, NULL);
return 1;
}
else if (verdict == FILE_VERDICT_REJECT)
{
file_eventq_add(GENERATOR_FILE_TYPE, context->file_type_id,
RULE_TYPE__DROP);
- ActionManager::queue_reject(pkt);
- updateFileSize(context, data_size, position);
- context->file_signature_enabled = false;
- add_file_to_block(pkt, verdict, context->file_type_id, NULL);
+ if (pkt)
+ {
+ ActionManager::queue_reject(pkt);
+ updateFileSize(context, data_size, position);
+ context->file_signature_enabled = false;
+ add_file_to_block(pkt, verdict, context->file_type_id, NULL);
+ }
return 1;
}
else if (verdict == FILE_VERDICT_STOP)
{
updateFileSize(context, data_size, position);
}
- return 1;
+ return true;
}
/*
* Return:
- * 1: continue processing/log/block this file
- * 0: ignore this file
+ * true: continue processing/log/block this file
+ * false: ignore this file
*/
-static int file_process(Packet* p, uint8_t* file_data, int data_size,
+static bool file_process(Flow* flow, uint8_t* file_data, int data_size,
FilePosition position, bool upload, bool suspend_block_verdict)
{
FileContext* context;
-
+ Packet* p = NULL;
/* if both disabled, return immediately*/
if (!is_file_service_enabled())
- return 0;
+ return false;
if (position == SNORT_FILE_POSITION_UNKNOWN)
- return 0;
+ return false;
- context = find_main_file_context(p, position, upload);
+ context = find_main_file_context(flow, position, upload);
- return process_file_context(context, p, file_data, data_size, position,
+ return process_file_context(context, p, flow, file_data, data_size, position,
suspend_block_verdict);
}
set_file_data((uint8_t*)p->data, p->dsize);
- status = file_api->file_process(p, file_data, data_length,
+ status = file_api->file_process(p->flow, file_data, data_length,
data_ssn->position, data_ssn->direction, false);
/* Filename needs to be set AFTER the first call to file_process( ) */
if (hsd->mime_ssn)
{
uint8_t* end = ( uint8_t*)(p->data) + p->dsize;
- file_api->process_mime_data(p, p->data, end, hsd->mime_ssn, 1, false);
+ file_api->process_mime_data(p->flow, p->data, end, hsd->mime_ssn, 1,
+ SNORT_FILE_POSITION_UNKNOWN);
}
else if (file_api->get_file_processed_size(p->flow) >0)
{
- file_api->file_process(p, (uint8_t*)p->data, p->dsize, getFilePoistion(p),
+ file_api->file_process(p->flow, (uint8_t*)p->data, p->dsize, getFilePoistion(p),
true, false);
}
}
end = (uint8_t*)(session->client.request.post_raw +
session->client.request.post_raw_size);
- file_api->process_mime_data(p, start, end, hsd->mime_ssn, 1, false);
+ file_api->process_mime_data(p->flow, start, end, hsd->mime_ssn, 1,
+ SNORT_FILE_POSITION_UNKNOWN);
}
else
{
- if (file_api->file_process(p,(uint8_t*)session->client.request.post_raw,
+ if (file_api->file_process(p->flow,
+ (uint8_t*)session->client.request.post_raw,
(uint16_t)session->client.request.post_raw_size,
getFilePoistion(p), true, false))
{
if (hsd->mime_ssn)
{
uint8_t* end = ( uint8_t*)(p->data) + p->dsize;
- file_api->process_mime_data(p, p->data, end, hsd->mime_ssn, 1, false);
+ file_api->process_mime_data(p->flow, p->data, end, hsd->mime_ssn, 1,
+ SNORT_FILE_POSITION_UNKNOWN);
}
else if (file_api->get_file_processed_size(p->flow) >0)
{
- file_api->file_process(p, (uint8_t*)p->data, p->dsize, getFilePoistion(p),
+ file_api->file_process(p->flow, (uint8_t*)p->data, p->dsize,
+ getFilePoistion(p),
true, false);
}
}
}
if (p->has_paf_payload()
- && file_api->file_process(p,(uint8_t*)session->server.response.body,
+ && file_api->file_process(p->flow,
+ (uint8_t*)session->server.response.body,
(uint16_t)session->server.response.body_size,
getFilePoistion(p), false, false))
{
}
else
data_end = ptr + len;
- ptr = file_api->process_mime_data(p, ptr, end, &(imap_ssn->mime_ssn), 0, true);
+
+ FilePosition position = file_api->get_file_position(p);
+ ptr = file_api->process_mime_data(p->flow, ptr, end, &(imap_ssn->mime_ssn), 0,
+ position);
if ( ptr < data_end)
len = len - (data_end - ptr);
{
DEBUG_WRAP(DebugMessage(DEBUG_POP, "DATA STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); );
//ptr = POP_HandleData(p, ptr, end);
- ptr = file_api->process_mime_data(p, ptr, end, &(pop_ssn->mime_ssn), 0, true);
+ FilePosition position = file_api->get_file_position(p);
+ ptr = file_api->process_mime_data(p->flow, ptr, end, &(pop_ssn->mime_ssn), 0,
+ position);
continue;
}
POP_GetEOL(ptr, end, &eol, &eolm);
static void SMTP_ResetState(void*);
void SMTP_DecodeAlert(void* ds);
-static int SMTP_HandleHeaderLine(void* conf, void* pkt, const uint8_t* ptr, const uint8_t* eol,
+static int SMTP_HandleHeaderLine(void* conf, const uint8_t* ptr, const uint8_t* eol,
int max_header_len, void* ssn);
-static int SMTP_NormalizeData(void* conf, void* pkt, const uint8_t* ptr, const uint8_t* data_end);
+static int SMTP_NormalizeData(void* conf, const uint8_t* ptr, const uint8_t* data_end);
MimeMethods smtp_mime_methods = { SMTP_HandleHeaderLine, SMTP_NormalizeData, SMTP_DecodeAlert,
SMTP_ResetState, smtp_is_data_end };
/* if normalizing, copy line to alt buffer */
if (smtp_normalizing)
{
- ret = SMTP_CopyToAltBuffer(p, ptr, eol - ptr);
+ ret = SMTP_CopyToAltBuffer(ptr, eol - ptr);
if (ret == -1)
return NULL;
}
}
else if (smtp_normalizing) /* Already normalizing */
{
- ret = SMTP_CopyToAltBuffer(p, ptr, eol - ptr);
+ ret = SMTP_CopyToAltBuffer(ptr, eol - ptr);
if (ret == -1)
return NULL;
}
return eol;
}
-static int SMTP_NormalizeData(void* conf, void* pkt, const uint8_t* ptr, const uint8_t* data_end)
+static int SMTP_NormalizeData(void* conf, const uint8_t* ptr, const uint8_t* data_end)
{
- Packet* p = (Packet*)pkt;
SMTP_PROTO_CONF* config = (SMTP_PROTO_CONF*)conf;
/* if we're ignoring data and not already normalizing, copy everything
* up to here into alt buffer so detection engine doesn't have
* to look at the data; otherwise, if we're normalizing and not
* ignoring data, copy all of the data into the alt buffer */
- if (config->decode_conf.ignore_data && !smtp_normalizing)
+ /*if (config->decode_conf.ignore_data && !smtp_normalizing)
{
- return SMTP_CopyToAltBuffer(p, p->data, ptr - p->data);
+ return SMTP_CopyToAltBuffer(p->data, ptr - p->data);
}
- else if (!config->decode_conf.ignore_data && smtp_normalizing)
+ else */
+ if (!config->decode_conf.ignore_data && smtp_normalizing)
{
- return SMTP_CopyToAltBuffer(p, ptr, data_end - ptr);
+ return SMTP_CopyToAltBuffer(ptr, data_end - ptr);
}
return 0;
}
-static int SMTP_HandleHeaderLine(void* conf, void* pkt, const uint8_t* ptr, const uint8_t* eol,
+static int SMTP_HandleHeaderLine(void* conf, const uint8_t* ptr, const uint8_t* eol,
int max_header_len, void* ssn)
{
int ret;
int header_line_len;
- Packet* p = (Packet*)pkt;
SMTP_PROTO_CONF* config = (SMTP_PROTO_CONF*)conf;
MimeState* mime_ssn = (MimeState*)ssn;
/* get length of header line */
* currently the code does not normalize headers */
if (smtp_normalizing)
{
- ret = SMTP_CopyToAltBuffer(p, ptr, eol - ptr);
+ ret = SMTP_CopyToAltBuffer(ptr, eol - ptr);
if (ret == -1)
return (-1);
}
const uint8_t* ptr = p->data;
const uint8_t* end = p->data + p->dsize;
+
if (smtp_ssn->state == STATE_CONNECT)
{
smtp_ssn->state = STATE_COMMAND;
while ((ptr != NULL) && (ptr < end))
{
+ FilePosition position;
switch (smtp_ssn->state)
{
case STATE_COMMAND:
case STATE_DATA:
case STATE_BDATA:
DEBUG_WRAP(DebugMessage(DEBUG_SMTP, "DATA STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); );
- ptr = file_api->process_mime_data(p, ptr, end, &(smtp_ssn->mime_ssn), 1, true);
+ position = file_api->get_file_position(p);
+ ptr = file_api->process_mime_data(p->flow, ptr, end, &(smtp_ssn->mime_ssn), 1,
+ position);
//ptr = SMTP_HandleData(p, ptr, end, &(smtp_ssn->mime_ssn));
break;
case STATE_XEXCH50:
if (smtp_normalizing)
- SMTP_CopyToAltBuffer(p, ptr, end - ptr);
+ SMTP_CopyToAltBuffer(ptr, end - ptr);
if (smtp_is_data_end (p->flow))
smtp_ssn->state = STATE_COMMAND;
return;
* line into the alt buffer */
if (!smtp_normalizing)
{
- ret = SMTP_CopyToAltBuffer(p, p->data, ptr - p->data);
+ ret = SMTP_CopyToAltBuffer(p->data, ptr - p->data);
if (ret == -1)
return -1;
}
/* copy the command into the alt buffer */
- ret = SMTP_CopyToAltBuffer(p, cmd_start, cmd_end - cmd_start);
+ ret = SMTP_CopyToAltBuffer(cmd_start, cmd_end - cmd_start);
if (ret == -1)
return -1;
if (args_start != args_end)
{
/* copy a 'pure' space */
- ret = SMTP_CopyToAltBuffer(p, space, 1);
+ ret = SMTP_CopyToAltBuffer(space, 1);
if (ret == -1)
return -1;
- ret = SMTP_CopyToAltBuffer(p, args_start, args_end - args_start);
+ ret = SMTP_CopyToAltBuffer(args_start, args_end - args_start);
if (ret == -1)
return -1;
}
/* copy the end of line marker into the alt buffer */
- ret = SMTP_CopyToAltBuffer(p, eolm, eol - eolm);
+ ret = SMTP_CopyToAltBuffer(eolm, eol - eolm);
if (ret == -1)
return -1;
}
{
/* if we're already normalizing and didn't need to normalize this line, just
* copy it into the alt buffer */
- ret = SMTP_CopyToAltBuffer(p, ptr, eol - ptr);
+ ret = SMTP_CopyToAltBuffer(ptr, eol - ptr);
if (ret == -1)
return -1;
}
DecodeBuf.len = 0;
}
-int SMTP_CopyToAltBuffer(Packet* p, const uint8_t* start, int length)
+int SMTP_CopyToAltBuffer(const uint8_t* start, int length)
{
uint8_t* alt_buf;
int alt_size;
if (ret != SAFEMEM_SUCCESS)
{
- SetDetectLimit(p, 0);
+ //SetDetectLimit(p, 0);
smtp_normalizing = 0;
return -1;
}
#include "protocols/packet.h"
void SMTP_GetEOL(const uint8_t*, const uint8_t*, const uint8_t**, const uint8_t**);
-int SMTP_CopyToAltBuffer(Packet*, const uint8_t*, int);
+int SMTP_CopyToAltBuffer(const uint8_t*, int);
int SMTP_CopyEmailHdrs(const uint8_t*, int, MAIL_LogState* log_state);
int SMTP_CopyEmailID(const uint8_t*, int, int, MAIL_LogState* log_state);
void SMTP_LogFuncs(SMTP_PROTO_CONF* config, Packet* p, MimeState* mime_ssn);
MODULE_PROFILE_START(file_ssn_stats);
StreamFileConfig* c = get_file_cfg(p->flow->ssn_server);
- file_api->file_process(p, (uint8_t*)p->data, p->dsize, position(p), c->upload, false);
+ file_api->file_process(p->flow, (uint8_t*)p->data, p->dsize, position(p), c->upload, false);
set_file_data((uint8_t*)p->data, p->dsize);
MODULE_PROFILE_END(file_ssn_stats);