diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index 4ae37e764a..c75caff365 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -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); } diff --git a/lib/dns/tsig_p.h b/lib/dns/tsig_p.h index 80e7323736..42316a0608 100644 --- a/lib/dns/tsig_p.h +++ b/lib/dns/tsig_p.h @@ -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 diff --git a/tests/dns/tsig_test.c b/tests/dns/tsig_test.c index fdc9ed3989..88632b921a 100644 --- a/tests/dns/tsig_test.c +++ b/tests/dns/tsig_test.c @@ -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