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
b37f8b99
Commit
b37f8b99
authored
Mar 25, 2014
by
Tomas Hozza
Committed by
Simon Kelley
Mar 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle failure of hash_questions()
parent
fc2833f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
29 deletions
+33
-29
src/forward.c
src/forward.c
+33
-29
No files found.
src/forward.c
View file @
b37f8b99
...
...
@@ -1417,42 +1417,44 @@ static int tcp_check_for_unsigned_zone(time_t now, struct dns_header *header, s
/* We rely on the question section coming back unchanged, ensure it is with the hash. */
if
((
newhash
=
hash_questions
(
header
,
(
unsigned
int
)
m
,
name
)))
memcpy
(
hash
,
newhash
,
HASH_SIZE
);
*
length
=
htons
(
m
);
if
(
read_write
(
server
->
tcpfd
,
packet
,
m
+
sizeof
(
u16
),
0
)
&&
read_write
(
server
->
tcpfd
,
&
c1
,
1
,
1
)
&&
read_write
(
server
->
tcpfd
,
&
c2
,
1
,
1
)
&&
read_write
(
server
->
tcpfd
,
payload
,
(
c1
<<
8
)
|
c2
,
1
))
{
m
=
(
c1
<<
8
)
|
c2
;
memcpy
(
hash
,
newhash
,
HASH_SIZE
);
*
length
=
htons
(
m
);
newhash
=
hash_questions
(
header
,
(
unsigned
int
)
m
,
name
);
if
(
newhash
&&
memcmp
(
hash
,
newhash
,
HASH_SIZE
)
==
0
)
if
(
read_write
(
server
->
tcpfd
,
packet
,
m
+
sizeof
(
u16
),
0
)
&&
read_write
(
server
->
tcpfd
,
&
c1
,
1
,
1
)
&&
read_write
(
server
->
tcpfd
,
&
c2
,
1
,
1
)
&&
read_write
(
server
->
tcpfd
,
payload
,
(
c1
<<
8
)
|
c2
,
1
))
{
/* Note this trashes all three name workspaces */
status
=
tcp_key_recurse
(
now
,
STAT_NEED_DS_NEG
,
header
,
m
,
class
,
name
,
keyname
,
server
,
keycount
);
/* We've found a DS which proves the bit of the DNS where the
original query is, is unsigned, so the answer is OK,
if unvalidated. */
if
(
status
==
STAT_NO_DS
)
{
free
(
packet
);
return
STAT_INSECURE
;
}
m
=
(
c1
<<
8
)
|
c2
;
/* No DS, not got to DNSSEC-land yet, go up. */
if
(
status
==
STAT_INSECURE
)
newhash
=
hash_questions
(
header
,
(
unsigned
int
)
m
,
name
);
if
(
newhash
&&
memcmp
(
hash
,
newhash
,
HASH_SIZE
)
==
0
)
{
p
=
(
unsigned
char
*
)(
header
+
1
);
/* Note this trashes all three name workspaces */
status
=
tcp_key_recurse
(
now
,
STAT_NEED_DS_NEG
,
header
,
m
,
class
,
name
,
keyname
,
server
,
keycount
);
if
(
extract_name
(
header
,
plen
,
&
p
,
name
,
1
,
4
)
&&
(
name_start
=
strchr
(
name
,
'.'
)))
/* We've found a DS which proves the bit of the DNS where the
original query is, is unsigned, so the answer is OK,
if unvalidated. */
if
(
status
==
STAT_NO_DS
)
{
name_start
++
;
/* chop a label off and try again */
continue
;
free
(
packet
);
return
STAT_INSECURE
;
}
/* No DS, not got to DNSSEC-land yet, go up. */
if
(
status
==
STAT_INSECURE
)
{
p
=
(
unsigned
char
*
)(
header
+
1
);
if
(
extract_name
(
header
,
plen
,
&
p
,
name
,
1
,
4
)
&&
(
name_start
=
strchr
(
name
,
'.'
)))
{
name_start
++
;
/* chop a label off and try again */
continue
;
}
}
}
}
...
...
@@ -1731,6 +1733,8 @@ unsigned char *tcp_request(int confd, time_t now,
unsigned
char
*
newhash
,
hash
[
HASH_SIZE
];
if
((
newhash
=
hash_questions
(
header
,
(
unsigned
int
)
size
,
daemon
->
keyname
)))
memcpy
(
hash
,
newhash
,
HASH_SIZE
);
else
memset
(
hash
,
0
,
HASH_SIZE
);
#else
unsigned
int
crc
=
questions_crc
(
header
,
(
unsigned
int
)
size
,
daemon
->
namebuff
);
#endif
...
...
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