]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
smtp-layer: add MAIL FROM parsing test in unittest
authorEric Leblond <eric@regit.org>
Tue, 12 May 2015 15:56:59 +0000 (17:56 +0200)
committerEric Leblond <eric@regit.org>
Tue, 6 Oct 2015 21:30:46 +0000 (23:30 +0200)
src/app-layer-smtp.c

index d95bc73896c5853b4d48c449356b1c2567a68a75..0731442ac4580e17b06cb5d3eb6301f255605647 100644 (file)
@@ -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 ||