Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
eadab44e
Commit
eadab44e
authored
Feb 16, 2012
by
Jelte Jansen
Browse files
[1613] data mangle wasn't necessary, reverted
parent
46633914
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/bin/auth/tests/auth_srv_unittest.cc
View file @
eadab44e
...
...
@@ -177,27 +177,6 @@ TEST_F(AuthSrvTest, builtInQuery) {
checkAllRcodeCountersZeroExcept
(
Rcode
::
NOERROR
(),
1
);
}
// Callback used in createRequestMessage that mangles the
// wiredata to something that should not be parseable (to test
// really badly formed queries)
// This specific one simply increments every octet in the array
void
requestMangler
(
uint8_t
*
data
,
size_t
data_len
)
{
for
(
size_t
i
=
0
;
i
<
data_len
;
++
i
)
{
data
[
i
]
++
;
}
}
// Same as buildInQuery, but completely malform the sent query
TEST_F
(
AuthSrvTest
,
builtInMalformedQuery
)
{
UnitTestUtil
::
createRequestMessage
(
request_message
,
Opcode
::
QUERY
(),
default_qid
,
Name
(
"version.bind"
),
RRClass
::
CH
(),
RRType
::
TXT
());
createRequestPacket
(
request_message
,
IPPROTO_UDP
,
NULL
,
&
requestMangler
);
server
.
processMessage
(
*
io_message
,
parse_message
,
response_obuffer
,
&
dnsserv
);
checkAllRcodeCountersZeroExcept
(
Rcode
::
FORMERR
(),
1
);
}
// Same test emulating the UDPServer class behavior (defined in libasiolink).
// This is not a good test in that it assumes internal implementation details
// of UDPServer, but we've encountered a regression due to the introduction
...
...
src/lib/testutils/srv_test.cc
View file @
eadab44e
...
...
@@ -72,8 +72,7 @@ SrvTestBase::createDataFromFile(const char* const datafile,
void
SrvTestBase
::
createRequestPacket
(
Message
&
message
,
const
int
protocol
,
TSIGContext
*
context
,
void
(
*
callback
)(
uint8_t
*
,
size_t
))
const
int
protocol
,
TSIGContext
*
context
)
{
if
(
context
==
NULL
)
{
message
.
toWire
(
request_renderer
);
...
...
@@ -88,16 +87,9 @@ SrvTestBase::createRequestPacket(Message& message,
io_sock
=
(
protocol
==
IPPROTO_UDP
)
?
&
IOSocket
::
getDummyUDPSocket
()
:
&
IOSocket
::
getDummyTCPSocket
();
const
void
*
data
=
request_renderer
.
getData
();
size_t
data_len
=
request_renderer
.
getLength
();
if
(
callback
)
{
// convert to non-const uint8_t for easy manipulation by the callback
uint8_t
*
mdata
=
const_cast
<
uint8_t
*>
(
static_cast
<
const
uint8_t
*>
(
data
));
callback
(
mdata
,
data_len
);
}
io_message
=
new
IOMessage
(
data
,
data_len
,
*
io_sock
,
*
endpoint
);
io_message
=
new
IOMessage
(
request_renderer
.
getData
(),
request_renderer
.
getLength
(),
*
io_sock
,
*
endpoint
);
}
// Unsupported requests. Should result in NOTIMP.
...
...
src/lib/testutils/srv_test.h
View file @
eadab44e
...
...
@@ -83,16 +83,9 @@ protected:
/// It constructs wire-format DNS packet data from \c message in the
/// form of \c IOMessage in \c io_message.
/// The existing content of \c io_message, if any, will be deleted.
///
/// If callback is given, it is called after rendering the message,
/// but before 'sending' it; this allows the given callback to modify
/// the data and introduce bad requests that would otherwise be hard
/// to reproduce (it passes the wire-format data as non-const uint8_t,
/// so tread lightly when using this).
void
createRequestPacket
(
isc
::
dns
::
Message
&
message
,
const
int
protocol
=
IPPROTO_UDP
,
isc
::
dns
::
TSIGContext
*
context
=
NULL
,
void
(
*
callback
)(
uint8_t
*
,
size_t
)
=
NULL
);
isc
::
dns
::
TSIGContext
*
context
=
NULL
);
MockSession
notify_session
;
MockServer
dnsserv
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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