Lines 25-30
Link Here
|
25 |
|
25 |
|
26 |
#define FATAL "tinydns-data: fatal: " |
26 |
#define FATAL "tinydns-data: fatal: " |
27 |
|
27 |
|
|
|
28 |
void die_semantic(const char * s1, const char * s2) |
29 |
{ |
30 |
strerr_die3x(111,FATAL,s1,s2) ; |
31 |
} |
28 |
void die_datatmp(void) |
32 |
void die_datatmp(void) |
29 |
{ |
33 |
{ |
30 |
strerr_die2sys(111,FATAL,"unable to create data.tmp: "); |
34 |
strerr_die2sys(111,FATAL,"unable to create data.tmp: "); |
Lines 55-60
Link Here
|
55 |
|
59 |
|
56 |
void locparse(stralloc *sa,char loc[2]) |
60 |
void locparse(stralloc *sa,char loc[2]) |
57 |
{ |
61 |
{ |
|
|
62 |
if (sa->len > 2) { |
63 |
if (!stralloc_0(sa)) nomem() ; |
64 |
die_semantic("location code longer than two characters: ", sa->s) ; |
65 |
} |
58 |
loc[0] = (sa->len > 0) ? sa->s[0] : 0; |
66 |
loc[0] = (sa->len > 0) ? sa->s[0] : 0; |
59 |
loc[1] = (sa->len > 1) ? sa->s[1] : 0; |
67 |
loc[1] = (sa->len > 1) ? sa->s[1] : 0; |
60 |
} |
68 |
} |
Lines 187-192
Link Here
|
187 |
int i; |
195 |
int i; |
188 |
int j; |
196 |
int j; |
189 |
int k; |
197 |
int k; |
|
|
198 |
int iplen ; |
190 |
char ch; |
199 |
char ch; |
191 |
unsigned long ttl; |
200 |
unsigned long ttl; |
192 |
char ttd[8]; |
201 |
char ttd[8]; |
Lines 308-318
Link Here
|
308 |
rr_addname(d2); |
317 |
rr_addname(d2); |
309 |
rr_finish(d1); |
318 |
rr_finish(d1); |
310 |
|
319 |
|
311 |
if (ip4_scan(f[1].s,ip)) { |
320 |
iplen = ip4_scan(f[1].s,ip) ; |
|
|
321 |
if (iplen != 0 && iplen + 1 == f[1].len) { |
312 |
rr_start(DNS_T_A,ttl,ttd,loc); |
322 |
rr_start(DNS_T_A,ttl,ttd,loc); |
313 |
rr_add(ip,4); |
323 |
rr_add(ip,4); |
314 |
rr_finish(d2); |
324 |
rr_finish(d2); |
315 |
} |
325 |
} else if (f[1].len > 1) |
|
|
326 |
die_semantic("unparseable IP address in & or . line: ", f[1].s) ; |
316 |
|
327 |
|
317 |
break; |
328 |
break; |
318 |
|
329 |
|
Lines 325-331
Link Here
|
325 |
|
336 |
|
326 |
if (!stralloc_0(&f[1])) nomem(); |
337 |
if (!stralloc_0(&f[1])) nomem(); |
327 |
|
338 |
|
328 |
if (ip4_scan(f[1].s,ip)) { |
339 |
iplen = ip4_scan(f[1].s,ip) ; |
|
|
340 |
if (iplen != 0 && iplen + 1 == f[1].len) { |
329 |
rr_start(DNS_T_A,ttl,ttd,loc); |
341 |
rr_start(DNS_T_A,ttl,ttd,loc); |
330 |
rr_add(ip,4); |
342 |
rr_add(ip,4); |
331 |
rr_finish(d1); |
343 |
rr_finish(d1); |
Lines 336-342
Link Here
|
336 |
rr_addname(d1); |
348 |
rr_addname(d1); |
337 |
rr_finish(dptr); |
349 |
rr_finish(dptr); |
338 |
} |
350 |
} |
339 |
} |
351 |
} else if (f[1].len > 1) |
|
|
352 |
die_semantic("unparseable IP address in + or = line: ", f[1].s) ; |
353 |
else |
354 |
die_semantic("missing IP address in + or = line: ", f[1].s) ; |
340 |
break; |
355 |
break; |
341 |
|
356 |
|
342 |
case '@': |
357 |
case '@': |
Lines 363-373
Link Here
|
363 |
rr_addname(d2); |
378 |
rr_addname(d2); |
364 |
rr_finish(d1); |
379 |
rr_finish(d1); |
365 |
|
380 |
|
366 |
if (ip4_scan(f[1].s,ip)) { |
381 |
iplen = ip4_scan(f[1].s,ip) ; |
|
|
382 |
if (iplen != 0 && iplen + 1 == f[1].len) { |
367 |
rr_start(DNS_T_A,ttl,ttd,loc); |
383 |
rr_start(DNS_T_A,ttl,ttd,loc); |
368 |
rr_add(ip,4); |
384 |
rr_add(ip,4); |
369 |
rr_finish(d2); |
385 |
rr_finish(d2); |
370 |
} |
386 |
} else if (f[1].len > 1) |
|
|
387 |
die_semantic("unparseable IP address in @ line: ", f[1].s) ; |
371 |
break; |
388 |
break; |
372 |
|
389 |
|
373 |
case '^': case 'C': |
390 |
case '^': case 'C': |