From acbb8396dea49cce77c5e4ab0f56536242c207c8 Mon Sep 17 00:00:00 2001 From: Jacek Masiulaniec Date: Mon, 12 Jan 2009 19:56:28 +0000 Subject: dot escaping, as required by rfc; ok gilles@ --- usr.sbin/smtpd/smtp_session.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'usr.sbin/smtpd/smtp_session.c') 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 @@ -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; -- cgit v1.2.3