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
ISC Open Source Projects
Kea
Commits
f137e0fa
Commit
f137e0fa
authored
Apr 20, 2011
by
Jelte Jansen
Browse files
[trac781] renamed test and refactored duplicate initialization code
parent
cf456aa1
Changes
3
Show whitespace changes
Inline
Side-by-side
src/lib/dns/tests/tsigkey_unittest.cc
View file @
f137e0fa
...
...
@@ -227,7 +227,7 @@ TEST_F(TSIGKeyRingTest, findFromSome) {
keyring
.
find
(
Name
(
"noexist.example"
)).
key
);
}
TEST
(
TSIGTest
,
TSIGKeyFromToString
)
{
TEST
(
TSIG
String
Test
,
TSIGKeyFromToString
)
{
TSIGKey
k1
=
TSIGKey
(
"test.example:MSG6Ng==:hmac-md5.sig-alg.reg.int"
);
TSIGKey
k2
=
TSIGKey
(
"test.example.:MSG6Ng==:hmac-md5.sig-alg.reg.int."
);
TSIGKey
k3
=
TSIGKey
(
"test.example:MSG6Ng=="
);
...
...
src/lib/dns/tsigkey.cc
View file @
f137e0fa
...
...
@@ -26,6 +26,14 @@
using
namespace
std
;
namespace
{
bool
isValidAlgorithmName
(
const
isc
::
dns
::
Name
&
name
)
{
return
(
name
==
isc
::
dns
::
TSIGKey
::
HMACMD5_NAME
()
||
name
==
isc
::
dns
::
TSIGKey
::
HMACSHA1_NAME
()
||
name
==
isc
::
dns
::
TSIGKey
::
HMACSHA256_NAME
());
}
}
namespace
isc
{
namespace
dns
{
struct
...
...
@@ -47,9 +55,7 @@ TSIGKey::TSIGKeyImpl {
TSIGKey
::
TSIGKey
(
const
Name
&
key_name
,
const
Name
&
algorithm_name
,
const
void
*
secret
,
size_t
secret_len
)
:
impl_
(
NULL
)
{
if
(
algorithm_name
!=
HMACMD5_NAME
()
&&
algorithm_name
!=
HMACSHA1_NAME
()
&&
algorithm_name
!=
HMACSHA256_NAME
())
{
if
(
!
isValidAlgorithmName
(
algorithm_name
))
{
isc_throw
(
InvalidParameter
,
"Unknown TSIG algorithm is specified: "
<<
algorithm_name
);
}
...
...
@@ -88,9 +94,7 @@ TSIGKey::TSIGKey(const std::string& str) : impl_(NULL) {
const
Name
algo_name
(
algo_str
.
empty
()
?
"hmac-md5.sig-alg.reg.int"
:
algo_str
);
if
(
algo_name
!=
HMACMD5_NAME
()
&&
algo_name
!=
HMACSHA1_NAME
()
&&
algo_name
!=
HMACSHA256_NAME
())
{
if
(
!
isValidAlgorithmName
(
algo_name
))
{
isc_throw
(
InvalidParameter
,
"Unknown TSIG algorithm is specified: "
<<
algo_name
);
}
...
...
src/lib/dns/tsigkey.h
View file @
f137e0fa
...
...
@@ -107,7 +107,7 @@ public:
/// invalid.
///
/// \param str The string to make a TSIGKey from
TSIGKey
(
const
std
::
string
&
str
);
explicit
TSIGKey
(
const
std
::
string
&
str
);
/// \brief The copy constructor.
///
...
...
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