I stumbled across an issue when trying to send mail with opensmtpd by submitting via the unix domain socket, when requesting any kind of DSN, (e.g. mailwrapper(8) based sendmail command's -N param).

Such mail gets refused by smtpd when the unix domain socket in use is the default one, instead of an explicitly specified one in smtpd.conf(5).
Explicitly specifying 'listen on socket' in the config works.

The man page implies that having this listen line in the config or not should come down to the same, but that isn't the case. The default creates a socket that doesn't advertise any DSN extension, whereas specifying it explicitly, does.

At first I thought this might be intentional, however, with an explicit config, it's not possible to disable DSNs, as the 'listen on socket' line doesn't support any no-dsn option, which exists for other listeners.

Find attached a one-line patch that makes the socket created by default behave the same way as when specifying it via the config, explicitly. I think the no-dsn option should also be available for such listeners, however I don't know exactly if this is wanted, so I left that out for now.


--- ./usr.sbin/smtpd/parse.y.orig       2023-11-28 14:12:34.578898000 +0100
+++ ./usr.sbin/smtpd/parse.y    2023-11-28 14:12:41.349092000 +0100
@@ -3136,6 +3136,7 @@
        /* If the socket listener was not configured, create a default one. */
        if (!conf->sc_sock_listener) {
                memset(&listen_opts, 0, sizeof listen_opts);
+               listen_opts.flags |= F_EXT_DSN;

Reply via email to