Gentoo Archives: gentoo-commits

From: "Michael Orlitzky (mjo)" <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-dns/djbdns/files: srv_record_support.patch
Date: Thu, 02 Oct 2014 22:22:21
Message-Id: 20141002222216.A7E966CCC@oystercatcher.gentoo.org
1 mjo 14/10/02 22:22:16
2
3 Added: srv_record_support.patch
4 Log:
5 Revbump to fix bugs #523754 and #523756.
6
7 (Portage version: 2.2.8-r2/cvs/Linux x86_64, signed Manifest commit with key 0x6F48D3DA05C2DADB!)
8
9 Revision Changes Path
10 1.1 net-dns/djbdns/files/srv_record_support.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/djbdns/files/srv_record_support.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/djbdns/files/srv_record_support.patch?rev=1.1&content-type=text/plain
14
15 Index: srv_record_support.patch
16 ===================================================================
17 From: Michael Handler <handler@××××××××.com>
18 To: dns@××××××××××.to
19 Subject: tinydns-data SRV & axfr-get SRV/PTR patches
20 Date: Thu, 14 Sep 2000 20:37:50 -0400
21
22 Here's a combined patch that:
23
24 a) adds a native SRV type to tinydns-data
25
26 Sfqdn:ip:x:port:weight:priority:ttl:timestamp
27
28 Standard rules for ip, x, ttl, and timestamp apply. Port, weight, and
29 priority all range from 0-65535. Weight and priority are optional; they
30 default to zero if not provided.
31
32 Sconsole.zoinks.example.com:1.2.3.4:rack102-con1:2001:69:7:300:
33
34 b) makes axfr-get decompose SRV and PTR records and write them out in
35 native format, rather than opaque. Again, this is necessary because if the
36 DNAME fields in the records reference the same zone as fqdn, they can have
37 compression pointers that are bogus outside the context of that specific
38 packet, and which can't be correctly loaded into data.cdb by tinydns-data.
39
40 --michael
41
42 Laurent G. Bercot <ska-djbdns@×××××××.org> updated it for
43 djbdns-1.05. Documentation patch by Alex Efros.
44
45 diff -rNU3 djbdns-1.05/axfr-get.c djbdns-1.05-srv/axfr-get.c
46 --- djbdns-1.05/axfr-get.c Sun Feb 11 22:11:45 2001
47 +++ djbdns-1.05/axfr-get.c Thu Oct 18 14:46:56 2001
48 @@ -209,6 +209,26 @@
49 if (!stralloc_cats(&line,".:")) return 0;
50 if (!stralloc_catulong0(&line,dist,0)) return 0;
51 }
52 + else if (byte_equal(data,2,DNS_T_SRV)) {
53 + uint16 dist, weight, port;
54 + if (!stralloc_copys(&line,"S")) return 0;
55 + if (!dns_domain_todot_cat(&line,d1)) return 0;
56 + if (!stralloc_cats(&line,"::")) return 0;
57 + pos = x_copy(buf,len,pos,data,2);
58 + uint16_unpack_big(data,&dist);
59 + pos = x_copy(buf,len,pos,data,2);
60 + uint16_unpack_big(data,&weight);
61 + pos = x_copy(buf,len,pos,data,2);
62 + uint16_unpack_big(data,&port);
63 + x_getname(buf,len,pos,&d1);
64 + if (!dns_domain_todot_cat(&line,d1)) return 0;
65 + if (!stralloc_cats(&line,".:")) return 0;
66 + if (!stralloc_catulong0(&line,dist,0)) return 0;
67 + if (!stralloc_cats(&line,":")) return 0;
68 + if (!stralloc_catulong0(&line,weight,0)) return 0;
69 + if (!stralloc_cats(&line,":")) return 0;
70 + if (!stralloc_catulong0(&line,port,0)) return 0;
71 + }
72 else if (byte_equal(data,2,DNS_T_A) && (dlen == 4)) {
73 char ipstr[IP4_FMT];
74 if (!stralloc_copys(&line,"+")) return 0;
75 @@ -216,6 +236,14 @@
76 if (!stralloc_cats(&line,":")) return 0;
77 x_copy(buf,len,pos,data,4);
78 if (!stralloc_catb(&line,ipstr,ip4_fmt(ipstr,data))) return 0;
79 + }
80 + else if (byte_equal(data,2,DNS_T_PTR)) {
81 + if (!stralloc_copys(&line,"^")) return 0;
82 + if (!dns_domain_todot_cat(&line,d1)) return 0;
83 + if (!stralloc_cats(&line,":")) return 0;
84 + x_getname(buf,len,pos,&d1);
85 + if (!dns_domain_todot_cat(&line,d1)) return 0;
86 + if (!stralloc_cats(&line,".")) return 0;
87 }
88 else {
89 unsigned char ch;
90 diff -rNU3 djbdns-1.05/dns.h djbdns-1.05-srv/dns.h
91 --- djbdns-1.05/dns.h Sun Feb 11 22:11:45 2001
92 +++ djbdns-1.05/dns.h Thu Oct 18 14:46:56 2001
93 @@ -20,6 +20,7 @@
94 #define DNS_T_SIG "\0\30"
95 #define DNS_T_KEY "\0\31"
96 #define DNS_T_AAAA "\0\34"
97 +#define DNS_T_SRV "\0\41"
98 #define DNS_T_AXFR "\0\374"
99 #define DNS_T_ANY "\0\377"
100
101 diff -rNU3 djbdns-1.05/tinydns-data.c djbdns-1.05-srv/tinydns-data.c
102 --- djbdns-1.05/tinydns-data.c Sun Feb 11 22:11:45 2001
103 +++ djbdns-1.05/tinydns-data.c Thu Oct 18 14:50:53 2001
104 @@ -196,6 +196,7 @@
105 char type[2];
106 char soa[20];
107 char buf[4];
108 + char srv[6];
109
110 umask(022);
111
112 @@ -360,6 +361,43 @@
113 rr_start(DNS_T_MX,ttl,ttd,loc);
114 uint16_pack_big(buf,u);
115 rr_add(buf,2);
116 + rr_addname(d2);
117 + rr_finish(d1);
118 +
119 + if (ip4_scan(f[1].s,ip)) {
120 + rr_start(DNS_T_A,ttl,ttd,loc);
121 + rr_add(ip,4);
122 + rr_finish(d2);
123 + }
124 + break;
125 +
126 + case 'S':
127 + if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
128 + if (!stralloc_0(&f[6])) nomem();
129 + if (!scan_ulong(f[6].s,&ttl)) ttl = TTL_POSITIVE;
130 + ttdparse(&f[7],ttd);
131 + locparse(&f[8],loc);
132 +
133 + if (!stralloc_0(&f[1])) nomem();
134 +
135 + if (byte_chr(f[2].s,f[2].len,'.') >= f[2].len) {
136 + if (!stralloc_cats(&f[2],".srv.")) nomem();
137 + if (!stralloc_catb(&f[2],f[0].s,f[0].len)) nomem();
138 + }
139 + if (!dns_domain_fromdot(&d2,f[2].s,f[2].len)) nomem();
140 +
141 + if (!stralloc_0(&f[4])) nomem();
142 + if (!scan_ulong(f[4].s,&u)) u = 0;
143 + uint16_pack_big(srv,u);
144 + if (!stralloc_0(&f[5])) nomem();
145 + if (!scan_ulong(f[5].s,&u)) u = 0;
146 + uint16_pack_big(srv + 2,u);
147 + if (!stralloc_0(&f[3])) nomem();
148 + if (!scan_ulong(f[3].s,&u)) nomem();
149 + uint16_pack_big(srv + 4,u);
150 +
151 + rr_start(DNS_T_SRV,ttl,ttd,loc);
152 + rr_add(srv,6);
153 rr_addname(d2);
154 rr_finish(d1);
155
156 --- djbdns-1.05/man/tinydns-data.8 2003-10-23 10:47:32.000000000 +0300
157 +++ djbdns-1.05/man/tinydns-data.8 2014-09-26 02:51:59.861716505 +0300
158 @@ -487,6 +487,38 @@
159 .RI \ 072
160 is a colon.
161
162 +.RI S fqdn\fR:\fIip\fR:\fIx\fR:\fIport\fR:\fIweight\fR:\fIpriority\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
163 +
164 +SRV record for
165 +.IR fqdn .
166 +
167 +.B tinydns-data
168 +creates
169 +.IP
170 +an SRV record
171 +showing
172 +.IR x\fR.srv.\fIfqdn\fR:\fIport\fR
173 +as a service for
174 +.IR fqdn
175 +with given \fIweight\fR and \fIpriority\fR
176 +(\fIport\fR, \fIweight\fR and \fIpriority\fR must be in range 0-65535;
177 +\fIweight\fR and \fIpriority\fR are optional;
178 +they default to zero if not provided)
179 +and
180 +.P
181 +.IP
182 +an A record showing
183 +.I ip
184 +as the IP address
185 +of
186 +.IR x\fR.srv.\fIfqdn .
187 +.P
188 +
189 +If
190 +.I x
191 +contains a dot
192 +then it is treated specially; see above.
193 +
194 .RI ^ fqdn\fR:\fIp\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
195
196 PTR record for