I wrote a patch to enable rhsbl into rblsmtpd
There are 2 new options for rblsmtpd -A && -R
That should work as expected (with domain based lists as
dsn.rfc-ignorant.org)
Maybe it can be usefull for others people ?
Bye
Jean-Eudes ONFRAY
Mediation Telecom
--- rblsmtpd.c.orig Tue Dec 30 15:06:02 2003
+++ rblsmtpd.c Tue Dec 30 16:32:21 2003
@@ -22,11 +22,12 @@
}
void usage(void)
{
- strerr_die1x(100,"rblsmtpd: usage: rblsmtpd [ -b ] [ -R ] [ -t timeout ] [ -r base ] [ -a base ] smtpd [ arg ... ]");
+ strerr_die1x(100,"rblsmtpd: usage: rblsmtpd [ -b ] [ -c ] [ -t timeout ] [ -r base ] [ -a base ] [ -R base ] [ -A base ] smtpd [ arg ... ]");
}
char *ip_env;
static stralloc ip_reverse;
+char *host_env;
void ip_init(void)
{
@@ -36,6 +37,9 @@
ip_env = env_get("TCPREMOTEIP");
if (!ip_env) ip_env = "";
+ host_env = env_get("TCPREMOTEHOST");
+ if (!host_env) host_env = "";
+
if (!stralloc_copys(&ip_reverse,"")) nomem();
i = str_len(ip_env);
@@ -93,6 +97,43 @@
decision = 1;
}
+void rhsbl(char *base)
+{
+ if (decision) return;
+ if (!stralloc_copys(&tmp,host_env)) nomem();
+ if (!stralloc_cats(&tmp,".")) nomem();
+ 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;
+ }
+ return;
+ }
+ if (text.len)
+ if (flagrblbounce)
+ decision = 3;
+ else
+ decision = 2;
+}
+
+void antirhsbl(char *base)
+{
+ if (decision) return;
+ if (!stralloc_copys(&tmp,host_env)) nomem();
+ if (!stralloc_cats(&tmp,".")) nomem();
+ if (!stralloc_cats(&tmp,base)) nomem();
+ if (dns_ip4(&text,&tmp) == -1) {
+ flagmustnotbounce = 1;
+ if (!flagfailclosed)
+ decision = 1;
+ return;
+ }
+ if (text.len)
+ decision = 1;
+}
+
char strnum[FMT_ULONG];
static stralloc message;
@@ -175,7 +216,7 @@
}
}
- while ((opt = getopt(argc,argv,"bBcCt:r:a:")) != opteof)
+ while ((opt = getopt(argc,argv,"bBcCt:r:a:R:A:")) != opteof)
switch(opt) {
case 'b': flagrblbounce = 1; break;
case 'B': flagrblbounce = 0; break;
@@ -184,6 +225,8 @@
case 't': scan_ulong(optarg,&timeout); break;
case 'r': rbl(optarg); flagwantdefaultrbl = 0; break;
case 'a': antirbl(optarg); break;
+ case 'R': rhsbl(optarg); break;
+ case 'A': antirhsbl(optarg); break;
default: usage();
}