diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-10-12 20:16:32 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-10-12 20:16:32 +0000 |
commit | 2c1d32a27c4e155a45744f5c8a43c647d0d02751 (patch) | |
tree | 21316711d1e373db973bc63c9c7f1dad06b2a5a8 /usr.sbin/smtpd/smtp_session.c | |
parent | 8a51b7165004de1c449b17fe7305a7e74dbd4170 (diff) |
add Date header when a session iniated locally doesn't add one
ok millert@, ok eric@
Diffstat (limited to 'usr.sbin/smtpd/smtp_session.c')
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 2d9aea28a43..d99be447943 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.234 2015/10/02 00:44:30 gilles Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.235 2015/10/12 20:16:31 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -467,6 +467,15 @@ header_missing_callback(const char *header, void *arg) } s->datalen += len; } + + if (strcasecmp(header, "date") == 0) { + len = fprintf(s->ofile, "Date: %s\n", time_to_text(time(NULL))); + if (len == -1) { + s->msgflags |= MF_ERROR_IO; + return; + } + s->datalen += len; + } } static void @@ -535,6 +544,8 @@ smtp_session(struct listener *listener, int sock, dataline_callback, s); if (hostname || listener->local) { + rfc2822_missing_header_callback(&s->rfc2822_parser, "date", + header_missing_callback, s); rfc2822_missing_header_callback(&s->rfc2822_parser, "message-id", header_missing_callback, s); } |