Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
49e2c1ae
Commit
49e2c1ae
authored
Feb 11, 2011
by
Michal 'vorner' Vaner
Browse files
[trac505] Another test
Checks that we don't reject synthesized name of the maximum length by mistake.
parent
53f4afe1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/auth/tests/query_unittest.cc
View file @
49e2c1ae
...
@@ -635,4 +635,44 @@ TEST_F(QueryTest, LongDNAME) {
...
@@ -635,4 +635,44 @@ TEST_F(QueryTest, LongDNAME) {
dname_txt
,
NULL
,
NULL
);
dname_txt
,
NULL
,
NULL
);
}
}
/*
* Constructing the CNAME will result in a name of maximal length.
* This tests that we don't reject valid one by some kind of off by
* one mistake.
*/
TEST_F
(
QueryTest
,
MaxLenDNAME
)
{
Name
longname
(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
"dname.example.com."
);
EXPECT_NO_THROW
(
Query
(
memory_datasrc
,
longname
,
RRType
::
A
(),
response
).
process
());
// Check the answer is OK
responseCheck
(
response
,
Rcode
::
NOERROR
(),
AA_FLAG
,
2
,
0
,
0
,
NULL
,
NULL
,
NULL
);
// Check that the CNAME has the maximal length.
bool
ok
(
false
);
for
(
RRsetIterator
i
(
response
.
beginSection
(
Message
::
SECTION_ANSWER
));
i
!=
response
.
endSection
(
Message
::
SECTION_ANSWER
);
++
i
)
{
if
((
*
i
)
->
getType
()
==
RRType
::
CNAME
())
{
ok
=
true
;
RdataIteratorPtr
ci
((
*
i
)
->
getRdataIterator
());
ASSERT_FALSE
(
ci
->
isLast
())
<<
"The CNAME is empty"
;
/*
* Does anybody have a clue why, if the Name::MAX_WIRE is put
* directly inside ASSERT_EQ, it fails to link and complains
* it is unresolved external?
*/
size_t
max_len
(
Name
::
MAX_WIRE
);
ASSERT_EQ
(
max_len
,
dynamic_cast
<
const
rdata
::
generic
::
CNAME
&>
(
ci
->
getCurrent
()).
getCname
().
getLength
());
}
}
EXPECT_TRUE
(
ok
)
<<
"The synthetized CNAME not found"
;
}
}
}
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