Download raw body.
mail.lmtp: return EX_TEMPFAIL only on 4.x.x
Hello tech, Gilles,
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 <https://github.com/OpenSMTPD/OpenSMTPD/pull/1277>
except that i've expanded the ternary into an if to not run over 80 columns.
thoughts/oks?
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;
mail.lmtp: return EX_TEMPFAIL only on 4.x.x