/[smeserver]/rpms/djbdns/sme9/260-dnsfilter-replace.patch
ViewVC logotype

Contents of /rpms/djbdns/sme9/260-dnsfilter-replace.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 --- a/dnsfilter.c
2 +++ b/dnsfilter.c
3 @@ -41,6 +41,7 @@ int inbuflen = 0;
4 iopause_fd *inio;
5 int flag0 = 1;
6
7 +int opt_replace = 0;
8 iopause_fd *io;
9 int iolen;
10
11 @@ -51,12 +52,16 @@ char name[DNS_NAME4_DOMAIN];
12 void errout(int i)
13 {
14 int j;
15 -
16 - if (!stralloc_copys(&x[i].middle,":")) nomem();
17 - if (!stralloc_cats(&x[i].middle,error_str(errno))) nomem();
18 - for (j = 0;j < x[i].middle.len;++j)
19 - if (x[i].middle.s[j] == ' ')
20 - x[i].middle.s[j] = '-';
21 +
22 + if (opt_replace)
23 + x[i].middle.len=0;
24 + else {
25 + if (!stralloc_copys(&x[i].middle,":")) nomem();
26 + if (!stralloc_cats(&x[i].middle,error_str(errno))) nomem();
27 + for (j = 0;j < x[i].middle.len;++j)
28 + if (x[i].middle.s[j] == ' ')
29 + x[i].middle.s[j] = '-';
30 + }
31 }
32
33 int main(int argc,char **argv)
34 @@ -69,7 +74,7 @@ int main(int argc,char **argv)
35 int j;
36 int r;
37
38 - while ((opt = getopt(argc,argv,"c:l:")) != opteof)
39 + while ((opt = getopt(argc,argv,"c:l:r")) != opteof)
40 switch(opt) {
41 case 'c':
42 scan_ulong(optarg,&u);
43 @@ -83,8 +88,11 @@ int main(int argc,char **argv)
44 if (u > 1000000) u = 1000000;
45 xmax = u;
46 break;
47 + case 'r':
48 + opt_replace = 1;
49 + break;
50 default:
51 - strerr_die1x(111,"dnsfilter: usage: dnsfilter [ -c concurrency ] [ -l lines ]");
52 + strerr_die1x(111,"dnsfilter: usage: dnsfilter [ -c concurrency ] [ -l lines ] [-r]");
53 }
54
55 x = (struct line *) alloc(xmax * sizeof(struct line));
56 @@ -140,8 +148,13 @@ int main(int argc,char **argv)
57 else if (r == 1) {
58 if (dns_name_packet(&x[i].middle,x[i].dt.packet,x[i].dt.packetlen) == -1)
59 errout(i);
60 - if (x[i].middle.len)
61 - if (!stralloc_cats(&x[i].left,"=")) nomem();
62 + if (x[i].middle.len) {
63 + if (opt_replace) {
64 + if (!stralloc_copys(&x[i].left, "")) nomem();
65 + } else {
66 + if (!stralloc_cats(&x[i].left, "=")) nomem();
67 + }
68 + }
69 x[i].flagactive = 0;
70 --numactive;
71 }

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