/[smeserver]/rpms/djbdns/sme9/140-dnsnamex-extra-command.patch
ViewVC logotype

Annotation of /rpms/djbdns/sme9/140-dnsnamex-extra-command.patch

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


Revision 1.1 - (hide 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 unnilennium 1.1 --- /dev/null
2     +++ b/dnsnamex.c
3     @@ -0,0 +1,34 @@
4     +#include "buffer.h"
5     +#include "exit.h"
6     +#include "strerr.h"
7     +#include "ip4.h"
8     +#include "dns.h"
9     +
10     +#define FATAL "dnsnamex: fatal: "
11     +
12     +static char seed[128];
13     +
14     +char ip[4];
15     +static stralloc out;
16     +
17     +int main(int argc,char **argv)
18     +{
19     + dns_random_init(seed);
20     +
21     + if (*argv) ++argv;
22     +
23     + while (*argv) {
24     + if (!ip4_scan(*argv,ip))
25     + strerr_die3x(111,FATAL,"unable to parse IP address ",*argv);
26     + if (dns_name4_multi(&out,ip) == -1)
27     + strerr_die4sys(111,FATAL,"unable to find host name for ",*argv,": ");
28     +
29     + buffer_put(buffer_1,out.s,out.len);
30     + buffer_puts(buffer_1,"\n");
31     +
32     + ++argv;
33     + }
34     +
35     + buffer_flush(buffer_1);
36     + _exit(0);
37     +}
38     --- /dev/null
39     +++ b/dns_namex.c
40     @@ -0,0 +1,48 @@
41     +#include "stralloc.h"
42     +#include "uint16.h"
43     +#include "byte.h"
44     +#include "dns.h"
45     +
46     +static char *q = 0;
47     +
48     +int dns_name_packet_multi(stralloc *out,const char *buf,unsigned int len)
49     +{
50     + unsigned int pos;
51     + char header[12];
52     + uint16 numanswers;
53     + uint16 datalen;
54     +
55     + if (!stralloc_copys(out,"")) return -1;
56     +
57     + pos = dns_packet_copy(buf,len,0,header,12); if (!pos) return -1;
58     + uint16_unpack_big(header + 6,&numanswers);
59     + pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1;
60     + pos += 4;
61     +
62     + while (numanswers--) {
63     + pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1;
64     + pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) return -1;
65     + uint16_unpack_big(header + 8,&datalen);
66     + if (byte_equal(header,2,DNS_T_PTR))
67     + if (byte_equal(header + 2,2,DNS_C_IN)) {
68     + if (!dns_packet_getname(buf,len,pos,&q)) return -1;
69     + if (!dns_domain_todot_cat(out,q)) return -1;
70     + if (!stralloc_cats(out, " ")) return -1 ;
71     + }
72     + pos += datalen;
73     + }
74     +
75     + return 0;
76     +}
77     +
78     +int dns_name4_multi(stralloc *out,const char ip[4])
79     +{
80     + char name[DNS_NAME4_DOMAIN];
81     +
82     + dns_name4_domain(name,ip);
83     + if (dns_resolve(name,DNS_T_PTR) == -1) return -1;
84     + if (dns_name_packet_multi(out,dns_resolve_tx.packet,dns_resolve_tx.packetlen) == -1) return -1;
85     + dns_transmit_free(&dns_resolve_tx);
86     + dns_domain_free(&q);
87     + return 0;
88     +}
89     --- a/dns.h
90     +++ b/dns.h
91     @@ -70,9 +70,11 @@ extern struct dns_transmit dns_resolve_t
92     extern int dns_ip4_packet(stralloc *,const char *,unsigned int);
93     extern int dns_ip4(stralloc *,const stralloc *);
94     extern int dns_name_packet(stralloc *,const char *,unsigned int);
95     +extern int dns_name_packet_multi(stralloc *,const char *,unsigned int);
96     extern void dns_name4_domain(char *,const char *);
97     #define DNS_NAME4_DOMAIN 31
98     extern int dns_name4(stralloc *,const char *);
99     +extern int dns_name4_multi(stralloc *,const char *);
100     extern int dns_txt_packet(stralloc *,const char *,unsigned int);
101     extern int dns_txt(stralloc *,const stralloc *);
102     extern int dns_mx_packet(stralloc *,const char *,unsigned int);
103     --- a/Makefile
104     +++ b/Makefile
105     @@ -219,10 +219,10 @@ uint64.h taia.h dd.h
106    
107     dns.a: \
108     makelib dns_dfd.o dns_domain.o dns_dtda.o dns_ip.o dns_ipq.o dns_mx.o \
109     -dns_name.o dns_nd.o dns_packet.o dns_random.o dns_rcip.o dns_rcrw.o \
110     +dns_name.o dns_namex.o dns_nd.o dns_packet.o dns_random.o dns_rcip.o dns_rcrw.o \
111     dns_resolve.o dns_sortip.o dns_transmit.o dns_txt.o
112     ./makelib dns.a dns_dfd.o dns_domain.o dns_dtda.o dns_ip.o \
113     - dns_ipq.o dns_mx.o dns_name.o dns_nd.o dns_packet.o \
114     + dns_ipq.o dns_mx.o dns_name.o dns_namex.o dns_nd.o dns_packet.o \
115     dns_random.o dns_rcip.o dns_rcrw.o dns_resolve.o \
116     dns_sortip.o dns_transmit.o dns_txt.o
117    
118     @@ -261,6 +261,11 @@ compile dns_name.c stralloc.h gen_alloc.
119     stralloc.h iopause.h taia.h tai.h uint64.h taia.h
120     ./compile dns_name.c
121    
122     +dns_namex.o: \
123     +compile dns_namex.c stralloc.h gen_alloc.h uint16.h byte.h dns.h \
124     +stralloc.h iopause.h taia.h tai.h uint64.h taia.h
125     + ./compile dns_namex.c
126     +
127     dns_nd.o: \
128     compile dns_nd.c byte.h fmt.h dns.h stralloc.h gen_alloc.h iopause.h \
129     taia.h tai.h uint64.h taia.h
130     @@ -394,6 +399,17 @@ compile dnsname.c buffer.h exit.h strerr
131     gen_alloc.h iopause.h taia.h tai.h uint64.h taia.h
132     ./compile dnsname.c
133    
134     +dnsnamex: \
135     +load dnsnamex.o iopause.o dns.a env.a libtai.a alloc.a buffer.a unix.a \
136     +byte.a socket.lib
137     + ./load dnsnamex iopause.o dns.a env.a libtai.a alloc.a \
138     + buffer.a unix.a byte.a `cat socket.lib`
139     +
140     +dnsnamex.o: \
141     +compile dnsnamex.c buffer.h exit.h strerr.h ip4.h dns.h stralloc.h \
142     +gen_alloc.h iopause.h taia.h tai.h uint64.h taia.h
143     + ./compile dnsnamex.c
144     +
145     dnsq: \
146     load dnsq.o iopause.o printrecord.o printpacket.o parsetype.o dns.a \
147     env.a libtai.a buffer.a alloc.a unix.a byte.a socket.lib
148     @@ -658,7 +674,7 @@ prog: \
149     dnscache-conf dnscache walldns-conf walldns rbldns-conf rbldns \
150     rbldns-data pickdns-conf pickdns pickdns-data tinydns-conf tinydns \
151     tinydns-data tinydns-get tinydns-edit axfr-get axfrdns-conf axfrdns \
152     -dnsip dnsipq dnsname dnstxt dnsmx dnsfilter random-ip dnsqr dnsq \
153     +dnsip dnsipq dnsname dnsnamex dnstxt dnsmx dnsfilter random-ip dnsqr dnsq \
154     dnstrace dnstracesort cachetest utime rts
155    
156     prot.o: \

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