updated on Mon Jan 16 00:01:41 UTC 2012
[aur-mirror.git] / qmail / qmtpd-badmailfrom-1.1.patch
blobbb789b0dd1ff055460fe75fb7e6c75ec7c88ab04
1 --- /tmp/qmail-1.03/qmail-qmtpd.c Mon Jun 15 12:53:16 1998
2 +++ qmail-1.03/qmail-qmtpd.c Wed Jan 10 20:39:07 2001
3 @@ -11,6 +11,7 @@
4 #include "readwrite.h"
5 #include "control.h"
6 #include "received.h"
7 +#include "constmap.h"
9 void badproto() { _exit(100); }
10 void resources() { _exit(111); }
11 @@ -57,6 +58,22 @@
12 if (ch != ',') badproto();
15 +int flagbarf;
16 +int bmfok = 0;
17 +stralloc bmf = {0};
18 +struct constmap mapbmf;
20 +int bmfcheck(buf,len) char *buf; int len;
22 + int j;
23 + if (!bmfok) return 0;
24 + if (constmap(&mapbmf,buf,len)) return 1;
25 + j = byte_rchr(buf,len,'@');
26 + if (j < len)
27 + if (constmap(&mapbmf,buf + j,len - j)) return 1;
28 + return 0;
31 unsigned int databytes = 0;
32 unsigned int bytestooverflow = 0;
33 struct qmail qq;
34 @@ -96,6 +113,12 @@
36 if (control_init() == -1) resources();
37 if (rcpthosts_init() == -1) resources();
39 + bmfok = control_readfile(&bmf,"control/badmailfrom",0);
40 + if (bmfok == -1) resources();
41 + if (bmfok)
42 + if (!constmap_init(&mapbmf,bmf.s,bmf.len,0)) resources();
44 relayclient = env_get("RELAYCLIENT");
45 relayclientlen = relayclient ? str_len(relayclient) : 0;
47 @@ -181,6 +204,9 @@
49 flagbother = 0;
50 qmail_from(&qq,buf);
52 + flagbarf = bmfcheck(buf,len);
54 if (!flagsenderok) qmail_fail(&qq);
56 biglen = getlen();
57 @@ -216,7 +242,9 @@
58 case -1: resources();
59 case 0: failure.s[failure.len - 1] = 'D';
63 + if (flagbarf) { failure.s[failure.len -1] = 'B'; }
65 if (!failure.s[failure.len - 1]) {
66 qmail_to(&qq,buf);
67 flagbother = 1;
68 @@ -257,6 +285,9 @@
69 break;
70 case 'D':
71 substdio_puts(&ssout,"66:Dsorry, that domain isn't in my list of allowed rcpthosts (#5.7.1),");
72 + break;
73 + case 'B':
74 + substdio_puts(&ssout,"63:Dsorry, your envelope sender is in my badmailfrom list (#5.7.1),");
75 break;
76 default:
77 substdio_puts(&ssout,"46:Dsorry, I can't handle that recipient (#5.1.3),");
78 --- /tmp/qmail-1.03/qmail-qmtpd.8 Mon Jun 15 12:53:16 1998
79 +++ qmail-1.03/qmail-qmtpd.8 Wed Jan 10 21:08:15 2001
80 @@ -19,6 +19,7 @@
81 .IR rcpthosts ,
82 .IR morercpthosts ,
83 .BR RELAYCLIENT ,
84 +.IR badmailfrom ,
85 .IR databytes ,
86 and
87 .B DATABYTES
88 --- /tmp/qmail-1.03/qmail-control.9 Mon Jun 15 12:53:16 1998
89 +++ qmail-1.03/qmail-control.9 Wed Jan 10 21:08:21 2001
90 @@ -40,7 +40,7 @@
91 .ta 5c 10c
92 control default used by
94 -.I badmailfrom \fR(none) \fRqmail-smtpd
95 +.I badmailfrom \fR(none) \fRqmail-smtpd, qmail-qmtpd
96 .I bouncefrom \fRMAILER-DAEMON \fRqmail-send
97 .I bouncehost \fIme \fRqmail-send
98 .I concurrencylocal \fR10 \fRqmail-send