if (!dns_name_isabsolute(name)) {
result = dns_name_concatenate(
name, lookup->oname,
- lookup->name, NULL);
+ lookup->name);
} else {
dns_name_copy(name, lookup->name);
}
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;
}
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;
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;
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;
* 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.
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:
*
*
*\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
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'.
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;
}
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.
}
/*
- * 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)) {
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),
* 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;
}
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;
}
}
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;
}
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;
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
*/
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
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;
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(
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) {
{
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;
* 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);
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;
}
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;
}
/*
* 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);
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) {
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);
}
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);
/*
/*
* 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;
}
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;
}