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");
156 SCLogDebug(
"lets go mime_state %p", mime_state);
162 if ((mime_state != NULL)) {
163 SCMimeSmtpLogData(sjs, mime_state);
172 void *state,
void *vtx, uint64_t tx_id)
176 SCJsonBuilderMark mark = { 0, 0, 0 };
178 SCJbGetMark(js, &mark);
179 SCJbOpenObject(js,
"email");
180 if (!EveEmailLogJsonData(f, state, vtx, tx_id, js)) {
181 SCJbRestoreMark(js, &mark);
186 EveEmailLogJSONCustom(email_ctx, js, tx);
189 EveEmailLogJSONMd5(email_ctx, js, tx);
202 return EveEmailLogJsonData(f, smtp_state, tx, tx_id, js);
214 if (extended != NULL) {
229 email_ctx->
fields |= (1ULL << f);
237 email_ctx->
flags = 0;
242 if (strcmp(
"body", field->
val) == 0) {
243 SCLogInfo(
"Going to log the md5 sum of email body");
246 if (strcmp(
"subject", field->
val) == 0) {
247 SCLogInfo(
"Going to log the md5 sum of email subject");