diff options
-rw-r--r-- | qmail-smtpd.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/qmail-smtpd.c b/qmail-smtpd.c index 1064008..8c88c4b 100644 --- a/qmail-smtpd.c +++ b/qmail-smtpd.c @@ -62,6 +62,7 @@ void err_bmf() { out("553 sorry, your envelope sender is in my badmailfrom list void err_nogateway() { out("553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)\r\n"); } void err_unimpl(arg) char *arg; { out("502 unimplemented (#5.5.1)\r\n"); } void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); } +void err_relay() { out("553 we don't relay (#5.7.1)\r\n"); } void err_wantmail() { out("503 MAIL first (#5.5.1)\r\n"); } void err_wantrcpt() { out("503 RCPT first (#5.5.1)\r\n"); } void err_noop(arg) char *arg; { out("250 ok\r\n"); } @@ -237,6 +238,21 @@ int addrallowed() return r; } +int addrrelay() +{ + int j; + j = addr.len; + while(--j >= 0) + if (addr.s[j] == '@') break; + if (j < 0) j = addr.len; + while(--j >= 0) { + if (addr.s[j] == '@') return 1; + if (addr.s[j] == '%') return 1; + if (addr.s[j] == '!') return 1; + } + return 0; +} + int seenmail = 0; int flagbarf; /* defined if seenmail */ @@ -283,6 +299,7 @@ void smtp_mail(arg) char *arg; void smtp_rcpt(arg) char *arg; { if (!seenmail) { err_wantmail(); return; } if (!addrparse(arg)) { err_syntax(); return; } + if (addrrelay()) { err_relay(); return; } if (flagbarf) { err_bmf(); return; } if (relayclient) { --addr.len; |