From 22d9828e8f284b82c337483cfcd253c2fac9985d Mon Sep 17 00:00:00 2001 From: SJ Date: Sun, 2 Dec 2012 17:17:41 +0100 Subject: [PATCH] fixed an smtp chat bug related to multiple transactions --- src/config.h | 2 +- src/session.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/config.h b/src/config.h index 92295abd..c1821a4d 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "0.1.22" -#define BUILD 732 +#define BUILD 734 #define HOSTID "mailarchiver" diff --git a/src/session.c b/src/session.c index 4524d141..f9ee9847 100644 --- a/src/session.c +++ b/src/session.c @@ -357,10 +357,20 @@ AFTER_PERIOD: if(strncasecmp(buf, SMTP_CMD_MAIL_FROM, strlen(SMTP_CMD_MAIL_FROM)) == 0){ - if(state != SMTP_STATE_HELO){ + if(state != SMTP_STATE_HELO && state != SMTP_STATE_PERIOD){ strncat(resp, SMTP_RESP_503_ERR, MAXBUFSIZE-1); - } + } else { + + if(state == SMTP_STATE_PERIOD){ + if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: initiated new transaction", sdata.ttmpfile); + + unlink(sdata.ttmpfile); + unlink(sdata.tmpframe); + + init_session_data(&sdata); + } + state = SMTP_STATE_MAIL_FROM; snprintf(sdata.mailfrom, SMALLBUFSIZE-1, "%s\r\n", buf);