remove dns__tsig_algallocated()
this function was no longer needed, because the algorithm name is no longer copied into the tsigkey object by dns_tsigkey_createfromkey(); it's always just a pointer to a statically defined name.
This commit is contained in:
@@ -378,27 +378,6 @@ dns__tsig_algfromname(const dns_name_t *algorithm) {
|
||||
return (DST_ALG_UNKNOWN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test whether the passed algorithm is NOT a pointer to one of the
|
||||
* pre-defined known algorithms (and therefore one that has been
|
||||
* dynamically allocated).
|
||||
*
|
||||
* This will return an incorrect result if passed a dynamically allocated
|
||||
* dns_name_t that happens to match one of the pre-defined names.
|
||||
*/
|
||||
bool
|
||||
dns__tsig_algallocated(const dns_name_t *algorithm) {
|
||||
int i;
|
||||
int n = sizeof(known_algs) / sizeof(*known_algs);
|
||||
for (i = 0; i < n; ++i) {
|
||||
const dns_name_t *name = known_algs[i].name;
|
||||
if (algorithm == name) {
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
restore_key(dns_tsigkeyring_t *ring, isc_stdtime_t now, FILE *fp) {
|
||||
dst_key_t *dstkey = NULL;
|
||||
@@ -604,11 +583,6 @@ destroy_tsigkey(dns_tsigkey_t *key) {
|
||||
|
||||
key->magic = 0;
|
||||
dns_name_free(&key->name, key->mctx);
|
||||
if (dns__tsig_algallocated(key->algorithm)) {
|
||||
dns_name_t *name = UNCONST(key->algorithm);
|
||||
dns_name_free(name, key->mctx);
|
||||
isc_mem_put(key->mctx, name, sizeof(dns_name_t));
|
||||
}
|
||||
if (key->key != NULL) {
|
||||
dst_key_free(&key->key);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,5 @@ bool
|
||||
dns__tsig_algvalid(unsigned int alg);
|
||||
dst_algorithm_t
|
||||
dns__tsig_algfromname(const dns_name_t *algorithm);
|
||||
bool
|
||||
dns__tsig_algallocated(const dns_name_t *algorithm);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
@@ -485,29 +485,9 @@ ISC_RUN_TEST_IMPL(algvalid) {
|
||||
assert_false(dns__tsig_algvalid(DST_ALG_GSSAPI));
|
||||
}
|
||||
|
||||
/* Tests the dns__tsig_algallocated function */
|
||||
ISC_RUN_TEST_IMPL(algallocated) {
|
||||
UNUSED(state);
|
||||
|
||||
/* test the standard algorithms */
|
||||
assert_false(dns__tsig_algallocated(DNS_TSIG_HMACMD5_NAME));
|
||||
assert_false(dns__tsig_algallocated(DNS_TSIG_HMACSHA1_NAME));
|
||||
assert_false(dns__tsig_algallocated(DNS_TSIG_HMACSHA224_NAME));
|
||||
assert_false(dns__tsig_algallocated(DNS_TSIG_HMACSHA256_NAME));
|
||||
assert_false(dns__tsig_algallocated(DNS_TSIG_HMACSHA384_NAME));
|
||||
assert_false(dns__tsig_algallocated(DNS_TSIG_HMACSHA512_NAME));
|
||||
|
||||
assert_false(dns__tsig_algallocated(DNS_TSIG_HMACSHA512_NAME));
|
||||
assert_false(dns__tsig_algallocated(DNS_TSIG_HMACSHA512_NAME));
|
||||
|
||||
/* try another name that isn't a standard algorithm name */
|
||||
assert_true(dns__tsig_algallocated(dns_rootname));
|
||||
}
|
||||
|
||||
ISC_TEST_LIST_START
|
||||
ISC_TEST_ENTRY_CUSTOM(tsig_tcp, setup_test, teardown_test)
|
||||
ISC_TEST_ENTRY(algvalid)
|
||||
ISC_TEST_ENTRY(algallocated)
|
||||
ISC_TEST_LIST_END
|
||||
|
||||
ISC_TEST_MAIN
|
||||
|
||||
Reference in New Issue
Block a user