From 7fc7f1aaaedca2f8868b97b9231d465777a047ae Mon Sep 17 00:00:00 2001 From: gilles Date: Mon, 12 Oct 2015 20:16:31 +0000 Subject: [PATCH] add Date header when a session iniated locally doesn't add one ok millert@, ok eric@ --- usr.sbin/smtpd/smtp_session.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 @@ -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); } -- 2.20.1