Download raw body.
smtpd: compat fix for sendmail -bs mode
After the switch from Sendmail to smtpd in OpenBSD 5.6, applications using
`sendmail -bs` began to hang as this is handled inappropriately by smtpd.
The definition of -bs in Sendmail parlance:
> Use the SMTP protocol as described in RFC821 on standard input and output.
> This flag implies all the operations of the -ba flag that are compatible
> with SMTP.
Applications calling sendmail -bs will wait on stdin for an SMTP greeting:
220 foo.bar ESMTP Sendmail 8.14.8/8.14.8/Submit; Wed, 30 Apr 2025 19:03:40 GMT
Since smtpd does not support sendmail -bs mode, it shall explicitly reject
the flag and not simply ignore it, because -bs implies a very different
operating mode for the legacy Sendmail binary and any calling application.
Regards
Lloyd
Index: smtpctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/smtpctl.c,v
retrieving revision 1.176
diff -u -p -u -p -r1.176 smtpctl.c
--- smtpctl.c 21 Nov 2024 13:42:22 -0000 1.176
+++ smtpctl.c 3 Jan 2026 05:01:37 -0000
@@ -1115,10 +1115,15 @@ sendmail_compat(int argc, char **argv)
/*
* determine whether we are called with flags
* that should invoke makemap/newaliases.
+ *
+ * explicitly reject unsupported sendmail -bs mode
*/
- for (i = 1; i < argc; i++)
+ for (i = 1; i < argc; i++) {
if (strncmp(argv[i], "-bi", 3) == 0)
exit(makemap(P_SENDMAIL, argc, argv));
+ if (strncmp(argv[i], "-bs", 3) == 0)
+ errx(1, "-bs mode is not supported");
+ }
if (!srv_connect())
offlinefp = offline_file();
smtpd: compat fix for sendmail -bs mode