From: Eric Leblond Date: Tue, 12 May 2015 15:56:59 +0000 (+0200) Subject: smtp-layer: add MAIL FROM parsing test in unittest X-Git-Tag: suricata-3.0RC1~96 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbd6428f1bb082b35b24c9b1e4715c2a2ce8128f;p=thirdparty%2Fsuricata.git smtp-layer: add MAIL FROM parsing test in unittest --- diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index d95bc73896..0731442ac4 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -4538,6 +4538,16 @@ int SMTPParserTest14(void) SCMutexUnlock(&f.m); goto end; } + + if ((smtp_state->curr_tx->mail_from_len != 14) || + strncmp("asdff@asdf.com", (char *)smtp_state->curr_tx->mail_from, 14)) { + printf("incorrect parsing of MAIL FROM field '%s' (%d)\n", + smtp_state->curr_tx->mail_from, + smtp_state->curr_tx->mail_from_len); + SCMutexUnlock(&f.m); + goto end; + } + SCMutexUnlock(&f.m); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 ||