From: chris mikkelson Date: Wed, 25 Mar 2009 04:53:47 +0000 (-0500) Subject: Fixed DATA state machine, and quit response. X-Git-Url: https://git.mikk.net/?a=commitdiff_plain;h=dbe3b1b7742af72b8c3c9e48b854843e37b79933;p=smtpsink Fixed DATA state machine, and quit response. --- diff --git a/smtp.c b/smtp.c index 5035464..7b16300 100644 --- a/smtp.c +++ b/smtp.c @@ -106,6 +106,7 @@ smtpd_data(struct conn *c, char *cmd, int len, int argoff) if (c->state != SMTP_RCPT) return respond(c, err_wantrcpt); c->state = SMTP_DATA; + c->dstate = 2; return respond(c, data_ok); } @@ -147,7 +148,7 @@ static int smtpd_quit(struct conn *c, char *cmd, int len, int argoff) { c->state = SMTP_CLOSED; - return respond(c, quit_ok); + return respond(c, quit_ok, banner_hostname); } static int @@ -194,6 +195,8 @@ do_command(struct conn *c, char *cmd, int len) static int do_smtp(struct conn *c, char **buf, int *len) { + if (*len == 0) return 0; + if (c->state == SMTP_DATA) { char *s; for (s = *buf; s < *buf + *len; s++) { @@ -212,10 +215,11 @@ do_smtp(struct conn *c, char **buf, int *len) continue; case 4: if (*s == '\n') { c->dstate = 5; - break; + continue; } c->dstate = 0; continue; + case 5: break; } break; }