Patch enables including subdomain data; it is done by following entry in data: Idomain.somewhere:/domain/data.cdb Now data for domain.somewhere is looked up in /domain/data.cdb (relative to tinydns root dir, /etc/tinydns/root in default setup). diff -u djbdns-1.05/tdlookup.c djbdns-1.05-include/tdlookup.c --- djbdns-1.05/tdlookup.c Sun Feb 11 22:11:45 2001 +++ djbdns-1.05-include/tdlookup.c Fri May 7 13:10:14 2004 @@ -42,6 +42,7 @@ static unsigned int dpos; static char type[2]; static uint32 ttl; +static char dfile[512]; static int find(char *d,int flagwild) { @@ -134,6 +135,11 @@ if (r == -1) return 0; if (byte_equal(type,2,DNS_T_SOA)) flagauthoritative = 1; if (byte_equal(type,2,DNS_T_NS)) flagns = 1; + if (byte_equal(type,2,"\0\0")) { + if(dlen-dpos>sizeof(dfile)) return 0; + byte_copy(dfile,dlen-dpos,data+dpos); + return 2; + } } if (flagns) break; if (!*control) return 0; /* q is not within our bailiwick */ @@ -282,10 +288,13 @@ { int fd; int r; + int i; char key[6]; tai_now(&now); - fd = open_read("data.cdb"); + byte_copy(dfile,9,"data.cdb\0"); + for(i=0;i<2;i++) { + fd = open_read(dfile); if (fd == -1) return 0; cdb_init(&c,fd); @@ -306,5 +315,7 @@ cdb_free(&c); close(fd); + if(r!=2) break; + } return r; } diff -u djbdns-1.05/tinydns-data.c djbdns-1.05-include/tinydns-data.c --- djbdns-1.05/tinydns-data.c Sun Feb 11 22:11:45 2001 +++ djbdns-1.05-include/tinydns-data.c Fri May 7 13:05:25 2004 @@ -246,7 +246,16 @@ if (cdb_make_add(&cdb,key.s,key.len,loc,2) == -1) die_datatmp(); break; - + case 'I': + if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem(); + if(!stralloc_0(&f[1])) nomem(); + ttl=0; + byte_zero(ttd,8); + byte_zero(loc,2); + rr_start("\0\0",ttl,ttd,loc); + rr_add(f[1].s,f[1].len); + rr_finish(d1); + break; case 'Z': if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();