1 This tiny patch to rbldns adds records for the root of the zone. That
2 is, if the rbldns zone is bad.example.com, with entries like
3 3.0.0.127.bad.example.com, you can now also have A and TXT records for
4 plain bad.example.com. I did this for my korea.services.net zone,
5 since potential users keep typing korea.services.net into their web
6 browsers and expecting something useful to happen.
8 There's one new record type in the data file, a line starting with an
9 exclamation point, in the same format as the colon record, e.g.
11 !10.11.12.13:See http://bad.example.com
13 (Unlike in a colon record, a $ at the end of the text isn't special.)
15 No warranty expressed or implied. If you find bugs, feel free to fix
17 - John Levine, May 2002
19 --- patch begins here ---
22 diff -c djbdns-1.05-dist/rbldns-data.c djbdns-1.05/rbldns-data.c
23 *** djbdns-1.05-dist/rbldns-data.c Sun Feb 11 16:11:45 2001
24 --- djbdns-1.05/rbldns-data.c Sat May 18 20:04:33 2002
28 if (cdb_make_add(&cdb,"",0,tmp.s,tmp.len) == -1)
31 + case '!': /* root entry */
32 + j = byte_chr(line.s + 1,line.len - 1,':');
33 + if (j >= line.len - 1) syntaxerror(": missing colon");
34 + if (ip4_scan(line.s + 1,ip) != j) syntaxerror(": malformed IP address");
35 + if (!stralloc_copyb(&tmp,ip,4)) nomem();
36 + if (!stralloc_catb(&tmp,line.s + j + 2,line.len - j - 2)) nomem();
37 + if (cdb_make_add(&cdb,"R",1,tmp.s,tmp.len) == -1)
40 case '0': case '1': case '2': case '3': case '4':
41 case '5': case '6': case '7': case '8': case '9':
42 if (!stralloc_0(&line)) nomem();
44 *** djbdns-1.05-dist/rbldns.c Sun Feb 11 16:11:45 2001
45 --- djbdns-1.05/rbldns.c Sat May 18 20:20:33 2002
48 if (byte_equal(qtype,2,DNS_T_ANY)) flaga = flagtxt = 1;
49 if (!flaga && !flagtxt) goto REFUSE;
51 ! if (dd(q,base,reverseip) != 4) goto REFUSE;
52 uint32_unpack(reverseip,&ipnum);
53 uint32_pack_big(ip,ipnum);
56 if (byte_equal(qtype,2,DNS_T_ANY)) flaga = flagtxt = 1;
57 if (!flaga && !flagtxt) goto REFUSE;
59 ! i = dd(q,base,reverseip);
60 ! if(i == 0) { /* root entry */
61 ! r = cdb_find(&c,"R",1);
62 ! if (r == -1) return 0;
63 ! if (r && ((dlen = cdb_datalen(&c)) >= 4)) {
64 ! if (dlen > 100) dlen = 100;
65 ! if (cdb_read(&c,data,dlen,cdb_datapos(&c)) == -1) return 0;
71 ! if (i != 4) goto REFUSE;
72 uint32_unpack(reverseip,&ipnum);
73 uint32_pack_big(ip,ipnum);
78 dlen += ip4_fmt(data + dlen,ip);
82 if (!response_rstart(q,DNS_T_A,2048)) return 0;
83 if (!response_addbytes(data,4)) return 0;
86 dlen += ip4_fmt(data + dlen,ip);
90 if (!response_rstart(q,DNS_T_A,2048)) return 0;
91 if (!response_addbytes(data,4)) return 0;