]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/dnsmasq/0096-Remove-support-for-DNS-Extended-Label-Types.patch
Merge remote-tracking branch 'mfischer/slang' into next
[people/pmueller/ipfire-2.x.git] / src / patches / dnsmasq / 0096-Remove-support-for-DNS-Extended-Label-Types.patch
1 From 06568c663643b9ed1577d95efee69d734f427cf5 Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Fri, 15 May 2015 20:43:48 +0100
4 Subject: [PATCH 96/98] Remove support for DNS Extended Label Types.
5
6 The support was only partial, and the whole concept is
7 now deprecated in the standards.
8 ---
9 src/rfc1035.c | 52 ++++------------------------------------------------
10 1 file changed, 4 insertions(+), 48 deletions(-)
11
12 diff --git a/src/rfc1035.c b/src/rfc1035.c
13 index a95241f83523..56647b02ab4d 100644
14 --- a/src/rfc1035.c
15 +++ b/src/rfc1035.c
16 @@ -77,53 +77,7 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
17
18 p = l + (unsigned char *)header;
19 }
20 - else if (label_type == 0x80)
21 - return 0; /* reserved */
22 - else if (label_type == 0x40)
23 - { /* ELT */
24 - unsigned int count, digs;
25 -
26 - if ((l & 0x3f) != 1)
27 - return 0; /* we only understand bitstrings */
28 -
29 - if (!isExtract)
30 - return 0; /* Cannot compare bitsrings */
31 -
32 - count = *p++;
33 - if (count == 0)
34 - count = 256;
35 - digs = ((count-1)>>2)+1;
36 -
37 - /* output is \[x<hex>/siz]. which is digs+7/8/9 chars */
38 - namelen += digs+7;
39 - if (count > 9)
40 - namelen++;
41 - if (count > 99)
42 - namelen++;
43 - if (namelen+1 >= MAXDNAME)
44 - return 0;
45 -
46 - if (!CHECK_LEN(header, p, plen, (count-1)>>3))
47 - return 0;
48 -
49 - *cp++ = '\\';
50 - *cp++ = '[';
51 - *cp++ = 'x';
52 - for (j=0; j<digs; j++)
53 - {
54 - unsigned int dig;
55 - if (j%2 == 0)
56 - dig = *p >> 4;
57 - else
58 - dig = *p++ & 0x0f;
59 -
60 - *cp++ = dig < 10 ? dig + '0' : dig + 'A' - 10;
61 - }
62 - cp += sprintf((char *)cp, "/%d]", count);
63 - /* do this here to overwrite the zero char from sprintf */
64 - *cp++ = '.';
65 - }
66 - else
67 + else if (label_type == 0x00)
68 { /* label_type = 0 -> label. */
69 namelen += l + 1; /* include period */
70 if (namelen >= MAXDNAME)
71 @@ -176,12 +130,14 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
72 retvalue = 2;
73 }
74 }
75 -
76 +
77 if (isExtract)
78 *cp++ = '.';
79 else if (*cp != 0 && *cp++ != '.')
80 retvalue = 2;
81 }
82 + else
83 + return 0; /* label types 0x40 and 0x80 not supported */
84 }
85 }
86
87 --
88 2.1.0
89