]> git.pld-linux.org Git - packages/djbdns.git/blame - djbdns-tinydns-include.patch
tinydns-log: add sample to log only fatals and startup messages
[packages/djbdns.git] / djbdns-tinydns-include.patch
CommitLineData
58c2947d 1Patch enables including subdomain data; it is done by following entry in data:
2 Idomain.somewhere:/domain/data.cdb
3Now data for domain.somewhere is looked up in /domain/data.cdb (relative to
4tinydns root dir, /etc/tinydns/root in default setup).
5
6diff -u djbdns-1.05/tdlookup.c djbdns-1.05-include/tdlookup.c
7--- djbdns-1.05/tdlookup.c Sun Feb 11 22:11:45 2001
8+++ djbdns-1.05-include/tdlookup.c Fri May 7 13:10:14 2004
9@@ -42,6 +42,7 @@
10 static unsigned int dpos;
11 static char type[2];
12 static uint32 ttl;
13+static char dfile[512];
14
15 static int find(char *d,int flagwild)
16 {
17@@ -134,6 +135,11 @@
18 if (r == -1) return 0;
19 if (byte_equal(type,2,DNS_T_SOA)) flagauthoritative = 1;
20 if (byte_equal(type,2,DNS_T_NS)) flagns = 1;
21+ if (byte_equal(type,2,"\0\0")) {
22+ if(dlen-dpos>sizeof(dfile)) return 0;
23+ byte_copy(dfile,dlen-dpos,data+dpos);
24+ return 2;
25+ }
26 }
27 if (flagns) break;
28 if (!*control) return 0; /* q is not within our bailiwick */
29@@ -282,10 +288,13 @@
30 {
31 int fd;
32 int r;
33+ int i;
34 char key[6];
35
36 tai_now(&now);
37- fd = open_read("data.cdb");
38+ byte_copy(dfile,9,"data.cdb\0");
39+ for(i=0;i<2;i++) {
40+ fd = open_read(dfile);
41 if (fd == -1) return 0;
42 cdb_init(&c,fd);
43
44@@ -306,5 +315,7 @@
45
46 cdb_free(&c);
47 close(fd);
48+ if(r!=2) break;
49+ }
50 return r;
51 }
52diff -u djbdns-1.05/tinydns-data.c djbdns-1.05-include/tinydns-data.c
53--- djbdns-1.05/tinydns-data.c Sun Feb 11 22:11:45 2001
54+++ djbdns-1.05-include/tinydns-data.c Fri May 7 13:05:25 2004
55@@ -246,7 +246,16 @@
56 if (cdb_make_add(&cdb,key.s,key.len,loc,2) == -1)
57 die_datatmp();
58 break;
59-
60+ case 'I':
61+ if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
62+ if(!stralloc_0(&f[1])) nomem();
63+ ttl=0;
64+ byte_zero(ttd,8);
65+ byte_zero(loc,2);
66+ rr_start("\0\0",ttl,ttd,loc);
67+ rr_add(f[1].s,f[1].len);
68+ rr_finish(d1);
69+ break;
70 case 'Z':
71 if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
72
This page took 0.068746 seconds and 4 git commands to generate.