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
da23c4f9
Commit
da23c4f9
authored
May 02, 2012
by
Giovanni Bajo
Committed by
Simon Kelley
Aug 20, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify rrset_canonical_order() with new canonicalization functions.
parent
4885d57c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
40 deletions
+20
-40
src/dnssec.c
src/dnssec.c
+20
-40
No files found.
src/dnssec.c
View file @
da23c4f9
...
@@ -353,54 +353,34 @@ struct {
...
@@ -353,54 +353,34 @@ struct {
static
int
rrset_canonical_order
(
const
void
*
r1
,
const
void
*
r2
)
static
int
rrset_canonical_order
(
const
void
*
r1
,
const
void
*
r2
)
{
{
size_t
r1len
,
r2len
;
size_t
r1len
,
r2len
;
int
rrtype
,
i
;
int
rrtype
;
unsigned
char
*
pr1
=*
(
unsigned
char
**
)
r1
,
*
pr2
=*
(
unsigned
char
**
)
r2
;
unsigned
char
*
pr1
=*
(
unsigned
char
**
)
r1
,
*
pr2
=*
(
unsigned
char
**
)
r2
;
unsigned
char
tmp1
[
MAXCDNAME
],
tmp2
[
MAXCDNAME
];
/* TODO: use part of daemon->namebuff */
unsigned
char
tmp1
[
MAXCDNAME
],
tmp2
[
MAXCDNAME
];
/* TODO: use part of daemon->namebuff */
#define ORDER(buf1,len1, buf2,len2) \
do { \
int res = memcmp(buf1, buf2, MIN(len1,len2)); \
if (res != 0) return res; \
if (len1 < len2) return -1; \
if (len1 > len2) return 1; \
} while (0)
GETSHORT
(
rrtype
,
pr1
);
GETSHORT
(
rrtype
,
pr1
);
pr1
+=
6
;
pr2
+=
8
;
pr1
+=
6
;
pr2
+=
8
;
GETSHORT
(
r1len
,
pr1
);
GETSHORT
(
r2len
,
pr2
);
RDataCForm
cf1
,
cf2
;
if
(
rrtype
<
countof
(
rdata_description
))
rdata_cform_init
(
&
cf1
,
rrset_canonical_order_ctx
.
header
,
rrset_canonical_order_ctx
.
pktlen
,
for
(
i
=
0
;
rdata_description
[
rrtype
][
i
]
!=
RDESC_END
;
++
i
)
pr1
,
rrtype
,
tmp1
);
{
rdata_cform_init
(
&
cf2
,
rrset_canonical_order_ctx
.
header
,
rrset_canonical_order_ctx
.
pktlen
,
int
d
=
rdata_description
[
rrtype
][
i
];
pr2
,
rrtype
,
tmp2
);
if
(
d
==
RDESC_DOMAIN
)
while
((
pr1
=
rdata_cform_next
(
&
cf1
,
&
r1len
))
&&
{
(
pr2
=
rdata_cform_next
(
&
cf2
,
&
r2len
)))
int
dl1
=
process_domain_name
(
rrset_canonical_order_ctx
.
header
,
rrset_canonical_order_ctx
.
pktlen
,
{
&
pr1
,
&
r1len
,
tmp1
,
PWN_EXTRACT
);
int
res
=
memcmp
(
pr1
,
pr2
,
MIN
(
r1len
,
r2len
));
int
dl2
=
process_domain_name
(
rrset_canonical_order_ctx
.
header
,
rrset_canonical_order_ctx
.
pktlen
,
if
(
res
!=
0
)
&
pr2
,
&
r2len
,
tmp2
,
PWN_EXTRACT
);
return
res
;
/* TODO: how do we handle errors, that is dl1==0 or dl2==0 ? */
if
(
r1len
<
r2len
)
assert
(
dl1
!=
0
);
return
-
1
;
assert
(
dl2
!=
0
);
if
(
r2len
>
r1len
)
ORDER
(
tmp1
,
dl1
,
tmp2
,
dl2
);
return
1
;
}
}
else
{
/* If we reached this point, the two RRs are identical (or an error occurred).
ORDER
(
pr1
,
d
,
pr2
,
d
);
pr1
+=
d
;
pr2
+=
d
;
r1len
-=
d
;
r2len
-=
d
;
}
}
/* Order the rest of the record. */
ORDER
(
pr1
,
r1len
,
pr2
,
r2len
);
/* If we reached this point, the two RRs are identical.
RFC2181 says that an RRset is not allowed to contain duplicate
RFC2181 says that an RRset is not allowed to contain duplicate
records. If it happens, it is a protocol error and anything goes. */
records. If it happens, it is a protocol error and anything goes. */
return
1
;
return
1
;
#undef ORDER
}
}
typedef
struct
PendingRRSIGValidation
typedef
struct
PendingRRSIGValidation
...
...
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