This tiny patch to rbldns adds records for the root of the zone. That is, if the rbldns zone is bad.example.com, with entries like 3.0.0.127.bad.example.com, you can now also have A and TXT records for plain bad.example.com. I did this for my korea.services.net zone, since potential users keep typing korea.services.net into their web browsers and expecting something useful to happen. There's one new record type in the data file, a line starting with an exclamation point, in the same format as the colon record, e.g. !10.11.12.13:See http://bad.example.com (Unlike in a colon record, a $ at the end of the text isn't special.) No warranty expressed or implied. If you find bugs, feel free to fix them. - John Levine, May 2002 --- patch begins here --- diff -c djbdns-1.05-dist/rbldns-data.c djbdns-1.05/rbldns-data.c *** djbdns-1.05-dist/rbldns-data.c Sun Feb 11 16:11:45 2001 --- djbdns-1.05/rbldns-data.c Sat May 18 20:04:33 2002 *************** *** 89,94 **** --- 89,103 ---- if (cdb_make_add(&cdb,"",0,tmp.s,tmp.len) == -1) die_datatmp(); break; + case '!': /* root entry */ + j = byte_chr(line.s + 1,line.len - 1,':'); + if (j >= line.len - 1) syntaxerror(": missing colon"); + if (ip4_scan(line.s + 1,ip) != j) syntaxerror(": malformed IP address"); + if (!stralloc_copyb(&tmp,ip,4)) nomem(); + if (!stralloc_catb(&tmp,line.s + j + 2,line.len - j - 2)) nomem(); + if (cdb_make_add(&cdb,"R",1,tmp.s,tmp.len) == -1) + die_datatmp(); + break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (!stralloc_0(&line)) nomem(); *** djbdns-1.05-dist/rbldns.c Sun Feb 11 16:11:45 2001 --- djbdns-1.05/rbldns.c Sat May 18 20:20:33 2002 *************** *** 33,39 **** if (byte_equal(qtype,2,DNS_T_ANY)) flaga = flagtxt = 1; if (!flaga && !flagtxt) goto REFUSE; ! if (dd(q,base,reverseip) != 4) goto REFUSE; uint32_unpack(reverseip,&ipnum); uint32_pack_big(ip,ipnum); --- 33,51 ---- if (byte_equal(qtype,2,DNS_T_ANY)) flaga = flagtxt = 1; if (!flaga && !flagtxt) goto REFUSE; ! i = dd(q,base,reverseip); ! if(i == 0) { /* root entry */ ! r = cdb_find(&c,"R",1); ! 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 { ! goto REFUSE; ! } ! } else { ! if (i != 4) goto REFUSE; uint32_unpack(reverseip,&ipnum); uint32_pack_big(ip,ipnum); *************** *** 63,69 **** --dlen; dlen += ip4_fmt(data + dlen,ip); } ! if (flaga) { if (!response_rstart(q,DNS_T_A,2048)) return 0; if (!response_addbytes(data,4)) return 0; --- 75,81 ---- --dlen; dlen += ip4_fmt(data + dlen,ip); } ! } if (flaga) { if (!response_rstart(q,DNS_T_A,2048)) return 0; if (!response_addbytes(data,4)) return 0;