-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathucspi-tcp-04182004.patch
96 lines (88 loc) · 2.7 KB
/
ucspi-tcp-04182004.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
ucspi-tcp-toaster-04182004.patch
Nick Hemmesch <[email protected]> Apr 18, 2004
This patch fixes errno.h error, adds extended rblsmtpd support
and increases rblsmtpd text length from 200 to 500 characters.
This patch was made for Qmail Toaster <http://www.qmailtoaster.com>
but the changes are fairly generic and should be compatible with
most installs.
diff -Naur ./error.h ../ucspi-tcp-0.88/error.h
--- ./error.h 2000-03-18 10:18:42.000000000 -0500
+++ ../ucspi-tcp-0.88/error.h 2004-01-23 11:34:47.000000000 -0500
@@ -1,7 +1,7 @@
#ifndef ERROR_H
#define ERROR_H
-extern int errno;
+#include <errno.h>
extern int error_intr;
extern int error_nomem;
diff -Naur ./rblsmtpd.c ../ucspi-tcp-0.88/rblsmtpd.c
--- ./rblsmtpd.c 2000-03-18 10:18:42.000000000 -0500
+++ ../ucspi-tcp-0.88/rblsmtpd.c 2004-01-23 11:37:24.000000000 -0500
@@ -60,16 +60,54 @@
void rbl(char *base)
{
+ int i;
+ char *altreply = 0;
if (decision) return;
if (!stralloc_copy(&tmp,&ip_reverse)) nomem();
+ i = str_chr(base, ':');
+ if (base[i]) {
+ base[i] = 0;
+ altreply = base+i+1;
+ }
if (!stralloc_cats(&tmp,base)) nomem();
- if (dns_txt(&text,&tmp) == -1) {
- flagmustnotbounce = 1;
- if (flagfailclosed) {
- if (!stralloc_copys(&text,"temporary RBL lookup error")) nomem();
- decision = 2;
+ if (altreply) {
+ if (dns_ip4(&text,&tmp) == -1) {
+ flagmustnotbounce = 1;
+ if (flagfailclosed) {
+ if (!stralloc_copys(&text,"temporary RBL lookup error")) nomem();
+ decision = 2;
+ }
+ return;
+ }
+ if (text.len) {
+ if(!stralloc_copys(&text, "")) nomem();
+ while(*altreply) {
+ char *x;
+ i = str_chr(altreply, '%');
+ if(!stralloc_catb(&text, altreply, i)) nomem();
+ if(altreply[i] &&
+ altreply[i+1]=='I' &&
+ altreply[i+2]=='P' &&
+ altreply[i+3]=='%') {
+ if(!stralloc_catb(&text, ip_env, str_len(ip_env))) nomem();
+ altreply+=i+4;
+ } else if(altreply[i]) {
+ if(!stralloc_cats(&text, "%")) nomem();
+ altreply+=i+1;
+ } else {
+ altreply+=i;
+ }
+ }
+ }
+ } else {
+ if (dns_txt(&text,&tmp) == -1) {
+ flagmustnotbounce = 1;
+ if (flagfailclosed) {
+ if (!stralloc_copys(&text,"temporary RBL lookup error")) nomem();
+ decision = 2;
+ }
+ return;
}
- return;
}
if (text.len)
if (flagrblbounce)
@@ -125,7 +163,7 @@
else
if (!stralloc_copys(&message,"553 ")) nomem();
- if (text.len > 200) text.len = 200;
+ if (text.len > 500) text.len = 500;
if (!stralloc_cat(&message,&text)) nomem();
for (i = 0;i < message.len;++i)
if ((message.s[i] < 32) || (message.s[i] > 126))