/[smeserver]/rpms/djbdns/sme9/030-srv-records-and-axfrget.patch
ViewVC logotype

Contents of /rpms/djbdns/sme9/030-srv-records-and-axfrget.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed Jul 12 04:56:18 2017 UTC (6 years, 10 months ago) by unnilennium
Branch: MAIN
CVS Tags: djbdns-1_05-11_el6_sme, djbdns-1_05-9_el6_sme, djbdns-1_05-10_el6_sme, HEAD
* Tue Jul 11 2017 Jean-Philipe Pialasse <tests@pialasse.com> 1.05-9.sme
-- backport SME10 fixes [SME: 10381]
--import patches from openwrt and rename already applied patches
--fix security issues [SME: 10374]
- 020-dnsroots-update.patch: update list of root DNS servers
- 070-dnscache-dpos-tcp-servfail.patch: SERVFAIL rename previous patch dns_transmit-bug.patch
- 210-dnscache-strict-forwardonly.patch: rename previous patch dnscache-strict-forwardonly.patch
- 270-dnscache-sigpipe-fix.patch: SIGPIPE
- 300-bugfix-dnscache-dempsky-poison.patch: CVE-2009-0858
- 310-bugfix-dnscache-merge-outgoing-requests.patch: CVE-2008-4392
- 320-bugfix-dnscache-cache-soa-records.patch: CVE-2008-4392
- 450-dnscache-ghost-domain-CVE-2012-1191.patch: CVE-2012-1191 http://marc.info/?l=djbdns&m=134190748729079&w=2
--bug fixes [SME: 10374]
- 060-dnscache-big-udp-packets.patch: accept and handle longer than 512 bytes UDP packets
- 230-tinydns-data-semantic-error.patch: handle semantic error to avoid publishing false dns records
- 240-tinydns-alias-chain-truncation.patch: rename previous patch tinydns-alias-chain-truncation.patch
--fix issue with short ttl cname like akamaid [SME: 8362]
- 200-dnscache-cname-handling.patch: rename previous patch dnscache-cname-handling.patch
- 330-fix-dnscache-cname-handling.patch: fix dnscache cname for short ttl
- 500-cutom-dnscache-maxloop.patch: set max loop to 200
--needed for previous patches to apply cleanly
- 030-srv-records-and-axfrget.patch: add SRV record type and axfr-get decompose SRC and PTR records (for 230-*.patch)
- 080-dnscache-cache-negatives.patch: rfc2308 ? (for 200-*.patch)
- 090-tinydns-one-second.patch: improve tinydns with 8 or more  concurent connections (for 240-*.patch)
- 120-compiler-temporary-filename.patch: change tmp filename to avoid conflicts (for 230-*.patch)
--not backported from SME10 branch
- 050-tinydns-mmap-leak.patch: report cdb leak

1 From: Michael Handler <handler@sub-rosa.com>
2 To: dns@list.cr.yp.to
3 Subject: tinydns-data SRV & axfr-get SRV/PTR patches
4 Date: Thu, 14 Sep 2000 20:37:50 -0400
5
6 Here's a combined patch that:
7
8 a) adds a native SRV type to tinydns-data
9
10 Sfqdn:ip:x:port:weight:priority:ttl:timestamp
11
12 Standard rules for ip, x, ttl, and timestamp apply. Port, weight, and
13 priority all range from 0-65535. Weight and priority are optional; they
14 default to zero if not provided.
15
16 Sconsole.zoinks.example.com:1.2.3.4:rack102-con1:2001:69:7:300:
17
18 b) makes axfr-get decompose SRV and PTR records and write them out in
19 native format, rather than opaque. Again, this is necessary because if the
20 DNAME fields in the records reference the same zone as fqdn, they can have
21 compression pointers that are bogus outside the context of that specific
22 packet, and which can't be correctly loaded into data.cdb by tinydns-data.
23
24 --michael
25
26 Laurent G. Bercot <ska-djbdns@skarnet.org> updated it for djbdns-1.05:
27
28 --- a/axfr-get.c
29 +++ b/axfr-get.c
30 @@ -209,6 +209,26 @@ unsigned int doit(char *buf,unsigned int
31 if (!stralloc_cats(&line,".:")) return 0;
32 if (!stralloc_catulong0(&line,dist,0)) return 0;
33 }
34 + else if (byte_equal(data,2,DNS_T_SRV)) {
35 + uint16 dist, weight, port;
36 + if (!stralloc_copys(&line,"S")) return 0;
37 + if (!dns_domain_todot_cat(&line,d1)) return 0;
38 + if (!stralloc_cats(&line,"::")) return 0;
39 + pos = x_copy(buf,len,pos,data,2);
40 + uint16_unpack_big(data,&dist);
41 + pos = x_copy(buf,len,pos,data,2);
42 + uint16_unpack_big(data,&weight);
43 + pos = x_copy(buf,len,pos,data,2);
44 + uint16_unpack_big(data,&port);
45 + x_getname(buf,len,pos,&d1);
46 + if (!dns_domain_todot_cat(&line,d1)) return 0;
47 + if (!stralloc_cats(&line,".:")) return 0;
48 + if (!stralloc_catulong0(&line,dist,0)) return 0;
49 + if (!stralloc_cats(&line,":")) return 0;
50 + if (!stralloc_catulong0(&line,weight,0)) return 0;
51 + if (!stralloc_cats(&line,":")) return 0;
52 + if (!stralloc_catulong0(&line,port,0)) return 0;
53 + }
54 else if (byte_equal(data,2,DNS_T_A) && (dlen == 4)) {
55 char ipstr[IP4_FMT];
56 if (!stralloc_copys(&line,"+")) return 0;
57 @@ -217,6 +237,14 @@ unsigned int doit(char *buf,unsigned int
58 x_copy(buf,len,pos,data,4);
59 if (!stralloc_catb(&line,ipstr,ip4_fmt(ipstr,data))) return 0;
60 }
61 + else if (byte_equal(data,2,DNS_T_PTR)) {
62 + if (!stralloc_copys(&line,"^")) return 0;
63 + if (!dns_domain_todot_cat(&line,d1)) return 0;
64 + if (!stralloc_cats(&line,":")) return 0;
65 + x_getname(buf,len,pos,&d1);
66 + if (!dns_domain_todot_cat(&line,d1)) return 0;
67 + if (!stralloc_cats(&line,".")) return 0;
68 + }
69 else {
70 unsigned char ch;
71 unsigned char ch2;
72 --- a/dns.h
73 +++ b/dns.h
74 @@ -20,6 +20,7 @@
75 #define DNS_T_SIG "\0\30"
76 #define DNS_T_KEY "\0\31"
77 #define DNS_T_AAAA "\0\34"
78 +#define DNS_T_SRV "\0\41"
79 #define DNS_T_AXFR "\0\374"
80 #define DNS_T_ANY "\0\377"
81
82 --- a/tinydns-data.c
83 +++ b/tinydns-data.c
84 @@ -196,6 +196,7 @@ int main()
85 char type[2];
86 char soa[20];
87 char buf[4];
88 + char srv[6];
89
90 umask(022);
91
92 @@ -369,6 +370,43 @@ int main()
93 rr_finish(d2);
94 }
95 break;
96 +
97 + case 'S':
98 + if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
99 + if (!stralloc_0(&f[6])) nomem();
100 + if (!scan_ulong(f[6].s,&ttl)) ttl = TTL_POSITIVE;
101 + ttdparse(&f[7],ttd);
102 + locparse(&f[8],loc);
103 +
104 + if (!stralloc_0(&f[1])) nomem();
105 +
106 + if (byte_chr(f[2].s,f[2].len,'.') >= f[2].len) {
107 + if (!stralloc_cats(&f[2],".srv.")) nomem();
108 + if (!stralloc_catb(&f[2],f[0].s,f[0].len)) nomem();
109 + }
110 + if (!dns_domain_fromdot(&d2,f[2].s,f[2].len)) nomem();
111 +
112 + if (!stralloc_0(&f[4])) nomem();
113 + if (!scan_ulong(f[4].s,&u)) u = 0;
114 + uint16_pack_big(srv,u);
115 + if (!stralloc_0(&f[5])) nomem();
116 + if (!scan_ulong(f[5].s,&u)) u = 0;
117 + uint16_pack_big(srv + 2,u);
118 + if (!stralloc_0(&f[3])) nomem();
119 + if (!scan_ulong(f[3].s,&u)) nomem();
120 + uint16_pack_big(srv + 4,u);
121 +
122 + rr_start(DNS_T_SRV,ttl,ttd,loc);
123 + rr_add(srv,6);
124 + rr_addname(d2);
125 + rr_finish(d1);
126 +
127 + if (ip4_scan(f[1].s,ip)) {
128 + rr_start(DNS_T_A,ttl,ttd,loc);
129 + rr_add(ip,4);
130 + rr_finish(d2);
131 + }
132 + break;
133
134 case '^': case 'C':
135 if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed