]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smtp: log transaction even if no email present
authorJason Ish <jason.ish@oisf.net>
Wed, 10 Nov 2021 22:38:35 +0000 (16:38 -0600)
committerJeff Lucovsky <jeff@lucovsky.org>
Sat, 15 Jan 2022 13:01:17 +0000 (08:01 -0500)
The SMTP transaction logger was not writing the log if the email
portion of the logger failed, such as in the case of STARTTLS
where this is no email decoded.

Ticket #4817

(cherry picked from commit 52b9c12f41d890cda340fe3b1c7e7e3e9d673d73)

src/output-json-smtp.c

index 75e646d440ab3ce26c3e13d77bc3d4cc2b09a702..205dfe4623150fd74c0e7c90025d08123fce9d62 100644 (file)
@@ -100,9 +100,8 @@ static int JsonSmtpLogger(ThreadVars *tv, void *thread_data, const Packet *p, Fl
         json_object_set_new(js, "smtp", sjs);
     }
 
-    if (JsonEmailLogJson(jhl, js, p, f, state, tx, tx_id) == TM_ECODE_OK) {
-        OutputJSONBuffer(js, jhl->emaillog_ctx->file_ctx, &jhl->buffer);
-    }
+    JsonEmailLogJson(jhl, js, p, f, state, tx, tx_id);
+    OutputJSONBuffer(js, jhl->emaillog_ctx->file_ctx, &jhl->buffer);
     json_object_del(js, "email");
     if (sjs) {
         json_object_del(js, "smtp");