diff --git a/src/config.h b/src/config.h index 1cc8ad6b..c8c75d64 100644 --- a/src/config.h +++ b/src/config.h @@ -14,7 +14,7 @@ #define VERSION "0.1.25-master-branch" -#define BUILD 849 +#define BUILD 850 #define HOSTID "mailarchiver" diff --git a/src/defs.h b/src/defs.h index fefd6aa6..158d90c6 100644 --- a/src/defs.h +++ b/src/defs.h @@ -187,6 +187,7 @@ struct session_data { char acceptbuf[SMALLBUFSIZE]; char attachments[SMALLBUFSIZE]; char internal_sender, internal_recipient, external_recipient; + uint64 duplicate_id; short int customer_id; int direction; int tls; diff --git a/src/import.c b/src/import.c index b6fee89f..6e79d965 100644 --- a/src/import.c +++ b/src/import.c @@ -119,7 +119,7 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da counters.c_duplicate = 1; update_counters(sdata, data, &counters, cfg); - if(data->quiet == 0)printf("duplicate: %s (id: %s)\n", filename, sdata->ttmpfile); + if(data->quiet == 0) printf("duplicate: %s (duplicate id: %llu)\n", filename, sdata->duplicate_id); break; default: diff --git a/src/message.c b/src/message.c index 881033b1..fe8ba226 100644 --- a/src/message.c +++ b/src/message.c @@ -247,18 +247,17 @@ void remove_stripped_attachments(struct _state *state){ int process_message(struct session_data *sdata, struct _state *state, struct __data *data, struct __config *cfg){ int rc; - uint64 id=0; /* discard if existing message_id */ - id = get_metaid_by_messageid(sdata, data, state->message_id, cfg); + sdata->duplicate_id = get_metaid_by_messageid(sdata, data, state->message_id, cfg); - if(id > 0){ + if(sdata->duplicate_id > 0){ remove_stripped_attachments(state); if(strlen(state->b_journal_to) > 0){ - if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: trying to add journal rcpt (%s) to id=%llu for message-id: '%s'", sdata->ttmpfile, state->b_journal_to, id, state->message_id); - store_recipients(sdata, data, state->b_journal_to, id, 0, cfg); + if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: trying to add journal rcpt (%s) to id=%llu for message-id: '%s'", sdata->ttmpfile, state->b_journal_to, sdata->duplicate_id, state->message_id); + store_recipients(sdata, data, state->b_journal_to, sdata->duplicate_id, 0, cfg); } return ERR_EXISTS; diff --git a/src/misc.c b/src/misc.c index 368689b7..5c381262 100644 --- a/src/misc.c +++ b/src/misc.c @@ -446,6 +446,8 @@ void init_session_data(struct session_data *sdata, struct __config *cfg){ memset(sdata->fromemail, 0, SMALLBUFSIZE); + sdata->duplicate_id = 0; + sdata->restored_copy = 0; sdata->internal_sender = sdata->internal_recipient = sdata->external_recipient = 0; diff --git a/src/session.c b/src/session.c index cc045fdb..0ba98296 100644 --- a/src/session.c +++ b/src/session.c @@ -255,7 +255,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){ counters.c_rcvd++; if(inj == ERR_EXISTS){ - syslog(LOG_PRIORITY, "%s: discarding: duplicate message", sdata.ttmpfile); + syslog(LOG_PRIORITY, "%s: discarding: duplicate message, id: %llu", sdata.ttmpfile, sdata.duplicate_id); counters.c_duplicate++; }