summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/smtpd/mta.c10
-rw-r--r--usr.sbin/smtpd/smtp_session.c12
2 files changed, 19 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index 4f3bf21f67a..3432a27daf2 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.12 2009/01/01 16:15:47 jacekm Exp $ */
+/* $OpenBSD: mta.c,v 1.13 2009/01/12 19:56:27 jacekm Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -769,6 +769,14 @@ mta_write_handler(struct bufferevent *bev, void *arg)
lbuf[len] = '\0';
buf = lbuf;
}
+
+ /* "If first character of the line is a period, one
+ * additional period is inserted at the beginning."
+ * [4.5.2]
+ */
+ if (*buf == '.')
+ evbuffer_add_printf(batchp->bev->output, ".");
+
evbuffer_add_printf(batchp->bev->output, "%s\r\n", buf);
free(lbuf);
lbuf = NULL;
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index da5a61dc90b..a1ca0cb1b74 100644
--- a/usr.sbin/smtpd/smtp_session.c
+++ b/usr.sbin/smtpd/smtp_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp_session.c,v 1.39 2009/01/04 00:58:59 gilles Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.40 2009/01/12 19:56:27 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -818,7 +818,7 @@ read:
int
session_read_data(struct session *s, char *line, size_t nread)
{
- size_t len = strlen(line);
+ size_t len;
size_t i;
if (strcmp(line, ".") == 0) {
@@ -849,6 +849,14 @@ session_read_data(struct session *s, char *line, size_t nread)
return 0;
}
+ /* "If the first character is a period and there are other characters
+ * on the line, the first character is deleted." [4.5.2]
+ */
+ if (*line == '.')
+ line++;
+
+ len = strlen(line);
+
if (fwrite(line, len, 1, s->s_msg.datafp) != 1 ||
fwrite("\n", 1, 1, s->s_msg.datafp) != 1) {
s->s_msg.status |= S_MESSAGE_TEMPFAILURE;