56 #define LOG_EMAIL_DEFAULT 0
57 #define LOG_EMAIL_EXTENDED (1<<0)
58 #define LOG_EMAIL_ARRAY (1<<1)
59 #define LOG_EMAIL_COMMA (1<<2)
60 #define LOG_EMAIL_BODY_MD5 (1<<3)
61 #define LOG_EMAIL_SUBJECT_MD5 (1<<4)
87 static void EveEmailLogJSONMd5(
95 SCMimeSmtpLogSubjectMd5(js, entity);
100 if (entity == NULL) {
103 SCMimeSmtpLogBodyMd5(js, entity);
107 static void EveEmailLogJSONCustom(
112 if (entity == NULL) {
117 if (((email_ctx->
fields & (1ULL<<f)) != 0)
122 SCMimeSmtpLogFieldArray(
125 SCMimeSmtpLogFieldComma(
128 SCMimeSmtpLogFieldString(
138 static bool EveEmailLogJsonData(
139 const Flow *f,
void *state,
void *vtx, uint64_t tx_id, SCJsonBuilder *sjs)
142 MimeStateSMTP *mime_state;
149 if (smtp_state == NULL) {
150 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");