djbdnscurve6  38
djbdnscurve6
tinydns-data.c
Go to the documentation of this file.
1 #include <unistd.h>
2 #include <sys/types.h>
3 #include <sys/stat.h>
4 #include "uint_t.h"
5 #include "str.h"
6 #include "byte.h"
7 #include "fmt.h"
8 #include "ip.h"
9 #include "exit.h"
10 #include "case.h"
11 #include "scan.h"
12 #include "buffer.h"
13 #include "logmsg.h"
14 #include "getln.h"
15 #include "cdbmake.h"
16 #include "stralloc.h"
17 #include "open.h"
18 #include "dns.h"
19 #include <stdio.h>
20 
21 #define TTL_NS 259200
22 #define TTL_POSITIVE 86400
23 #define TTL_NEGATIVE 2560
24 
25 #define WHO "tinydns-data"
26 
27 int rename(const char *,const char *); // keep compiler silent
28 
29 void die_datatmp(void)
30 {
31  logmsg(WHO,111,FATAL,"unable to create data.tmp");
32 }
33 
34 void nomem(void)
35 {
36  logmsg(WHO,111,FATAL,"nomem");
37 }
38 
39 void ttdparse(stralloc *sa,char ttd[8])
40 {
41  unsigned int i;
42  char ch;
43 
44  byte_zero(ttd,8);
45  for (i = 0; (i < 16) && (i < sa->len); ++i) {
46  ch = sa->s[i];
47  if ((ch >= '0') && (ch <= '9'))
48  ch -= '0';
49  else if ((ch >= 'a') && (ch <= 'f'))
50  ch -= 'a' - 10;
51  else
52  ch = 0;
53  if (!(i & 1)) ch <<= 4;
54  ttd[i >> 1] |= ch;
55  }
56 }
57 
58 void locparse(stralloc *sa,char loc[2])
59 {
60  loc[0] = (sa->len > 0) ? sa->s[0] : 0;
61  loc[1] = (sa->len > 1) ? sa->s[1] : 0;
62 }
63 
64 void ipprefix_cat(stralloc *out,char *s)
65 {
66  uint32_t u;
67  char ch;
68  uint32_t j;
69 
70  if (*s == 's') {
71  ++s;
72  if (!stralloc_catb(out,"s",1) || !stralloc_cats(out,s)) nomem();
73  } else {
74  if (*s == 'f') ++s;
75  if (!stralloc_catb(out,"f",1)) nomem();
76  for (;;)
77  if (*s == '.') ++s;
78  else {
79  j = scan_ulong(s,&u);
80  if (!j) return;
81  s += j;
82  ch = u;
83  if (!stralloc_catb(out,&ch,1)) nomem();
84  }
85  }
86 }
87 
88 void hexparse(stralloc *sa)
89 {
90  char ch, lo;
91  unsigned int i;
92  unsigned int j;
93 
94  j = 0;
95  i = 0;
96  while (i < sa->len) {
97  ch = sa->s[i++];
98  if ((ch >= '0') && (ch <= '9')) ch -= 48;
99  if ((ch >= 'a') && (ch <= 'f')) ch -= 87;
100  ch <<= 4;
101  lo = sa->s[i++];
102  if ((lo >= '0') && (lo <= '9')) lo -= 48;
103  if ((lo >= 'a') && (lo <= 'f')) lo -= 87;
104  ch += lo;
105  sa->s[j++] = ch;
106  }
107  sa->len = j;
108 }
109 
110 void txtparse(stralloc *sa)
111 {
112  char ch;
113  unsigned int i;
114  unsigned int j;
115 
116  j = 0;
117  i = 0;
118  while (i < sa->len) {
119  ch = sa->s[i++];
120  if (ch == '\\') {
121  if (i >= sa->len) break;
122  ch = sa->s[i++];
123  if ((ch >= '0') && (ch <= '7')) {
124  ch -= '0';
125  if ((i < sa->len) && (sa->s[i] >= '0') && (sa->s[i] <= '7')) {
126  ch <<= 3;
127  ch += sa->s[i++] - '0';
128  if ((i < sa->len) && (sa->s[i] >= '0') && (sa->s[i] <= '7')) {
129  ch <<= 3;
130  ch += sa->s[i++] - '0';
131  }
132  }
133  }
134  }
135  sa->s[j++] = ch;
136  }
137  sa->len = j;
138 }
139 
140 void textparse(stralloc *sa)
141 {
142  char ch;
143  unsigned int i;
144  unsigned int j;
145 
146  j = 0;
147  i = 0;
148  while (i < sa->len) {
149  ch = sa->s[i++];
150  if (ch >= ' ' && ch <= '~')
151  { sa->s[j] = ch; j++; }
152  }
153  sa -> s[j] = '\0';
154  sa->len = j ;
155 }
156 
157 char defaultsoa[20];
158 
160 {
161  struct stat st;
162  if (fstat(fd,&st) == -1)
163  logmsg(WHO,111,FATAL,"unable to stat data");
164  uint32_pack_big(defaultsoa,st.st_mtime);
165  if (byte_equal(defaultsoa,4,"\0\0\0\0"))
166  defaultsoa[3] = 1;
167  byte_copy(defaultsoa + 4,16,"\0\0\100\000\0\0\010\000\0\020\000\000\0\0\012\000");
168 }
169 
170 int fdcdb;
171 struct cdb_make cdb;
172 static stralloc key;
173 static stralloc result;
174 
175 void rr_add(const char *buf,unsigned int len)
176 {
177  if (!stralloc_catb(&result,buf,len)) nomem();
178 }
179 
180 void rr_addname(const char *d)
181 {
183 }
184 
185 void rr_start(const char type[2],unsigned long ttl,const char ttd[8],const char loc[2])
186 {
187  char buf[4];
188  if (!stralloc_copyb(&result,type,2)) nomem();
189  if (byte_equal(loc,2,"\0\0"))
190  rr_add("=",1);
191  else {
192  rr_add(">",1);
193  rr_add(loc,2);
194  }
195  uint32_pack_big(buf,ttl);
196  rr_add(buf,4);
197  rr_add(ttd,8);
198 }
199 
200 void rr_finish(const char *owner)
201 {
202  if (byte_equal(owner,2,"\1*")) {
203  owner += 2;
204  result.s[2] -= 19;
205  }
206  if (!stralloc_copyb(&key,owner,dns_domain_length(owner))) nomem();
207  case_lowerb(key.s,key.len);
208  if (cdb_make_add(&cdb,key.s,key.len,result.s,result.len) == -1)
209  die_datatmp();
210 }
211 
212 buffer b;
213 char bspace[1024];
214 
215 static stralloc line;
216 int match = 1;
217 unsigned long linenum = 0;
218 
219 #define NUMFIELDS 15
220 static stralloc f[NUMFIELDS];
221 
222 static char *d1;
223 static char *d2;
226 
227 char strnum[FMT_ULONG];
228 
229 void syntaxerror(const char *why)
230 {
231  strnum[fmt_ulong(strnum,linenum)] = 0;
232  logmsg(WHO,111,FATAL,B("unable to parse data line: ",strnum,why));
233 }
234 
235 static unsigned int scan_u32(const char *s,uint32 *u)
236 {
237  unsigned long l;
238  unsigned int r = scan_ulong(s,&l);
239  if ((uint32)l != l) return 0;
240  if (r) *u=l;
241  return r;
242 }
243 
244 int main()
245 {
246  int fddata;
247  int i;
248  int j;
249  int k;
250  char ch;
251  char ttd[8];
252  char loc[2];
253  char ip4[4];
254  char ip6[16];
255  char type[2];
256  char soa[20];
257  char buf[4];
258  uint32_t ttl, u;
259  unsigned char us, sl, ty;
260  umask(022);
261 
262  fddata = open_read("data");
263  if (fddata == -1)
264  logmsg(WHO,111,FATAL,"unable to open data");
265 
266  defaultsoa_init(fddata);
267  buffer_init(&b,buffer_unixread,fddata,bspace,sizeof(bspace));
268 
269  fdcdb = open_trunc("data.tmp");
270  if (fdcdb == -1) die_datatmp();
271  if (cdb_make_start(&cdb,fdcdb) == -1) die_datatmp();
272 
273  while (match) {
274  ++linenum;
275  if (getln(&b,&line,&match,'\n') == -1)
276  logmsg(WHO,111,FATAL,"unable to read line");
277 
278  while (line.len) {
279  ch = line.s[line.len - 1];
280  if ((ch != ' ') && (ch != '\t') && (ch != '\n')) break;
281  --line.len;
282  }
283  if (!line.len) continue;
284  if (line.s[0] == '#') continue;
285  if (line.s[0] == '-') continue;
286 
287  /* Tokenization of input fields; delimitor: | */
288 
289 // j = 1;
290  for (j = 1, i = 0; i < NUMFIELDS; ++i) {
291  if (j >= line.len) {
292  if (!stralloc_copys(&f[i],"")) nomem();
293  }
294  else {
295  k = byte_chr(line.s + j,line.len - j,'|');
296  if (!stralloc_copyb(&f[i],line.s + j,k)) nomem();
297  j += k + 1;
298  }
299  }
300 
301  switch (line.s[0]) {
302 
303  case '%': /* local extension */
304  locparse(&f[0],loc);
305  if (!stralloc_copyb(&key,"\0%",2)) nomem();
306  if (!stralloc_0(&f[1])) nomem();
307  ipprefix_cat(&key,f[1].s);
308  if (cdb_make_add(&cdb,key.s,key.len,loc,2) == -1)
309  die_datatmp();
310  break;
311 
312  case 'Z': /* SOA records */
313  if (dns_domain_fromdot(&d1,f[0].s,f[0].len) <= 0) nomem();
314 
315  if (!stralloc_0(&f[3])) nomem();
316  if (!scan_u32(f[3].s,&u)) uint32_unpack_big(defaultsoa,&u);
317  uint32_pack_big(soa,u);
318  if (!stralloc_0(&f[4])) nomem();
319  if (!scan_u32(f[4].s,&u)) uint32_unpack_big(defaultsoa + 4,&u);
320  uint32_pack_big(soa + 4,u);
321  if (!stralloc_0(&f[5])) nomem();
322  if (!scan_u32(f[5].s,&u)) uint32_unpack_big(defaultsoa + 8,&u);
323  uint32_pack_big(soa + 8,u);
324  if (!stralloc_0(&f[6])) nomem();
325  if (!scan_u32(f[6].s,&u)) uint32_unpack_big(defaultsoa + 12,&u);
326  uint32_pack_big(soa + 12,u);
327  if (!stralloc_0(&f[7])) nomem();
328  if (!scan_u32(f[7].s,&u)) uint32_unpack_big(defaultsoa + 16,&u);
329  uint32_pack_big(soa + 16,u);
330 
331  if (!stralloc_0(&f[8])) nomem();
332  if (!scan_ulong(f[8].s,&ttl)) ttl = TTL_NEGATIVE;
333  ttdparse(&f[9],ttd);
334  locparse(&f[10],loc);
335 
336  rr_start(DNS_T_SOA,ttl,ttd,loc);
337  if (dns_domain_fromdot(&d2,f[1].s,f[1].len) <= 0) nomem();
338  rr_addname(d2);
339  if (dns_domain_fromdot(&d2,f[2].s,f[2].len) <= 0) nomem();
340  rr_addname(d2);
341  rr_add(soa,20);
342  rr_finish(d1);
343  break;
344 
345  case '.': case '&': /* NS records */
346  if (dns_domain_fromdot(&d1,f[0].s,f[0].len) <= 0) nomem();
347  if (!stralloc_0(&f[3])) nomem();
348  if (!scan_ulong(f[3].s,&ttl)) ttl = TTL_NS;
349  ttdparse(&f[4],ttd);
350  locparse(&f[5],loc);
351 
352  if (!stralloc_0(&f[1])) nomem();
353 
354  if (byte_chr(f[2].s,f[2].len,'.') >= f[2].len) {
355  if (!stralloc_cats(&f[2],".ns.")) nomem();
356  if (!stralloc_catb(&f[2],f[0].s,f[0].len)) nomem();
357  }
358  if (dns_domain_fromdot(&d2,f[2].s,f[2].len) <= 0) nomem();
359 
360  if (line.s[0] == '.') {
361  rr_start(DNS_T_SOA,ttl ? TTL_NEGATIVE : 0,ttd,loc);
362  rr_addname(d2);
363  rr_add("\12hostmaster",11);
364  rr_addname(d1);
365  rr_add(defaultsoa,20);
366  rr_finish(d1);
367  }
368 
369  rr_start(DNS_T_NS,ttl,ttd,loc);
370  rr_addname(d2);
371  rr_finish(d1);
372 
373  if (byte_chr(f[1].s,f[1].len,':') < f[1].len) {
374  if (ip6_scan(f[1].s,ip6)) {
375  rr_start(DNS_T_AAAA,ttl,ttd,loc);
376  rr_add(ip6,16);
377  rr_finish(d2);
378  }
379  } else {
380  if (ip4_scan(f[1].s,ip4)) {
381  rr_start(DNS_T_A,ttl,ttd,loc);
382  rr_add(ip4,4);
383  rr_finish(d2);
384  }
385  }
386  break;
387 
388  case '+': case '=': /* A records */
389  if (dns_domain_fromdot(&d1,f[0].s,f[0].len) <= 0) nomem();
390  if (!stralloc_0(&f[2])) nomem();
391  if (!scan_ulong(f[2].s,&ttl)) ttl = TTL_POSITIVE;
392  ttdparse(&f[3],ttd);
393  locparse(&f[4],loc);
394 
395  if (!stralloc_0(&f[1])) nomem();
396 
397  if (ip4_scan(f[1].s,ip4)) {
398  rr_start(DNS_T_A,ttl,ttd,loc);
399  rr_add(ip4,4);
400  rr_finish(d1);
401 
402  if (line.s[0] == '=') {
404  rr_start(DNS_T_PTR,ttl,ttd,loc);
405  rr_addname(d1);
406  rr_finish(d4ptr);
407  }
408  }
409  break;
410 
411  case ':': case '~': /* AAAA records */
412  if (dns_domain_fromdot(&d1,f[0].s,f[0].len) <= 0) nomem();
413  if (!stralloc_0(&f[2])) nomem();
414  if (!scan_ulong(f[2].s,&ttl)) ttl = TTL_POSITIVE;
415  ttdparse(&f[3],ttd);
416  locparse(&f[4],loc);
417 
418  if (!stralloc_0(&f[1])) nomem();
419 
420  if (ip6_scan(f[1].s,ip6)) {
421  rr_start(DNS_T_AAAA,ttl,ttd,loc);
422  rr_add(ip6,16);
423  rr_finish(d1);
424 
425  if (line.s[0] == ':') {
427  rr_start(DNS_T_PTR,ttl,ttd,loc);
428  rr_addname(d1);
429  rr_finish(d6ptr);
430  }
431  }
432  break;
433 
434  case '@': /* MX Records */
435  if (dns_domain_fromdot(&d1,f[0].s,f[0].len) <= 0) nomem();
436  if (!stralloc_0(&f[4])) nomem();
437  if (!scan_ulong(f[4].s,&ttl)) ttl = TTL_POSITIVE;
438  ttdparse(&f[5],ttd);
439  locparse(&f[6],loc);
440 
441  if (!stralloc_0(&f[1])) nomem();
442 
443  if (byte_chr(f[2].s,f[2].len,'.') >= f[2].len) {
444  if (!stralloc_cats(&f[2],".mx.")) nomem();
445  if (!stralloc_catb(&f[2],f[0].s,f[0].len)) nomem();
446  }
447  if (dns_domain_fromdot(&d2,f[2].s,f[2].len) <= 0) nomem();
448 
449  if (!stralloc_0(&f[3])) nomem();
450  if (!scan_u32(f[3].s,&u)) u = 0;
451 
452  rr_start(DNS_T_MX,ttl,ttd,loc);
453  uint16_pack_big(buf,u);
454  rr_add(buf,2);
455  rr_addname(d2);
456  rr_finish(d1);
457 
458  if (byte_chr(f[1].s,f[1].len,':') < f[1].len) {
459  if (ip6_scan(f[1].s,ip6))
460  if (!ip6_isv4mapped(ip6)) {
461  rr_start(DNS_T_AAAA,ttl,ttd,loc);
462  rr_add(ip6,16);
463  rr_finish(d2);
464  }
465  } else
466  if (ip4_scan(f[1].s,ip4)) {
467  rr_start(DNS_T_A,ttl,ttd,loc);
468  rr_add(ip4,4);
469  rr_finish(d2);
470  }
471  break;
472 
473  case '^': case 'C': /* Pointer + CName Records */
474  if (dns_domain_fromdot(&d1,f[0].s,f[0].len) <= 0) nomem();
475  if (dns_domain_fromdot(&d2,f[1].s,f[1].len) <= 0) nomem();
476  if (!stralloc_0(&f[2])) nomem();
477  if (!scan_ulong(f[2].s,&ttl)) ttl = TTL_POSITIVE;
478  ttdparse(&f[3],ttd);
479  locparse(&f[4],loc);
480 
481  if (line.s[0] == 'C')
482  rr_start(DNS_T_CNAME,ttl,ttd,loc);
483  else
484  rr_start(DNS_T_PTR,ttl,ttd,loc);
485  rr_addname(d2);
486  rr_finish(d1);
487  break;
488 
489  case '\'': /* TXT Records*/
490  if (dns_domain_fromdot(&d1,f[0].s,f[0].len) <= 0) nomem();
491  if (!stralloc_0(&f[2])) nomem();
492  if (!scan_ulong(f[2].s,&ttl)) ttl = TTL_POSITIVE;
493  ttdparse(&f[3],ttd);
494  locparse(&f[4],loc);
495 
496  rr_start(DNS_T_TXT,ttl,ttd,loc);
497 
498  textparse(&f[1]);
499  i = 0;
500  while (i < f[1].len) {
501  k = f[1].len - i;
502  if (k > 127) k = 127;
503  ch = k;
504  rr_add(&ch,1);
505  rr_add(f[1].s + i,k);
506  i += k;
507  }
508  rr_finish(d1);
509  break;
510 
511  case '_': /* TLSA Records*/
512  /* _fqdn|u|s|fingerprint|x|port|proto|ttl|timestamp|lo */
513  /* 0 1 2 3 4 5 6 7 8 9 */
514 
515  if (dns_domain_fromdot(&d1,f[0].s,f[0].len) <= 0) nomem(); // d1
516  if (!stralloc_0(&f[7])) nomem();
517  if (!scan_ulong(f[7].s,&ttl)) ttl = TTL_POSITIVE;
518  ttdparse(&f[8],ttd);
519  locparse(&f[9],loc);
520 
521  if (!stralloc_0(&f[1])) nomem(); // usage
522  if (!scan_uint(f[1].s,&us)) us = 3;
523  us = 003;
524  if (!stralloc_0(&f[2])) nomem(); // selector
525  if (!scan_uint(f[2].s,&sl)) sl = 0;
526  f[2].len = 0;
527  sl = 000;
528  ty = 0; // type
529  if (f[3].len == 64) ty = 001;
530  if (f[3].len == 128) ty = 002;
531 
532  if (f[4].len == 0 && f[5].len == 0 && f[6].len == 0) { // _25._tcp.mx.fqdn
533  if (!stralloc_copys(&f[2],"_25._tcp.mail.")) nomem();
534  if (!stralloc_catb(&f[2],f[0].s,f[0].len)) nomem();
535  } else if (f[4].s[0] != '_') { // synthesize base domain
536  if (!stralloc_copys(&f[2],"_")) nomem();
537  if (f[5].len > 0) {
538  if (!stralloc_catb(&f[2],f[5].s,f[5].len)) nomem();
539  } else
540  if (!stralloc_cats(&f[2],"25")) nomem();
541  if (!stralloc_cats(&f[2],"._")) nomem();
542  if (f[6].len > 0) {
543  if (!stralloc_catb(&f[2],f[6].s,f[6].len)) nomem();
544  } else
545  if (!stralloc_cats(&f[2],"tcp")) nomem();
546  if (f[4].s[0] != '.')
547  if (!stralloc_cats(&f[2],".")) nomem();
548  if (!stralloc_catb(&f[2],f[4].s,f[4].len)) nomem();
549  if (!stralloc_cats(&f[2],".")) nomem();
550  if (!stralloc_catb(&f[2],f[0].s,f[0].len)) nomem();
551  } else
552  if (!stralloc_copy(&f[2],&f[4])) nomem();
553 
554  if (dns_domain_fromdot(&d2,f[2].s,f[2].len) <= 0) nomem(); // d2 - new record
555 
556  rr_start(DNS_T_TLSA,ttl,ttd,loc);
557 
558  buf[0] = us;
559  rr_add(buf,1);
560  buf[0] = sl;
561  rr_add(buf,1);
562  buf[0] = ty;
563  rr_add(buf,1);
564 
565  case_lowerb(f[3].s,f[3].len);
566  hexparse(&f[3]);
567  rr_add(f[3].s,f[3].len);
568  rr_finish(d2);
569  break;
570 
571  case 'O': /* Any other Records with Octal representation */
572  if (dns_domain_fromdot(&d1,f[0].s,f[0].len) <= 0) nomem();
573  if (!stralloc_0(&f[3])) nomem();
574  if (!scan_ulong(f[3].s,&ttl)) ttl = TTL_POSITIVE;
575  ttdparse(&f[4],ttd);
576  locparse(&f[5],loc);
577 
578  if (!stralloc_0(&f[1])) nomem();
579  scan_u32(f[1].s,&u);
580  uint16_pack_big(type,u);
581  if (byte_equal(type,2,DNS_T_AXFR))
582  syntaxerror(": type AXFR prohibited");
583  if (byte_equal(type,2,"\0\0"))
584  syntaxerror(": type 0 prohibited");
585  if (byte_equal(type,2,DNS_T_SOA))
586  syntaxerror(": type SOA prohibited");
587  if (byte_equal(type,2,DNS_T_NS))
588  syntaxerror(": type NS prohibited");
589  if (byte_equal(type,2,DNS_T_CNAME))
590  syntaxerror(": type CNAME prohibited");
591  if (byte_equal(type,2,DNS_T_PTR))
592  syntaxerror(": type PTR prohibited");
593  if (byte_equal(type,2,DNS_T_MX))
594  syntaxerror(": type MX prohibited");
595 
596  txtparse(&f[2]);
597 
598  rr_start(type,ttl,ttd,loc);
599  rr_add(f[2].s,f[2].len);
600  rr_finish(d1);
601  break;
602 
603  default:
604  syntaxerror(": unrecognized leading character");
605  }
606  }
607 
608  if (cdb_make_finish(&cdb) == -1) die_datatmp();
609  if (fsync(fdcdb) == -1) die_datatmp();
610  if (close(fdcdb) == -1) die_datatmp(); /* NFS stupidity */
611  if (rename("data.tmp","data.cdb") == -1)
612  logmsg(WHO,111,FATAL,"unable to move data.tmp to data.cdb");
613 
614  _exit(0);
615 }
int fd
Definition: axfr-get.c:103
stralloc line
Definition: axfr-get.c:126
uint16 len
Definition: axfrdns.c:302
char buf[MSGSIZE]
Definition: axfrdns.c:301
#define DNS_NAME4_DOMAIN
Definition: dns.h:144
#define DNS_T_A
Definition: dns.h:37
#define DNS_T_TLSA
Definition: dns.h:61
#define DNS_T_AXFR
Definition: dns.h:65
int dns_domain_fromdot(char **, const char *, unsigned int)
Definition: dns_dfd.c:6
#define DNS_T_TXT
Definition: dns.h:44
int dns_name4_domain(char *, const char *)
unsigned int dns_domain_length(const char *)
Definition: dns_domain.c:6
#define DNS_T_PTR
Definition: dns.h:41
#define DNS_T_SOA
Definition: dns.h:40
#define DNS_T_NS
Definition: dns.h:38
int dns_name6_domain(char *, const char *)
#define DNS_NAME6_DOMAIN
Definition: dns.h:157
#define DNS_T_CNAME
Definition: dns.h:39
#define DNS_T_AAAA
Definition: dns.h:48
#define DNS_T_MX
Definition: dns.h:43
char ip6[16]
Definition: dnsfilter.c:51
char ip4[4]
Definition: dnsfilter.c:50
char type[2]
Definition: dnsq.c:56
void owner(int uid, int gid)
Definition: generic-conf.c:76
void out(const char *s, unsigned int len)
Definition: generic-conf.c:54
void d(const char *home, const char *subdir, int uid, int gid, int mode)
void textparse(stralloc *sa)
Definition: tinydns-data.c:140
void die_datatmp(void)
Definition: tinydns-data.c:29
struct cdb_make cdb
Definition: tinydns-data.c:171
char bspace[1024]
Definition: tinydns-data.c:213
void ttdparse(stralloc *sa, char ttd[8])
Definition: tinydns-data.c:39
int fdcdb
Definition: tinydns-data.c:170
unsigned long linenum
Definition: tinydns-data.c:217
void rr_addname(const char *d)
Definition: tinydns-data.c:180
void hexparse(stralloc *sa)
Definition: tinydns-data.c:88
char strnum[FMT_ULONG]
Definition: tinydns-data.c:227
int rename(const char *, const char *)
char d4ptr[DNS_NAME4_DOMAIN]
Definition: tinydns-data.c:224
buffer b
Definition: tinydns-data.c:212
void locparse(stralloc *sa, char loc[2])
Definition: tinydns-data.c:58
#define TTL_POSITIVE
Definition: tinydns-data.c:22
#define TTL_NEGATIVE
Definition: tinydns-data.c:23
void nomem(void)
Definition: tinydns-data.c:34
void ipprefix_cat(stralloc *out, char *s)
Definition: tinydns-data.c:64
#define TTL_NS
Definition: tinydns-data.c:21
char d6ptr[DNS_NAME6_DOMAIN]
Definition: tinydns-data.c:225
void rr_add(const char *buf, unsigned int len)
Definition: tinydns-data.c:175
#define NUMFIELDS
Definition: tinydns-data.c:219
void syntaxerror(const char *why)
Definition: tinydns-data.c:229
void txtparse(stralloc *sa)
Definition: tinydns-data.c:110
void rr_start(const char type[2], unsigned long ttl, const char ttd[8], const char loc[2])
Definition: tinydns-data.c:185
int match
Definition: tinydns-data.c:216
#define WHO
Definition: tinydns-data.c:25
void defaultsoa_init(int fd)
Definition: tinydns-data.c:159
int main()
Definition: tinydns-data.c:244
char defaultsoa[20]
Definition: tinydns-data.c:157
void rr_finish(const char *owner)
Definition: tinydns-data.c:200
unsigned long u
Definition: utime.c:10
Definition: dnsfilter.c:23