From: gilles@poolp.org Subject: Re: mail.lmtp: return EX_TEMPFAIL only on 4.x.x To: op@omarpolo.com, tech@openbsd.org Date: Fri, 04 Apr 2025 20:06:55 +0000 April 3, 2025 8:16 PM, op@omarpolo.com wrote: > Hello tech, Gilles, > Hellow, > This fixes an issue reported by runxiyu on #opensmtpd on irc, and also > on the -portable repository on github. > > We're currently always returning a tempfail regardless of what the lmtp > server says; I believe that we should forward a permfail as well. > > This is the same diff as > except that i've expanded the ternary into an if to not run over 80 columns. > > thoughts/oks? > This reads ok to me > diff /usr/src > path + /usr/src > commit - f3da64206be0d25ac3918cef310a098b8dd037b2 > blob - d460f4ca8c19e5406271cf1515d6a31fdc3eeb47 > file + usr.sbin/smtpd/mail.lmtp.c > --- usr.sbin/smtpd/mail.lmtp.c > +++ usr.sbin/smtpd/mail.lmtp.c > @@ -261,8 +261,12 @@ lmtp_engine(int fd_read, struct session *session) > (line[3] != ' ' && line[3] != '-')) > errx(EX_TEMPFAIL, "LMTP server sent an invalid line"); > > - if (line[0] != (phase == PHASE_DATA ? '3' : '2')) > - errx(EX_TEMPFAIL, "LMTP server error: %s", line); > + if (line[0] != (phase == PHASE_DATA ? '3' : '2')) { > + int code = EX_TEMPFAIL; > + if (line[0] != '4') > + code = EX_UNAVAILABLE; > + errx(code, "LMTP server error: %s", line); > + } > > if (line[3] == '-') > continue;