From: Eric Leblond Date: Tue, 5 May 2015 13:16:35 +0000 (+0200) Subject: email-json: body md5 logging is optional X-Git-Tag: suricata-3.0RC1~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca52fa91dd7e03a23dd417c19480db079182ad67;p=thirdparty%2Fsuricata.git email-json: body md5 logging is optional --- diff --git a/src/output-json-email-common.c b/src/output-json-email-common.c index fae43a2e9a..080151589c 100644 --- a/src/output-json-email-common.c +++ b/src/output-json-email-common.c @@ -145,6 +145,21 @@ static void JsonEmailLogJSONMd5(OutputJsonEmailCtx *email_ctx, json_t *js, SMTPT } } } + + if (email_ctx->flags & LOG_EMAIL_BODY_MD5) { + MimeDecParseState *mime_state = tx->mime_state; + if (mime_state && mime_state->md5_ctx && (mime_state->state_flag == PARSE_DONE)) { + size_t x; + int i; + char s[256]; + if (likely(s != NULL)) { + for (i = 0, x = 0; x < sizeof(mime_state->md5); x++) { + i += snprintf(s + i, 255-i, "%02x", mime_state->md5[x]); + } + json_object_set_new(js, "body_md5", json_string(s)); + } + } + } } #endif @@ -244,20 +259,6 @@ json_t *JsonEmailLogJsonData(const Flow *f, void *state, void *vtx, uint64_t tx_ SCReturnPtr(NULL, "json_t"); } -#ifdef HAVE_NSS - if (mime_state->md5_ctx && (mime_state->state_flag == PARSE_DONE)) { - size_t x; - int i; - char s[256]; - if (likely(s != NULL)) { - for (i = 0, x = 0; x < sizeof(mime_state->md5); x++) { - i += snprintf(s + i, 255-i, "%02x", mime_state->md5[x]); - } - json_object_set_new(sjs, "body_md5", json_string(s)); - } - } -#endif - json_object_set_new(sjs, "status", json_string(MimeDecParseStateGetStatus(mime_state)));