diff -ruN djbdns-1.05-factory/Makefile djbdns-1.05-patched/Makefile --- djbdns-1.05-factory/Makefile 2001-02-11 16:11:45.000000000 -0500 +++ djbdns-1.05-patched/Makefile 2007-11-21 18:56:07.000000000 -0500 @@ -733,7 +733,7 @@ rbldns.o: \ compile rbldns.c str.h byte.h ip4.h open.h env.h cdb.h uint32.h dns.h \ stralloc.h gen_alloc.h iopause.h taia.h tai.h uint64.h taia.h dd.h \ -strerr.h response.h uint32.h +strerr.h response.h uint32.h alloc.h ./compile rbldns.c readclose.o: \ diff -ruN djbdns-1.05-factory/rbldns-data.c djbdns-1.05-patched/rbldns-data.c --- djbdns-1.05-factory/rbldns-data.c 2001-02-11 16:11:45.000000000 -0500 +++ djbdns-1.05-patched/rbldns-data.c 2007-11-21 19:03:01.000000000 -0500 @@ -28,6 +28,7 @@ int fdcdb; struct cdb_make cdb; static stralloc tmp; +static stralloc tmp2; static stralloc line; int match = 1; @@ -105,14 +106,29 @@ } if (!stralloc_catb(&tmp,"\0\0\0\0",4)) nomem(); tmp.len = 4; - if (line.s[j] == '/') - scan_ulong(line.s + j + 1,&u); + if (line.s[j] == '/') { + k = scan_ulong(line.s + j + 1,&u); + j += k + 1 ; + } else u = 32; if (u > 32) u = 32; ch = u; if (!stralloc_catb(&tmp,&ch,1)) nomem(); - if (cdb_make_add(&cdb,tmp.s,tmp.len,"",0) == -1) + if ( line.s[j] == ':' ) { + ip[0]=ip[1]=ip[2]=ip[3]=0 ; + j++ ; + j += ip4_scan(line.s+j,ip) ; + if (!stralloc_copyb(&tmp2,ip,4)) nomem(); + if ( line.s[j] == ':' ) { + j ++ ; + if (!stralloc_catb(&tmp2,line.s+j,line.len-j-1)) nomem(); + } + } + else { + if (!stralloc_copyb(&tmp2,"",0)) nomem(); + } + if (cdb_make_add(&cdb,tmp.s,tmp.len,tmp2.s,tmp2.len) == -1) die_datatmp(); break; } diff -ruN djbdns-1.05-factory/rbldns.c djbdns-1.05-patched/rbldns.c --- djbdns-1.05-factory/rbldns.c 2001-02-11 16:11:45.000000000 -0500 +++ djbdns-1.05-patched/rbldns.c 2007-11-21 19:03:01.000000000 -0500 @@ -9,8 +9,10 @@ #include "dd.h" #include "strerr.h" #include "response.h" +#include "alloc.h" -static char *base; +static char **bases; +unsigned int nbases = 0; static struct cdb c; static char key[5]; @@ -33,7 +35,11 @@ if (byte_equal(qtype,2,DNS_T_ANY)) flaga = flagtxt = 1; if (!flaga && !flagtxt) goto REFUSE; - if (dd(q,base,reverseip) != 4) goto REFUSE; + for ( i=0 ; i= 4)) { + if ((dlen=cdb_datalen(&c))>=4) { if (dlen > 100) dlen = 100; if (cdb_read(&c,data,dlen,cdb_datapos(&c)) == -1) return 0; } else { - dlen = 12; - byte_copy(data,dlen,"\177\0\0\2Listed $"); + r = cdb_find(&c,"",0); + if (r == -1) return 0; + if (r && ((dlen = cdb_datalen(&c)) >= 4)) { + if (dlen > 100) dlen = 100; + if (cdb_read(&c,data,dlen,cdb_datapos(&c)) == -1) return 0; + } + else { + dlen = 12; + byte_copy(data,dlen,"\177\0\0\2Listed $"); + } } if ((dlen >= 5) && (data[dlen - 1] == '$')) { @@ -107,10 +119,35 @@ void initialize(void) { char *x; + char *z; + char **names; + int i; x = env_get("BASE"); if (!x) strerr_die2x(111,fatal,"$BASE not set"); - if (!dns_domain_fromdot(&base,x,str_len(x))) - strerr_die2x(111,fatal,"unable to parse $BASE"); + + nbases = 1; + for ( z=x ; *z ; ++z ) + if ( ':' == *z ) + ++nbases; + + bases = alloc ( nbases * sizeof(char*) ) ; + if (!bases) strerr_die2x(111,fatal,"out of memory"); + names = alloc ( nbases * sizeof(char*) ) ; + if (!names) strerr_die2x(111,fatal,"out of memory"); + + names[i=0] = x ; + for ( z=x ; *z ; ++z ) + if ( ':' == *z ) { + *z++ = 0 ; + names[++i] = z ; + } + + for ( i=0 ; i