From 5a356f0148cc774b2ea84bdf41dc0b05433f06c3 Mon Sep 17 00:00:00 2001 From: SJ Date: Wed, 20 Jun 2012 10:28:20 +0200 Subject: [PATCH] improved the esmtp parser --- src/session.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/session.c b/src/session.c index c3e15bf0..804caa2d 100644 --- a/src/session.c +++ b/src/session.c @@ -391,14 +391,13 @@ AFTER_PERIOD: state = SMTP_STATE_FINISHED; snprintf(buf, MAXBUFSIZE-1, SMTP_RESP_221_GOODBYE, cfg->hostid); - send(new_sd, buf, strlen(buf), 0); - if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: sent: %s", sdata.ttmpfile, buf); + strncat(resp, buf, MAXBUFSIZE-1); unlink(sdata.ttmpfile); unlink(sdata.tmpframe); if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: removed", sdata.ttmpfile); - goto QUITTING; + continue; } @@ -438,6 +437,10 @@ AFTER_PERIOD: memset(resp, 0, MAXBUFSIZE); } + if(state == SMTP_STATE_FINISHED){ + goto QUITTING; + } + } /* while */ /*