mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 21:47:59 +00:00
remove 'target' parameter from dns_name_concatenate()
the target buffer passed to dns_name_concatenate() was never used (except for one place in dig, where it wasn't actually needed, and has already been removed in a prior commit). we can safely remove the parameter.
This commit is contained in:
parent
2edefbad4a
commit
a6986f6837
@ -2277,7 +2277,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
if (!dns_name_isabsolute(name)) {
|
||||
result = dns_name_concatenate(
|
||||
name, lookup->oname,
|
||||
lookup->name, NULL);
|
||||
lookup->name);
|
||||
} else {
|
||||
dns_name_copy(name, lookup->name);
|
||||
}
|
||||
|
@ -959,7 +959,7 @@ addnowildcardhash(hashlist_t *l,
|
||||
|
||||
wild = dns_fixedname_initname(&fixed);
|
||||
|
||||
result = dns_name_concatenate(dns_wildcardname, name, wild, NULL);
|
||||
result = dns_name_concatenate(dns_wildcardname, name, wild);
|
||||
if (result == ISC_R_NOSPACE) {
|
||||
return;
|
||||
}
|
||||
|
@ -875,8 +875,7 @@ set_target(dns_adb_t *adb, const dns_name_t *name, const dns_name_t *fname,
|
||||
prefix = dns_fixedname_initname(&fixed1);
|
||||
new_target = dns_fixedname_initname(&fixed2);
|
||||
dns_name_split(name, nlabels, prefix, NULL);
|
||||
result = dns_name_concatenate(prefix, &dname.dname, new_target,
|
||||
NULL);
|
||||
result = dns_name_concatenate(prefix, &dname.dname, new_target);
|
||||
dns_rdata_freestruct(&dname);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
|
@ -652,7 +652,7 @@ client_resfind(resctx_t *rctx, dns_fetchresponse_t *resp) {
|
||||
prefix = dns_fixedname_initname(&fixed);
|
||||
dns_name_split(name, nlabels, prefix, NULL);
|
||||
tresult = dns_name_concatenate(prefix, &dname.dname,
|
||||
name, NULL);
|
||||
name);
|
||||
dns_rdata_freestruct(&dname);
|
||||
if (tresult == ISC_R_SUCCESS) {
|
||||
want_restart = true;
|
||||
|
@ -592,7 +592,7 @@ cleanup_struct:
|
||||
RUNTIME_CHECK(dns_name_concatenate(
|
||||
dns_wildcardname,
|
||||
dns_fixedname_name(&fnewname),
|
||||
wild, NULL) == ISC_R_SUCCESS);
|
||||
wild) == ISC_R_SUCCESS);
|
||||
}
|
||||
inc_stat(dns_dnssecstats_wildcard);
|
||||
ret = DNS_R_FROMWILDCARD;
|
||||
|
@ -302,9 +302,10 @@ dns_name_setbuffer(dns_name_t *name, isc_buffer_t *buffer) {
|
||||
* Dedicate a buffer for use with 'name'.
|
||||
*
|
||||
* Notes:
|
||||
* \li Specification of a target buffer in dns_name_fromwire(),
|
||||
* dns_name_fromtext(), and dns_name_concatenate() is optional if
|
||||
* 'name' has a dedicated buffer.
|
||||
* \li Specification of a target buffer in dns_name_fromwire() and
|
||||
* dns_name_fromtext() is optional if 'name' has a dedicated buffer.
|
||||
* The target name in dns_name_concatenate() must have a dedicated
|
||||
* buffer.
|
||||
*
|
||||
* \li The caller must not write to buffer until the name has been
|
||||
* invalidated or is otherwise known not to be in use.
|
||||
@ -959,9 +960,11 @@ dns_name_downcase(const dns_name_t *source, dns_name_t *name);
|
||||
|
||||
isc_result_t
|
||||
dns_name_concatenate(const dns_name_t *prefix, const dns_name_t *suffix,
|
||||
dns_name_t *name, isc_buffer_t *target);
|
||||
dns_name_t *name);
|
||||
/*%<
|
||||
* Concatenate 'prefix' and 'suffix'.
|
||||
* Concatenate 'prefix' and 'suffix' and place the result in 'name'.
|
||||
* (Note that 'name' may be the same as 'prefix', in which case
|
||||
* 'suffix' will be appended to it.)
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
@ -969,20 +972,10 @@ dns_name_concatenate(const dns_name_t *prefix, const dns_name_t *suffix,
|
||||
*
|
||||
*\li 'suffix' is a valid name or NULL.
|
||||
*
|
||||
*\li 'name' is a valid name or NULL.
|
||||
*
|
||||
*\li 'target' is a valid buffer or 'target' is NULL and 'name' has
|
||||
* a dedicated buffer.
|
||||
*\li 'name' is a valid name with a dedicated buffer.
|
||||
*
|
||||
*\li If 'prefix' is absolute, 'suffix' must be NULL or the empty name.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li On success,
|
||||
* If 'target' is not NULL and 'name' is not NULL, then 'name'
|
||||
* is attached to it.
|
||||
* The used space in target is updated.
|
||||
*
|
||||
* Returns:
|
||||
*\li #ISC_R_SUCCESS
|
||||
*\li #ISC_R_NOSPACE
|
||||
|
@ -1511,13 +1511,14 @@ dns_name_towire(const dns_name_t *name, dns_compress_t *cctx,
|
||||
|
||||
isc_result_t
|
||||
dns_name_concatenate(const dns_name_t *prefix, const dns_name_t *suffix,
|
||||
dns_name_t *name, isc_buffer_t *target) {
|
||||
unsigned char *ndata;
|
||||
dns_name_t *name) {
|
||||
unsigned char *ndata = NULL;
|
||||
unsigned int nrem, prefix_length, length;
|
||||
bool copy_prefix = true;
|
||||
bool copy_suffix = true;
|
||||
bool absolute = false;
|
||||
dns_name_t tmp_name;
|
||||
isc_buffer_t *target = NULL;
|
||||
|
||||
/*
|
||||
* Concatenate 'prefix' and 'suffix'.
|
||||
@ -1525,10 +1526,9 @@ dns_name_concatenate(const dns_name_t *prefix, const dns_name_t *suffix,
|
||||
|
||||
REQUIRE(prefix == NULL || DNS_NAME_VALID(prefix));
|
||||
REQUIRE(suffix == NULL || DNS_NAME_VALID(suffix));
|
||||
REQUIRE(name == NULL || DNS_NAME_VALID(name));
|
||||
REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) ||
|
||||
(target == NULL && name != NULL &&
|
||||
ISC_BUFFER_VALID(name->buffer)));
|
||||
REQUIRE(DNS_NAME_VALID(name) && ISC_BUFFER_VALID(name->buffer));
|
||||
REQUIRE(DNS_NAME_BINDABLE(name));
|
||||
|
||||
if (prefix == NULL || prefix->length == 0) {
|
||||
copy_prefix = false;
|
||||
}
|
||||
@ -1543,13 +1543,9 @@ dns_name_concatenate(const dns_name_t *prefix, const dns_name_t *suffix,
|
||||
dns_name_init(&tmp_name);
|
||||
name = &tmp_name;
|
||||
}
|
||||
if (target == NULL) {
|
||||
INSIST(name->buffer != NULL);
|
||||
target = name->buffer;
|
||||
isc_buffer_clear(name->buffer);
|
||||
}
|
||||
|
||||
REQUIRE(DNS_NAME_BINDABLE(name));
|
||||
target = name->buffer;
|
||||
isc_buffer_clear(target);
|
||||
|
||||
/*
|
||||
* Set up.
|
||||
@ -1583,8 +1579,7 @@ dns_name_concatenate(const dns_name_t *prefix, const dns_name_t *suffix,
|
||||
}
|
||||
|
||||
/*
|
||||
* If 'prefix' and 'name' are the same object, and the object has
|
||||
* a dedicated buffer, and we're using it, then we don't have to
|
||||
* If 'prefix' and 'name' are the same object, we don't have to
|
||||
* copy anything.
|
||||
*/
|
||||
if (copy_prefix && (prefix != name || prefix->buffer != target)) {
|
||||
|
@ -483,8 +483,7 @@ dns_nsec_noexistnodata(dns_rdatatype_t type, const dns_name_t *name,
|
||||
dns_name_getlabelsequence(&nsec.next, labels - nlabels,
|
||||
nlabels, &common);
|
||||
}
|
||||
result = dns_name_concatenate(dns_wildcardname, &common, wild,
|
||||
NULL);
|
||||
result = dns_name_concatenate(dns_wildcardname, &common, wild);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_rdata_freestruct(&nsec);
|
||||
(*logit)(arg, ISC_LOG_DEBUG(3),
|
||||
|
@ -2960,7 +2960,7 @@ find_wildcard(qpz_search_t *search, qpznode_t **nodep,
|
||||
* Construct the wildcard name for this level.
|
||||
*/
|
||||
result = dns_name_concatenate(dns_wildcardname,
|
||||
&node->name, wname, NULL);
|
||||
&node->name, wname);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ additionaldata_mx(ARGS_ADDLDATA) {
|
||||
|
||||
dns_fixedname_init(&fixed);
|
||||
result = dns_name_concatenate(&port25, &name,
|
||||
dns_fixedname_name(&fixed), NULL);
|
||||
dns_fixedname_name(&fixed));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ additionaldata_in_srv(ARGS_ADDLDATA) {
|
||||
}
|
||||
|
||||
result = dns_name_concatenate(dns_fixedname_name(&fixed), &name,
|
||||
dns_fixedname_name(&fixed), NULL);
|
||||
dns_fixedname_name(&fixed));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
@ -6929,8 +6929,7 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname,
|
||||
tname = dns_fixedname_initname(&fixed);
|
||||
nlabels = dns_name_countlabels(rname);
|
||||
dns_name_split(qname, nlabels, &prefix, NULL);
|
||||
result = dns_name_concatenate(&prefix, &dname.dname, tname,
|
||||
NULL);
|
||||
result = dns_name_concatenate(&prefix, &dname.dname, tname);
|
||||
if (result == DNS_R_NAMETOOLONG) {
|
||||
SET_IF_NOT_NULL(chainingp, true);
|
||||
return true;
|
||||
|
@ -1071,7 +1071,7 @@ name2data(dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
|
||||
n -= dns_name_countlabels(&rpz->nsdname);
|
||||
}
|
||||
dns_name_getlabelsequence(src_name, prefix_len, n, &tmp_name);
|
||||
(void)dns_name_concatenate(&tmp_name, dns_rootname, trig_name, NULL);
|
||||
(void)dns_name_concatenate(&tmp_name, dns_rootname, trig_name);
|
||||
}
|
||||
|
||||
#ifndef HAVE_BUILTIN_CLZ
|
||||
|
@ -432,7 +432,7 @@ make_key(const dns_rrl_t *rrl, dns_rrl_key_t *key,
|
||||
*/
|
||||
wild = dns_fixedname_initname(&fixed);
|
||||
result = dns_name_concatenate(dns_wildcardname, origin,
|
||||
wild, NULL);
|
||||
wild);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
/*
|
||||
* Fallback to use the zone's origin name
|
||||
|
@ -549,8 +549,8 @@ getnodedata(dns_db_t *db, const dns_name_t *name, bool create,
|
||||
fname = dns_fixedname_name(&fixed);
|
||||
dns_name_getlabelsequence(
|
||||
name, i + 1, dlabels - i - 1, fname);
|
||||
result = dns_name_concatenate(
|
||||
dns_wildcardname, fname, fname, NULL);
|
||||
result = dns_name_concatenate(dns_wildcardname,
|
||||
fname, fname);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
MAYBE_UNLOCK(sdlz->dlzimp);
|
||||
return result;
|
||||
|
@ -631,7 +631,7 @@ dns_ssutable_checkrules(dns_ssutable_t *table, const dns_name_t *signer,
|
||||
case dns_ssumatchtype_selfwild:
|
||||
wildcard = dns_fixedname_initname(&fixed);
|
||||
result = dns_name_concatenate(dns_wildcardname, signer,
|
||||
wildcard, NULL);
|
||||
wildcard);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (logit) {
|
||||
isc_log_write(
|
||||
|
@ -475,8 +475,7 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx,
|
||||
RETERR(isc_hex_totext(&r, 2, "", &b));
|
||||
RETERR(dns_name_fromtext(keyname, &b, NULL, 0, NULL));
|
||||
}
|
||||
RETERR(dns_name_concatenate(keyname, dns_rootname, keyname,
|
||||
NULL));
|
||||
RETERR(dns_name_concatenate(keyname, dns_rootname, keyname));
|
||||
|
||||
result = dns_tsigkey_find(&tsigkey, keyname, NULL, ring);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
|
@ -2610,8 +2610,7 @@ findnsec3proofs(dns_validator_t *val) {
|
||||
{
|
||||
val->attributes |= VALATTR_FOUNDCLOSEST;
|
||||
result = dns_name_concatenate(dns_wildcardname, closest,
|
||||
dns_fixedname_name(&val->wild),
|
||||
NULL);
|
||||
dns_fixedname_name(&val->wild));
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
} else {
|
||||
val->attributes &= ~VALATTR_FOUNDNOQNAME;
|
||||
|
@ -4881,7 +4881,7 @@ check_reportchannel(dns_zone_t *zone, dns_db_t *db) {
|
||||
* Otherwise, we need a '*._er' wildcard with a TXT rdataset.
|
||||
*/
|
||||
name = dns_fixedname_initname(&fixed);
|
||||
CHECK(dns_name_concatenate(&er, &zone->origin, name, NULL));
|
||||
CHECK(dns_name_concatenate(&er, &zone->origin, name));
|
||||
CHECK(dns_db_findnode(db, name, false, &node));
|
||||
|
||||
dns_db_currentversion(db, &version);
|
||||
|
@ -3181,7 +3181,7 @@ rpz_get_p_name(ns_client_t *client, dns_name_t *p_name, dns_rpz_zone_t *rpz,
|
||||
for (;;) {
|
||||
dns_name_getlabelsequence(trig_name, first, labels - first - 1,
|
||||
&prefix);
|
||||
result = dns_name_concatenate(&prefix, suffix, p_name, NULL);
|
||||
result = dns_name_concatenate(&prefix, suffix, p_name);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
@ -4900,9 +4900,8 @@ redirect2(ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset,
|
||||
dns_name_init(&prefix);
|
||||
dns_name_getlabelsequence(client->query.qname, 0, labels - 1,
|
||||
&prefix);
|
||||
result = dns_name_concatenate(&prefix,
|
||||
client->view->redirectzone,
|
||||
redirectname, NULL);
|
||||
result = dns_name_concatenate(
|
||||
&prefix, client->view->redirectzone, redirectname);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return ISC_R_NOTFOUND;
|
||||
}
|
||||
@ -4980,7 +4979,7 @@ redirect2(ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset,
|
||||
/*
|
||||
* Make the name absolute.
|
||||
*/
|
||||
result = dns_name_concatenate(found, dns_rootname, found, NULL);
|
||||
result = dns_name_concatenate(found, dns_rootname, found);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
|
||||
dns_name_copy(found, name);
|
||||
@ -7269,7 +7268,7 @@ query_rpzcname(query_ctx_t *qctx, dns_name_t *cname) {
|
||||
dns_fixedname_name(&suffix));
|
||||
result = dns_name_concatenate(dns_fixedname_name(&prefix),
|
||||
dns_fixedname_name(&suffix),
|
||||
qctx->fname, NULL);
|
||||
qctx->fname);
|
||||
if (result == DNS_R_NAMETOOLONG) {
|
||||
client->message->rcode = dns_rcode_yxdomain;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
@ -9271,8 +9270,8 @@ query_addnxrrsetnsec(query_ctx_t *qctx) {
|
||||
|
||||
dns_name_split(qctx->fname, sig.labels + 1, NULL, fname);
|
||||
/* This will succeed, since we've stripped labels. */
|
||||
RUNTIME_CHECK(dns_name_concatenate(dns_wildcardname, fname, fname,
|
||||
NULL) == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(dns_name_concatenate(dns_wildcardname, fname, fname) ==
|
||||
ISC_R_SUCCESS);
|
||||
query_addrrset(qctx, &fname, &qctx->rdataset, &qctx->sigrdataset, dbuf,
|
||||
DNS_SECTION_AUTHORITY);
|
||||
}
|
||||
@ -10385,7 +10384,7 @@ query_dname(query_ctx_t *qctx) {
|
||||
INSIST(qctx->fname == NULL);
|
||||
qctx->dbuf = ns_client_getnamebuf(qctx->client);
|
||||
qctx->fname = ns_client_newname(qctx->client, qctx->dbuf, &b);
|
||||
result = dns_name_concatenate(prefix, tname, qctx->fname, NULL);
|
||||
result = dns_name_concatenate(prefix, tname, qctx->fname);
|
||||
dns_message_puttempname(qctx->client->message, &tname);
|
||||
|
||||
/*
|
||||
@ -11190,8 +11189,7 @@ again:
|
||||
/*
|
||||
* Add the no wildcard proof.
|
||||
*/
|
||||
result = dns_name_concatenate(dns_wildcardname, cname, wname,
|
||||
NULL);
|
||||
result = dns_name_concatenate(dns_wildcardname, cname, wname);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
@ -11232,7 +11230,7 @@ again:
|
||||
dns_name_split(name, nlabels, NULL, wname);
|
||||
}
|
||||
result = dns_name_concatenate(dns_wildcardname, wname,
|
||||
wname, NULL);
|
||||
wname);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
have_wname = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user