Download raw body.
smtpd(8) should add missing date and message id headers also on port 465
This adds a new flag F_SUBMISSION to be used to decide if a listener
is to be operating as an MSA and moves the existing logic deciding this
into where listeners are configured (parse.y).
This could later be extended and used to do more checks or verifications
based on RFC 6409. Only functional difference is that port 465 is handled
the same way as port 587.
Maybe a new listener option msa (!msa) can be introduced in a later step
giving users a chance to control the behaviour themselves and stop
deciding this automatically based on port numbers. No changes to the
smtpd.conf(5) format for now.
Ok?
Index: usr.sbin/smtpd/smtpd.h
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/smtpd.h,v
retrieving revision 1.683
diff -u -p -r1.683 smtpd.h
--- usr.sbin/smtpd/smtpd.h 2 Mar 2024 22:40:28 -0000 1.683
+++ usr.sbin/smtpd/smtpd.h 2 Sep 2024 21:12:51 -0000
@@ -89,6 +89,7 @@
#define F_MASQUERADE 0x1000
#define F_FILTERED 0x2000
#define F_PROXY 0x4000
+#define F_SUBMISSION 0x8000
#define RELAY_TLS_OPPORTUNISTIC 0
#define RELAY_TLS_STARTTLS 1
Index: usr.sbin/smtpd/parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/parse.y,v
retrieving revision 1.299
diff -u -p -r1.299 parse.y
--- usr.sbin/smtpd/parse.y 19 Feb 2024 21:00:19 -0000 1.299
+++ usr.sbin/smtpd/parse.y 2 Sep 2024 21:12:52 -0000
@@ -3363,7 +3363,10 @@ config_listener(struct listener *h, str
if (lo->ssl & F_STARTTLS_REQUIRE)
h->flags |= F_STARTTLS_REQUIRE;
-
+
+ if (h->local || h->port == htons(587) || h->port == htons(465))
+ h->flags |= F_SUBMISSION;
+
if (h != conf->sc_sock_listener)
TAILQ_INSERT_TAIL(conf->sc_listeners, h, entry);
}
Index: usr.sbin/smtpd/smtp_session.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/smtp_session.c,v
retrieving revision 1.442
diff -u -p -r1.442 smtp_session.c
--- usr.sbin/smtpd/smtp_session.c 20 Mar 2024 17:52:43 -0000 1.442
+++ usr.sbin/smtpd/smtp_session.c 2 Sep 2024 21:12:52 -0000
@@ -2624,9 +2624,7 @@ smtp_tx_dataline(struct smtp_tx *tx, con
break;
case RFC5322_END_OF_HEADERS:
- if (tx->session->listener->local ||
- tx->session->listener->port == htons(587)) {
-
+ if (tx->session->listener->flags & F_SUBMISSION) {
if (!tx->has_date) {
log_debug("debug: %p: adding Date", tx);
smtp_message_printf(tx, "Date: %s\n",
smtpd(8) should add missing date and message id headers also on port 465