-
Notifications
You must be signed in to change notification settings - Fork 2
/
qmail-smtpd-spf-qq-reject-logging.patch
65 lines (63 loc) · 2.18 KB
/
qmail-smtpd-spf-qq-reject-logging.patch
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--- ../qmail-1.03/qmail-smtpd.c 2006-11-26 07:47:35.000000000 +0300
+++ qmail-smtpd.c 2006-12-05 03:41:50.000000000 +0300
@@ -582,7 +582,11 @@
void smtp_rcpt(arg) char *arg; {
if (!seenmail) { err_wantmail(); return; }
if (!addrparse(arg)) { err_syntax(); return; }
- if (flagbarfspf) { err_spf(); return; }
+ if (flagbarfspf) {
+ strerr_warn6("qmail-smtpd: spf-reject: HELO(",helohost.s,") from ",remoteip,". MAILFROM:",mailfrom.s,0);
+ err_spf();
+ return;
+ }
if (flagbarfbhelo) {
strerr_warn4("qmail-smtpd: badhelo: <",helohost.s,"> at ",remoteip,0);
err_bhelo();
@@ -841,21 +845,37 @@
qqx = qmail_close(&qqt);
if (!*qqx) { acceptmessage(qp); return; }
- if (hops) { out("554 too many hops, this message is looping (#5.4.6)\r\n"); return; }
- if (databytes) if (!bytestooverflow) { err_size(); return; }
+ if (hops) {
+ strerr_warn5("qmail-smtpd: looping-reject: MAILFROM:<",mailfrom.s,"> RCPTTO:<",rcptto.s+1,">",0);
+ out("554 too many hops, this message is looping (#5.4.6)\r\n");
+ return;
+ }
+ if (databytes) if (!bytestooverflow) {
+ strerr_warn5("qmail-smtpd: oversized-reject: MAILFROM:<",mailfrom.s,"> RCPTTO:<",rcptto.s+1,">",0);
+ err_size();
+ return;
+ }
if (flagmimetype == -1) {
+ strerr_warn5("qmail-smtpd: bad-mime-reject: MAILFROM:<",mailfrom.s,"> RCPTTO:<",rcptto.s+1,">",0);
out("554 invalid message content ");
if (reply554) out(reply554);
out(" (#5.3.2)\r\n");
return;
}
if (flagloadertype == -1) {
+ strerr_warn5("qmail-smtpd: bad-loader-reject: MAILFROM:<",mailfrom.s,"> RCPTTO:<",rcptto.s+1,">",0);
out("554 invalid message content ");
if (reply554) out(reply554);
out(" (#5.3.2)\r\n");
return;
}
- if (*qqx == 'D') out("554 "); else out("451 ");
+ if (*qqx == 'D') {
+ strerr_warn6("qmail-smtpd: qq hard reject (",qqx+1,"): MAILFROM:<",mailfrom.s,"> RCPTTO:",rcptto.s+1,0);
+ out("554 ");
+ } else {
+ strerr_warn6("qmail-smtpd: qq soft reject (",qqx+1,"): MAILFROM:<",mailfrom.s,"> RCPTTO:",rcptto.s+1,0);
+ out("451 ");
+ }
out(qqx + 1);
out("\r\n");
}
@@ -1337,7 +1357,7 @@
, { 0, err_unimpl, flush }
} ;
-void main(argc,argv)
+int main(argc,argv)
int argc;
char **argv;
{