Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
Dnsmasq
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Dnsmasq
Commits
b8f16556
Commit
b8f16556
authored
Apr 22, 2015
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweaks to previous, DNS label charset commit.
parent
cbe379ad
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
12 deletions
+30
-12
src/dns-protocol.h
src/dns-protocol.h
+5
-1
src/dnssec.c
src/dnssec.c
+6
-3
src/rfc1035.c
src/rfc1035.c
+18
-7
src/util.c
src/util.c
+1
-1
No files found.
src/dns-protocol.h
View file @
b8f16556
...
@@ -144,5 +144,9 @@ struct dns_header {
...
@@ -144,5 +144,9 @@ struct dns_header {
(!CHECK_LEN(header, pp, plen, len) ? 0 : (((pp) += (len)), 1))
(!CHECK_LEN(header, pp, plen, len) ? 0 : (((pp) += (len)), 1))
/* Escape character in our presentation format for names.
/* Escape character in our presentation format for names.
Cannot be '.' or /000 and must be !isprint() */
Cannot be '.' or /000 and must be !isprint().
Note that escaped chars are stored as
<NAME_ESCAPE> <orig-char+1>
to ensure that the escaped form of /000 doesn't include /000
*/
#define NAME_ESCAPE 1
#define NAME_ESCAPE 1
src/dnssec.c
View file @
b8f16556
...
@@ -341,9 +341,11 @@ static int to_wire(char *name)
...
@@ -341,9 +341,11 @@ static int to_wire(char *name)
if
(
*
p
>=
'A'
&&
*
p
<=
'Z'
)
if
(
*
p
>=
'A'
&&
*
p
<=
'Z'
)
*
p
=
*
p
-
'A'
+
'a'
;
*
p
=
*
p
-
'A'
+
'a'
;
else
if
(
*
p
==
NAME_ESCAPE
)
else
if
(
*
p
==
NAME_ESCAPE
)
for
(
q
=
p
;
*
q
;
q
++
)
{
for
(
q
=
p
;
*
q
;
q
++
)
*
q
=
*
(
q
+
1
);
*
q
=
*
(
q
+
1
);
(
*
p
)
--
;
}
term
=
*
p
;
term
=
*
p
;
if
((
len
=
p
-
l
)
!=
0
)
if
((
len
=
p
-
l
)
!=
0
)
...
@@ -376,7 +378,8 @@ static void from_wire(char *name)
...
@@ -376,7 +378,8 @@ static void from_wire(char *name)
{
{
memmove
(
p
+
1
,
p
,
1
+
last
-
p
);
memmove
(
p
+
1
,
p
,
1
+
last
-
p
);
len
++
;
len
++
;
*
p
++
=
NAME_ESCAPE
;
*
p
++
=
NAME_ESCAPE
;
(
*
p
)
++
;
}
}
l
[
len
]
=
'.'
;
l
[
len
]
=
'.'
;
...
...
src/rfc1035.c
View file @
b8f16556
...
@@ -20,7 +20,7 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
...
@@ -20,7 +20,7 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
char
*
name
,
int
isExtract
,
int
extrabytes
)
char
*
name
,
int
isExtract
,
int
extrabytes
)
{
{
unsigned
char
*
cp
=
(
unsigned
char
*
)
name
,
*
p
=
*
pp
,
*
p1
=
NULL
;
unsigned
char
*
cp
=
(
unsigned
char
*
)
name
,
*
p
=
*
pp
,
*
p1
=
NULL
;
unsigned
int
j
,
l
,
hops
=
0
;
unsigned
int
j
,
l
,
namelen
=
0
,
hops
=
0
;
int
retvalue
=
1
;
int
retvalue
=
1
;
if
(
isExtract
)
if
(
isExtract
)
...
@@ -94,9 +94,15 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
...
@@ -94,9 +94,15 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
count
=
256
;
count
=
256
;
digs
=
((
count
-
1
)
>>
2
)
+
1
;
digs
=
((
count
-
1
)
>>
2
)
+
1
;
/* output is \[x<hex>/siz]. which is digs+9 chars */
/* output is \[x<hex>/siz]. which is digs+6/7/8 chars */
if
(
cp
-
(
unsigned
char
*
)
name
+
digs
+
9
>=
MAXDNAME
)
namelen
+=
digs
+
6
;
if
(
count
>
9
)
namelen
++
;
if
(
count
>
99
)
namelen
++
;
if
(
namelen
+
1
>=
MAXDNAME
)
return
0
;
return
0
;
if
(
!
CHECK_LEN
(
header
,
p
,
plen
,
(
count
-
1
)
>>
3
))
if
(
!
CHECK_LEN
(
header
,
p
,
plen
,
(
count
-
1
)
>>
3
))
return
0
;
return
0
;
...
@@ -119,7 +125,8 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
...
@@ -119,7 +125,8 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
}
}
else
else
{
/* label_type = 0 -> label. */
{
/* label_type = 0 -> label. */
if
(
cp
-
(
unsigned
char
*
)
name
+
l
+
1
>=
MAXDNAME
)
namelen
+=
l
;
if
(
namelen
+
1
>=
MAXDNAME
)
return
0
;
return
0
;
if
(
!
CHECK_LEN
(
header
,
p
,
plen
,
l
))
if
(
!
CHECK_LEN
(
header
,
p
,
plen
,
l
))
return
0
;
return
0
;
...
@@ -132,8 +139,12 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
...
@@ -132,8 +139,12 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
if
(
option_bool
(
OPT_DNSSEC_VALID
))
if
(
option_bool
(
OPT_DNSSEC_VALID
))
{
{
if
(
c
==
0
||
c
==
'.'
||
c
==
NAME_ESCAPE
)
if
(
c
==
0
||
c
==
'.'
||
c
==
NAME_ESCAPE
)
*
cp
++
=
NAME_ESCAPE
;
{
*
cp
++
=
c
;
*
cp
++
=
NAME_ESCAPE
;
*
cp
++
=
c
+
1
;
}
else
*
cp
++
=
c
;
}
}
else
else
#endif
#endif
...
@@ -155,7 +166,7 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
...
@@ -155,7 +166,7 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
c1
+=
'a'
-
'A'
;
c1
+=
'a'
-
'A'
;
#ifdef HAVE_DNSSEC
#ifdef HAVE_DNSSEC
if
(
option_bool
(
OPT_DNSSEC_VALID
)
&&
c1
==
NAME_ESCAPE
)
if
(
option_bool
(
OPT_DNSSEC_VALID
)
&&
c1
==
NAME_ESCAPE
)
c1
=
*
cp
++
;
c1
=
(
*
cp
++
)
-
1
;
#endif
#endif
if
(
c2
>=
'A'
&&
c2
<=
'Z'
)
if
(
c2
>=
'A'
&&
c2
<=
'Z'
)
...
...
src/util.c
View file @
b8f16556
...
@@ -229,7 +229,7 @@ unsigned char *do_rfc1035_name(unsigned char *p, char *sval)
...
@@ -229,7 +229,7 @@ unsigned char *do_rfc1035_name(unsigned char *p, char *sval)
{
{
#ifdef HAVE_DNSSEC
#ifdef HAVE_DNSSEC
if
(
option_bool
(
OPT_DNSSEC_VALID
)
&&
*
sval
==
NAME_ESCAPE
)
if
(
option_bool
(
OPT_DNSSEC_VALID
)
&&
*
sval
==
NAME_ESCAPE
)
*
p
++
=
*
(
++
sval
)
;
*
p
++
=
(
*
(
++
sval
))
-
1
;
else
else
#endif
#endif
*
p
++
=
*
sval
;
*
p
++
=
*
sval
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment