]> git.pld-linux.org Git - packages/djbdns.git/blame - djbdns-rbldns_a.patch
tinydns-log: add sample to log only fatals and startup messages
[packages/djbdns.git] / djbdns-rbldns_a.patch
CommitLineData
5fc3d591 1This tiny patch to rbldns adds records for the root of the zone. That
2is, if the rbldns zone is bad.example.com, with entries like
33.0.0.127.bad.example.com, you can now also have A and TXT records for
4plain bad.example.com. I did this for my korea.services.net zone,
5since potential users keep typing korea.services.net into their web
6browsers and expecting something useful to happen.
7
8There's one new record type in the data file, a line starting with an
9exclamation point, in the same format as the colon record, e.g.
10
11 !10.11.12.13:See http://bad.example.com
12
13(Unlike in a colon record, a $ at the end of the text isn't special.)
14
15No warranty expressed or implied. If you find bugs, feel free to fix
16them.
17 - John Levine, May 2002
18
19--- patch begins here ---
20
21
185f3145 22diff -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
25***************
26*** 89,94 ****
27--- 89,103 ----
28 if (cdb_make_add(&cdb,"",0,tmp.s,tmp.len) == -1)
29 die_datatmp();
30 break;
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)
38+ die_datatmp();
39+ break;
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();
43
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
46***************
47*** 33,39 ****
48 if (byte_equal(qtype,2,DNS_T_ANY)) flaga = flagtxt = 1;
49 if (!flaga && !flagtxt) goto REFUSE;
50
51! if (dd(q,base,reverseip) != 4) goto REFUSE;
52 uint32_unpack(reverseip,&ipnum);
53 uint32_pack_big(ip,ipnum);
54
55--- 33,51 ----
56 if (byte_equal(qtype,2,DNS_T_ANY)) flaga = flagtxt = 1;
57 if (!flaga && !flagtxt) goto REFUSE;
58
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;
66! }
67! else {
68! goto REFUSE;
69! }
70! } else {
71! if (i != 4) goto REFUSE;
72 uint32_unpack(reverseip,&ipnum);
73 uint32_pack_big(ip,ipnum);
74
75***************
76*** 63,69 ****
77 --dlen;
78 dlen += ip4_fmt(data + dlen,ip);
79 }
80!
81 if (flaga) {
82 if (!response_rstart(q,DNS_T_A,2048)) return 0;
83 if (!response_addbytes(data,4)) return 0;
84--- 75,81 ----
85 --dlen;
86 dlen += ip4_fmt(data + dlen,ip);
87 }
88! }
89 if (flaga) {
90 if (!response_rstart(q,DNS_T_A,2048)) return 0;
91 if (!response_addbytes(data,4)) return 0;
This page took 0.066639 seconds and 4 git commands to generate.