diff --git a/src/defs.h b/src/defs.h index 971089cd..38960e92 100644 --- a/src/defs.h +++ b/src/defs.h @@ -196,7 +196,7 @@ struct session_data { int direction; int tls; int spam_message; - int fd, hdr_len, tot_len, num_of_rcpt_to, rav; + int fd, hdr_len, tot_len, store_len, num_of_rcpt_to, rav; int need_scan; float __acquire, __parsed, __av, __store, __compress, __encrypt; char bodydigest[2*DIGEST_LENGTH+1]; diff --git a/src/misc.c b/src/misc.c index 5e72d109..1327acf9 100644 --- a/src/misc.c +++ b/src/misc.c @@ -455,6 +455,7 @@ void init_session_data(struct session_data *sdata, struct __config *cfg){ sdata->hdr_len = 0; sdata->tot_len = 0; + sdata->store_len = 0; sdata->num_of_rcpt_to = 0; sdata->ms_journal = 0; diff --git a/src/session.c b/src/session.c index c8a6d730..1e045317 100644 --- a/src/session.c +++ b/src/session.c @@ -268,7 +268,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){ (sdata.__acquire+sdata.__parsed+sdata.__av+sdata.__compress+sdata.__encrypt+sdata.__store)/1000000.0, sdata.__acquire/1000000.0, sdata.__parsed/1000000.0, sdata.__av/1000000.0, sdata.__compress/1000000.0, sdata.__encrypt/1000000.0, sdata.__store/1000000.0); - syslog(LOG_PRIORITY, "%s: from=%s, size=%d, attachments=%d, reference=%s, message-id=%s, retention=%d, %s, status=%s", sdata.ttmpfile, sdata.fromemail, sdata.tot_len, sstate.n_attachments, sstate.reference, sstate.message_id, sstate.retention, delay, status); + syslog(LOG_PRIORITY, "%s: from=%s, size=%d/%d, attachments=%d, reference=%s, message-id=%s, retention=%d, %s, status=%s", sdata.ttmpfile, sdata.fromemail, sdata.tot_len, sdata.store_len, sstate.n_attachments, sstate.reference, sstate.message_id, sstate.retention, delay, status); diff --git a/src/store.c b/src/store.c index 75b280c2..7efc6f2f 100644 --- a/src/store.c +++ b/src/store.c @@ -156,8 +156,9 @@ int store_file(struct session_data *sdata, char *filename, int startpos, int len writelen = dstlen; } - if(n == writelen){ + if(n > 0 && n == writelen){ ret = 1; + sdata->store_len += writelen; if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: stored '%s' %d/%d bytes", sdata->ttmpfile, filename, len, writelen); } else {