blob: 2ef8612e229cdeb424e8cce00608be45b63c71d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
--- qmail-1.03.orig/qmail-smtpd.c 2005-01-05 23:08:02.724271992 +0100
+++ qmail-1.03/qmail-smtpd.c 2005-01-05 23:09:00.374507824 +0100
@@ -94,6 +94,7 @@
#endif
void err_unimpl() { 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() { out("250 ok\r\n"); }
@@ -331,6 +332,20 @@
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 flagbarfbmf; /* defined if seenmail */
@@ -451,6 +466,7 @@
void smtp_rcpt(arg) char *arg; {
if (!seenmail) { err_wantmail(); return; }
if (!addrparse(arg)) { err_syntax(); return; }
+ if (addrrelay()) { err_relay(); return; }
if (flagbarfbhelo) {
strerr_warn4("qmail-smtpd: badhelo: <",helohost.s,"> at ",remoteip,0);
err_bhelo();
|