From fbd6428f1bb082b35b24c9b1e4715c2a2ce8128f Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Tue, 12 May 2015 17:56:59 +0200 Subject: [PATCH] smtp-layer: add MAIL FROM parsing test in unittest --- src/app-layer-smtp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 ||