]>
Commit | Line | Data |
---|---|---|
4ac084f7 MM |
1 | diff -rNU3 djbdns-1.05/axfr-get.c djbdns-1.05-srv/axfr-get.c |
2 | --- djbdns-1.05/axfr-get.c Sun Feb 11 22:11:45 2001 | |
3 | +++ djbdns-1.05-srv/axfr-get.c Thu Oct 18 14:46:56 2001 | |
4 | @@ -209,6 +209,26 @@ | |
5 | if (!stralloc_cats(&line,".:")) return 0; | |
6 | if (!stralloc_catulong0(&line,dist,0)) return 0; | |
7 | } | |
8 | + else if (byte_equal(data,2,DNS_T_SRV)) { | |
9 | + uint16 dist, weight, port; | |
10 | + if (!stralloc_copys(&line,"S")) return 0; | |
11 | + if (!dns_domain_todot_cat(&line,d1)) return 0; | |
12 | + if (!stralloc_cats(&line,"::")) return 0; | |
13 | + pos = x_copy(buf,len,pos,data,2); | |
14 | + uint16_unpack_big(data,&dist); | |
15 | + pos = x_copy(buf,len,pos,data,2); | |
16 | + uint16_unpack_big(data,&weight); | |
17 | + pos = x_copy(buf,len,pos,data,2); | |
18 | + uint16_unpack_big(data,&port); | |
19 | + x_getname(buf,len,pos,&d1); | |
20 | + if (!dns_domain_todot_cat(&line,d1)) return 0; | |
21 | + if (!stralloc_cats(&line,".:")) return 0; | |
22 | + if (!stralloc_catulong0(&line,dist,0)) return 0; | |
23 | + if (!stralloc_cats(&line,":")) return 0; | |
24 | + if (!stralloc_catulong0(&line,weight,0)) return 0; | |
25 | + if (!stralloc_cats(&line,":")) return 0; | |
26 | + if (!stralloc_catulong0(&line,port,0)) return 0; | |
27 | + } | |
28 | else if (byte_equal(data,2,DNS_T_A) && (dlen == 4)) { | |
29 | char ipstr[IP4_FMT]; | |
30 | if (!stralloc_copys(&line,"+")) return 0; | |
31 | @@ -216,6 +236,14 @@ | |
32 | if (!stralloc_cats(&line,":")) return 0; | |
33 | x_copy(buf,len,pos,data,4); | |
34 | if (!stralloc_catb(&line,ipstr,ip4_fmt(ipstr,data))) return 0; | |
35 | + } | |
36 | + else if (byte_equal(data,2,DNS_T_PTR)) { | |
37 | + if (!stralloc_copys(&line,"^")) return 0; | |
38 | + if (!dns_domain_todot_cat(&line,d1)) return 0; | |
39 | + if (!stralloc_cats(&line,":")) return 0; | |
40 | + x_getname(buf,len,pos,&d1); | |
41 | + if (!dns_domain_todot_cat(&line,d1)) return 0; | |
42 | + if (!stralloc_cats(&line,".")) return 0; | |
43 | } | |
44 | else { | |
45 | unsigned char ch; | |
46 | diff -rNU3 djbdns-1.05/dns.h djbdns-1.05-srv/dns.h | |
47 | --- djbdns-1.05/dns.h Sun Feb 11 22:11:45 2001 | |
48 | +++ djbdns-1.05-srv/dns.h Thu Oct 18 14:46:56 2001 | |
49 | @@ -20,6 +20,7 @@ | |
50 | #define DNS_T_SIG "\0\30" | |
51 | #define DNS_T_KEY "\0\31" | |
52 | #define DNS_T_AAAA "\0\34" | |
53 | +#define DNS_T_SRV "\0\41" | |
54 | #define DNS_T_AXFR "\0\374" | |
55 | #define DNS_T_ANY "\0\377" | |
56 | ||
57 | diff -rNU3 djbdns-1.05/tinydns-data.c djbdns-1.05-srv/tinydns-data.c | |
58 | --- djbdns-1.05/tinydns-data.c Sun Feb 11 22:11:45 2001 | |
59 | +++ djbdns-1.05-srv/tinydns-data.c Thu Oct 18 14:50:53 2001 | |
60 | @@ -196,6 +196,7 @@ | |
61 | char type[2]; | |
62 | char soa[20]; | |
63 | char buf[4]; | |
64 | + char srv[6]; | |
65 | int match; | |
66 | buffer b; | |
67 | char bspace[1024]; | |
68 | @@ -360,6 +361,43 @@ | |
69 | rr_start(DNS_T_MX,ttl,ttd,loc); | |
70 | uint16_pack_big(buf,u); | |
71 | rr_add(buf,2); | |
72 | + rr_addname(d2); | |
73 | + rr_finish(d1); | |
74 | + | |
75 | + if (ip4_scan(f[1].s,ip)) { | |
76 | + rr_start(DNS_T_A,ttl,ttd,loc); | |
77 | + rr_add(ip,4); | |
78 | + rr_finish(d2); | |
79 | + } | |
80 | + break; | |
81 | + | |
82 | + case 'S': | |
83 | + if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem(); | |
84 | + if (!stralloc_0(&f[6])) nomem(); | |
85 | + if (!scan_ulong(f[6].s,&ttl)) ttl = TTL_POSITIVE; | |
86 | + ttdparse(&f[7],ttd); | |
87 | + locparse(&f[8],loc); | |
88 | + | |
89 | + if (!stralloc_0(&f[1])) nomem(); | |
90 | + | |
91 | + if (byte_chr(f[2].s,f[2].len,'.') >= f[2].len) { | |
92 | + if (!stralloc_cats(&f[2],".srv.")) nomem(); | |
93 | + if (!stralloc_catb(&f[2],f[0].s,f[0].len)) nomem(); | |
94 | + } | |
95 | + if (!dns_domain_fromdot(&d2,f[2].s,f[2].len)) nomem(); | |
96 | + | |
97 | + if (!stralloc_0(&f[4])) nomem(); | |
98 | + if (!scan_ulong(f[4].s,&u)) u = 0; | |
99 | + uint16_pack_big(srv,u); | |
100 | + if (!stralloc_0(&f[5])) nomem(); | |
101 | + if (!scan_ulong(f[5].s,&u)) u = 0; | |
102 | + uint16_pack_big(srv + 2,u); | |
103 | + if (!stralloc_0(&f[3])) nomem(); | |
104 | + if (!scan_ulong(f[3].s,&u)) nomem(); | |
105 | + uint16_pack_big(srv + 4,u); | |
106 | + | |
107 | + rr_start(DNS_T_SRV,ttl,ttd,loc); | |
108 | + rr_add(srv,6); | |
109 | rr_addname(d2); | |
110 | rr_finish(d1); | |
111 |