55 #define LOG_EMAIL_DEFAULT 0
56 #define LOG_EMAIL_EXTENDED (1<<0)
57 #define LOG_EMAIL_ARRAY (1<<1)
58 #define LOG_EMAIL_COMMA (1<<2)
59 #define LOG_EMAIL_BODY_MD5 (1<<3)
60 #define LOG_EMAIL_SUBJECT_MD5 (1<<4)
86 static void EveEmailLogJSONMd5(
94 SCMimeSmtpLogSubjectMd5(js, entity);
102 SCMimeSmtpLogBodyMd5(js, entity);
106 static void EveEmailLogJSONCustom(
111 if (entity == NULL) {
116 if (((email_ctx->
fields & (1ULL<<f)) != 0)
121 SCMimeSmtpLogFieldArray(
124 SCMimeSmtpLogFieldComma(
127 SCMimeSmtpLogFieldString(
137 static bool EveEmailLogJsonData(
138 const Flow *f,
void *state,
void *vtx, uint64_t tx_id, SCJsonBuilder *sjs)
141 MimeStateSMTP *mime_state;
148 if (smtp_state == NULL) {
149 SCLogDebug(
"no smtp state, so no request logging");
155 SCLogDebug(
"lets go mime_state %p", mime_state);
161 if ((mime_state != NULL)) {
162 SCMimeSmtpLogData(sjs, mime_state);
171 void *state,
void *vtx, uint64_t tx_id)
175 SCJsonBuilderMark mark = { 0, 0, 0 };
177 SCJbGetMark(js, &mark);
178 SCJbOpenObject(js,
"email");
179 if (!EveEmailLogJsonData(f, state, vtx, tx_id, js)) {
180 SCJbRestoreMark(js, &mark);
185 EveEmailLogJSONCustom(email_ctx, js, tx);
188 EveEmailLogJSONMd5(email_ctx, js, tx);
201 return EveEmailLogJsonData(f, smtp_state, tx, tx_id, js);
213 if (extended != NULL) {
228 email_ctx->
fields |= (1ULL << f);
236 email_ctx->
flags = 0;
241 if (strcmp(
"body", field->
val) == 0) {
242 SCLogInfo(
"Going to log the md5 sum of email body");
245 if (strcmp(
"subject", field->
val) == 0) {
246 SCLogInfo(
"Going to log the md5 sum of email subject");