diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-01-12 19:56:28 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-01-12 19:56:28 +0000 |
commit | acbb8396dea49cce77c5e4ab0f56536242c207c8 (patch) | |
tree | aa61d417ab53bf134d6dc711da8c7f61b5c94b34 /usr.sbin/smtpd/smtp_session.c | |
parent | 804baf80997663515e2df25cec9c289468eded8a (diff) |
dot escaping, as required by rfc; ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/smtp_session.c')
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 12 |
1 files changed, 10 insertions, 2 deletions
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; |