Hello,
I am re-posting this diff here as bugs@opensmtpd doesn't seem to be
operational (message bounced) and it didn't get visibility on tech@.
There is a bug in OpenSMTPD's implementation of sendmail compatibility.
The OpenSMTPD sendmail binary will quietly ignore any unsupported switches.
However, the -bs switch implies a very different mode, SMTP over stdin.
This can cause some programs (notably Alpine) to hang awaiting a response,
as opposed to returning an error immediately if the switch was rejected.
This has been mitigated in OpenBSD Alpine with a config change to the port
to use TCP/IP locally instead of sendmail; however, the compat bug in smtpctl
still remains. The bug is also present in the Linux port of OpenSMTPD, if
using Alpine with OpenSMPTD as the local MTA. (Postfix and Sendmail work
without error.)
Regards
Lloyd
> > 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();
> >
> >