delv_log(ISC_LOG_ERROR,
"key '%s': invalid initialization method '%s'",
keynamestr, atstr);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
}
secretsize = (unsigned int)strlen(keysecret) * 3 / 4;
secretstore = isc_mem_allocate(isc_g_mctx, secretsize);
isc_buffer_init(&secretbuf, secretstore, secretsize);
- result = isc_base64_decodestring(keysecret, &secretbuf);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_base64_decodestring(keysecret, &secretbuf));
secretsize = isc_buffer_usedlength(&secretbuf);
if (hmac_alg == DST_ALG_UNKNOWN) {
- result = DST_R_UNSUPPORTEDALG;
- goto failure;
+ CHECK(DST_R_UNSUPPORTEDALG);
}
- result = dns_name_fromtext(keyname, namebuf, dns_rootname, 0);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(dns_name_fromtext(keyname, namebuf, dns_rootname, 0));
result = dns_tsigkey_create(keyname, hmac_alg, secretstore,
(int)secretsize, isc_g_mctx, &tsigkey);
-failure:
+cleanup:
if (result != ISC_R_SUCCESS) {
printf(";; Couldn't create key %s: %s\n", keynametext,
isc_result_totext(result));
return ISC_R_FILENOTFOUND;
}
- result = cfg_parse_file(isc_g_mctx, keyfile, &cfg_type_sessionkey, 0,
- &file);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_parse_file(isc_g_mctx, keyfile, &cfg_type_sessionkey, 0,
+ &file));
- result = cfg_map_get(file, "key", &keyobj);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_map_get(file, "key", &keyobj));
(void)cfg_map_get(keyobj, "secret", &secretobj);
(void)cfg_map_get(keyobj, "algorithm", &algorithmobj);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "Couldn't read key from %s: %s\n", keyfile,
isc_result_totext(result));
- goto failure;
+ goto cleanup;
}
switch (dst_key_alg(dstkey)) {
}
}
-failure:
+cleanup:
if (dstkey != NULL) {
dst_key_free(&dstkey);
}
if (result != ISC_R_SUCCESS) {
if (query->lookup->tls_ca_set) {
if (found_store == NULL) {
- result = isc_tls_cert_store_create(
- query->lookup->tls_ca_file, &store);
-
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_tls_cert_store_create(
+ query->lookup->tls_ca_file, &store));
} else {
store = found_store;
}
}
- result = isc_tlsctx_createclient(&ctx);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_tlsctx_createclient(&ctx));
if (store != NULL) {
const char *hostname = get_tls_sni_hostname(query);
* SubjectAltName must be checked. That is NOT the case
* for HTTPS.
*/
- result = isc_tlsctx_enable_peer_verification(
+ CHECK(isc_tlsctx_enable_peer_verification(
ctx, false, store, hostname,
- hostname_ignore_subject);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ hostname_ignore_subject));
}
if (query->lookup->tls_key_file_set &&
query->lookup->tls_cert_file_set)
{
- result = isc_tlsctx_load_certificate(
+ CHECK(isc_tlsctx_load_certificate(
ctx, query->lookup->tls_key_file,
- query->lookup->tls_cert_file);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ query->lookup->tls_cert_file));
}
if (!is_https) {
INSIST(!query->lookup->tls_ca_set || found_store != NULL);
return found_ctx;
-failure:
+cleanup:
if (ctx != NULL) {
isc_tlsctx_free(&ctx);
}
dns_rdataset_init(&rdataset);
- result = dns_db_findrdataset(gdb, node, gversion, dns_rdatatype_soa, 0,
- 0, &rdataset, NULL);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findrdataset(gdb, node, gversion, dns_rdatatype_soa, 0, 0,
+ &rdataset, NULL));
result = dns_rdataset_first(&rdataset);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_rdataset_init(&keysigs);
/* Make note of the keys which signed the SOA, if any */
- result = dns_db_findrdataset(gdb, node, currentversion,
- dns_rdatatype_soa, 0, 0, &rdataset,
- &soasigs);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findrdataset(gdb, node, currentversion, dns_rdatatype_soa,
+ 0, 0, &rdataset, &soasigs));
/* Preserve the TTL of the DNSKEY RRset, if any */
dns_rdataset_disassociate(&rdataset);
- result = dns_db_findrdataset(gdb, node, currentversion,
- dns_rdatatype_dnskey, 0, 0, &rdataset,
- &keysigs);
-
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findrdataset(gdb, node, currentversion,
+ dns_rdatatype_dnskey, 0, 0, &rdataset,
+ &keysigs));
if (set_keyttl && keyttl != rdataset.ttl) {
fprintf(stderr,
dns_rdataset_init(&rdataset);
orig_saltlen = sizeof(orig_salt);
- result = dns_db_getnsec3parameters(gdb, ver, &orig_hash, NULL,
- &orig_iter, orig_salt,
- &orig_saltlen);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_getnsec3parameters(gdb, ver, &orig_hash, NULL, &orig_iter,
+ orig_salt, &orig_saltlen));
nsec_datatype = dns_rdatatype_nsec3;
orig_saltlen);
check_result(result, "dns_nsec3_hashname");
- result = dns_db_findnsec3node(gdb, hashname, false, &node);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findnsec3node(gdb, hashname, false, &node));
- result = dns_db_findrdataset(gdb, node, ver, dns_rdatatype_nsec3, 0, 0,
- &rdataset, NULL);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findrdataset(gdb, node, ver, dns_rdatatype_nsec3, 0, 0,
+ &rdataset, NULL));
result = dns_rdataset_first(&rdataset);
check_result(result, "dns_rdataset_first");
if (needargs) {
if (argc != 3) {
- result = DNS_R_SYNTAX;
- goto cleanup;
+ CHECK(DNS_R_SYNTAX);
}
bdb->server = isc_mem_strdup(isc_g_mctx, argv[1]);
bdb->contact = isc_mem_strdup(isc_g_mctx, argv[2]);
} else if (argc != 1) {
- result = DNS_R_SYNTAX;
- goto cleanup;
+ CHECK(DNS_R_SYNTAX);
}
bdb->common.magic = DNS_DB_MAGIC;
ISC_LOG_INFO, "parsing user configuration from '%s'",
named_g_conffile);
- result = cfg_parse_file(isc_g_mctx, named_g_conffile,
- &cfg_type_namedconf, 0, conf);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_parse_file(isc_g_mctx, named_g_conffile, &cfg_type_namedconf,
+ 0, conf));
/*
* Check the validity of the configuration.
* checked later when the modules are actually loaded and
* registered.)
*/
- result = isccfg_check_namedconf(*conf, BIND_CHECK_ALGORITHMS,
- isc_g_mctx);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isccfg_check_namedconf(*conf, BIND_CHECK_ALGORITHMS, isc_g_mctx));
goto out;
/*
* Get system defaults.
*/
- result = named_config_getport(config, "port", &def_port);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(named_config_getport(config, "port", &def_port));
- result = named_config_getport(config, "tls-port", &def_tlsport);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(named_config_getport(config, "tls-port", &def_tlsport));
/*
* Process the (nested) list(s).
*/
- result = getipandkeylist(def_port, def_tlsport, config, list,
- (in_port_t)0, NULL, NULL, mctx, &s);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(getipandkeylist(def_port, def_tlsport, config, list, (in_port_t)0,
+ NULL, NULL, mctx, &s));
shrink_array(mctx, s.addrs, s.count, s.addrsallocated);
shrink_array(mctx, s.keys, s.count, s.keysallocated);
isc_buffer_init(&src, cmdline, strlen(cmdline));
isc_buffer_add(&src, strlen(cmdline));
- result = isc_lex_openbuffer(lex, &src);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_lex_openbuffer(lex, &src));
- result = getcommand(lex, &command);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(getcommand(lex, &command));
/*
* Compare the 'command' parameter against all known control commands.
"rejecting restricted control channel "
"command '%s'",
cmdline);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_CONTROL,
isc_region_t r;
isc_result_t result;
- result = isccc_cc_createresponse(conn->request, conn->now,
- conn->now + 60, &conn->response);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isccc_cc_createresponse(conn->request, conn->now, conn->now + 60,
+ &conn->response));
if (conn->result == ISC_R_SHUTTINGDOWN) {
result = ISC_R_SUCCESS;
}
if (!match) {
- result = ISCCC_R_BADAUTH;
- goto cleanup;
+ CHECK(ISCCC_R_BADAUTH);
}
/* We shouldn't be getting a reply. */
if (isccc_cc_isreply(conn->request)) {
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
conn->now = isc_stdtime_now();
*/
conn->ctrl = isccc_alist_lookup(conn->request, "_ctrl");
if (!isccc_alist_alistp(conn->ctrl)) {
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
if (isccc_cc_lookupuint32(conn->ctrl, "_tim", &sent) == ISC_R_SUCCESS) {
if ((sent + CLOCKSKEW) < conn->now ||
(sent - CLOCKSKEW) > conn->now)
{
- result = DNS_R_CLOCKSKEW;
- goto cleanup;
+ CHECK(DNS_R_CLOCKSKEW);
}
} else {
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
/*
if (isccc_cc_lookupuint32(conn->ctrl, "_exp", &exp) == ISC_R_SUCCESS &&
conn->now > exp)
{
- result = DNS_R_EXPIRED;
- goto cleanup;
+ CHECK(DNS_R_EXPIRED);
}
/*
ISC_R_SUCCESS ||
conn->nonce != nonce))
{
- result = ISCCC_R_BADAUTH;
- goto cleanup;
+ CHECK(ISCCC_R_BADAUTH);
}
isc_buffer_allocate(listener->mctx, &conn->text, 2 * 2048);
named_log_setdefaultchannels(lcfg);
}
- result = named_log_setdefaultcategory(lcfg);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(named_log_setdefaultcategory(lcfg));
named_log_setdefaultsslkeylogfile(lcfg);
rcu_read_unlock();
named_log_setdefaultcategory(isc_logconfig_t *lcfg) {
isc_result_t result = ISC_R_SUCCESS;
- result = isc_log_usechannel(lcfg, "default_debug",
- ISC_LOGCATEGORY_DEFAULT,
- ISC_LOGMODULE_DEFAULT);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_log_usechannel(lcfg, "default_debug", ISC_LOGCATEGORY_DEFAULT,
+ ISC_LOGMODULE_DEFAULT));
if (!named_g_logstderr) {
if (named_g_logfile != NULL) {
INIT_DS,
STATIC_DS,
TRUSTED
- } anchortype;
+ } anchortype = TRUSTED;
dst_algorithm_t algorithm;
REQUIRE(namestrp != NULL && *namestrp == NULL);
"key '%s': "
"invalid initialization method '%s'",
namestr, atstr);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
- } else {
- anchortype = TRUSTED;
}
isc_buffer_init(&databuf, data, sizeof(data));
"key '%s': "
"unknown ds digest type %u",
namestr, ds->digest_type);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
break;
}
isc_log_write(DNS_LOGCATEGORY_SECURITY,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"root key not loaded");
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
}
"managed-keys-directory '%s' "
"is not writable",
directory);
- result = ISC_R_NOPERM;
- goto cleanup;
+ CHECK(ISC_R_NOPERM);
}
}
obj = NULL;
(void)cfg_map_get(cpeer, "keys", &obj);
if (obj != NULL) {
- result = dns_peer_setkeybycharp(peer, cfg_obj_asstring(obj));
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_peer_setkeybycharp(peer, cfg_obj_asstring(obj)));
}
obj = NULL;
(void)cfg_map_get(cpeer, "transfer-source-v6", &obj);
}
if (obj != NULL) {
- result = dns_peer_settransfersource(peer,
- cfg_obj_assockaddr(obj));
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_peer_settransfersource(peer,
+ cfg_obj_assockaddr(obj)));
}
obj = NULL;
(void)cfg_map_get(cpeer, "notify-source-v6", &obj);
}
if (obj != NULL) {
- result = dns_peer_setnotifysource(peer,
- cfg_obj_assockaddr(obj));
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_peer_setnotifysource(peer, cfg_obj_assockaddr(obj)));
}
obj = NULL;
}
if (obj != NULL) {
INSIST(cfg_obj_issockaddr(obj));
- result = dns_peer_setquerysource(peer, cfg_obj_assockaddr(obj));
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_peer_setquerysource(peer, cfg_obj_assockaddr(obj)));
}
*peerp = peer;
"rpz '%s' is not a primary or a "
"secondary zone",
namebuf);
- result = ISC_R_NOTFOUND;
- goto cleanup;
+ CHECK(ISC_R_NOTFOUND);
}
}
}
(void)cfg_map_get(dlz, "search", &search);
if (search == NULL || cfg_obj_asboolean(search)) {
dlzdb->search = true;
- result = dns_dlzconfigure(
- view, dlzdb, dlzconfigure_callback);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_dlzconfigure(view, dlzdb,
+ dlzconfigure_callback));
ISC_LIST_APPEND(view->dlz_searched, dlzdb,
link);
} else {
obj = NULL;
(void)cfg_map_get(map, "clients", &obj);
if (obj != NULL) {
- result = cfg_acl_fromconfig(obj, config, aclctx,
- mctx, 0, &clients);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_acl_fromconfig(obj, config, aclctx,
+ mctx, 0, &clients));
}
obj = NULL;
(void)cfg_map_get(map, "mapped", &obj);
if (obj != NULL) {
- result = cfg_acl_fromconfig(obj, config, aclctx,
- mctx, 0, &mapped);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_acl_fromconfig(obj, config, aclctx,
+ mctx, 0, &mapped));
}
obj = NULL;
(void)cfg_map_get(map, "exclude", &obj);
if (obj != NULL) {
- result = cfg_acl_fromconfig(obj, config, aclctx,
- mctx, 0, &excluded);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_acl_fromconfig(obj, config, aclctx,
+ mctx, 0, &excluded));
} else {
if (named_g_mapped == NULL) {
- result = create_mapped_acl();
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(create_mapped_acl());
}
dns_acl_attach(named_g_mapped, &excluded);
}
&dns64);
dns_dns64_append(&view->dns64, dns64);
view->dns64cnt++;
- result = dns64_reverse(view, mctx, &na, prefixlen,
- server, contact);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns64_reverse(view, mctx, &na, prefixlen, server,
+ contact));
if (clients != NULL) {
dns_acl_detach(&clients);
}
if (dispatch4 == NULL && dispatch6 == NULL) {
UNEXPECTED_ERROR("unable to obtain either an IPv4 or"
" an IPv6 dispatch");
- result = ISC_R_UNEXPECTED;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTED);
}
CHECK(dns_view_createresolver(view, resopts, tlsctx_client_cache,
obj = NULL;
result = named_config_get(maps, "rate-limit", &obj);
if (result == ISC_R_SUCCESS) {
- result = configure_rrl(view, config, obj, aclctx);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(configure_rrl(view, config, obj, aclctx));
}
/*
ISC_LOG_ERROR,
"zone '%s': wrong class for view '%s'", zname,
vname);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
(void)cfg_map_get(zoptions, "in-view", &viewobj);
cfg_obj_log(zconfig, ISC_LOG_ERROR,
"'in-view' option is not permitted in "
"dynamically added zones");
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
result = dns_viewlist_find(viewlist, inview, view->rdclass,
if (result != ISC_R_SUCCESS) {
cfg_obj_log(zconfig, ISC_LOG_ERROR,
"view '%s' is not yet defined.", inview);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
result = dns_view_findzone(otherview, origin, DNS_ZTFIND_EXACT,
cfg_obj_log(zconfig, ISC_LOG_ERROR,
"zone '%s' not defined in view '%s'", zname,
inview);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
CHECK(dns_view_addzone(view, zone));
if (typeobj == NULL) {
cfg_obj_log(zconfig, ISC_LOG_ERROR,
"zone '%s' 'type' not specified", zname);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
ztypestr = cfg_obj_asstring(typeobj);
isc_log_write(NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"zone '%s': 'file' not specified", zname);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
if (dns_name_equal(origin, dns_rootname)) {
const char *hintsfile = cfg_obj_asstring(fileobj);
if (view->redirect != NULL) {
cfg_obj_log(zconfig, ISC_LOG_ERROR,
"redirect zone already exists");
- result = ISC_R_EXISTS;
- goto cleanup;
+ CHECK(ISC_R_EXISTS);
}
result = dns_viewlist_find(viewlist, view->name, view->rdclass,
&pview);
cfg_obj_log(zconfig, ISC_LOG_ERROR,
"zone '%s' already exists", zname);
dns_zone_detach(&dupzone);
- result = ISC_R_EXISTS;
- goto cleanup;
+ CHECK(ISC_R_EXISTS);
}
INSIST(dupzone == NULL);
}
if (fp == NULL) {
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_ERROR, "could not create %s", filename);
- result = ISC_R_NOPERM;
- goto cleanup;
+ CHECK(ISC_R_NOPERM);
}
fprintf(fp,
(char *)isc_buffer_base(&key_txtbuffer));
CHECK(isc_stdio_flush(fp));
- result = isc_stdio_close(fp);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_stdio_close(fp));
*keyp = key;
return ISC_R_SUCCESS;
INSIST(zone_config != NULL && zone_config_len > 0);
/* zone zonename { config; }; */
- result = isc_buffer_reserve(text, 6 + zone_name_len + 2 +
- zone_config_len + 2);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_buffer_reserve(text,
+ 6 + zone_name_len + 2 + zone_config_len + 2));
CHECK(putstr(text, "zone \""));
CHECK(putmem(text, (const void *)zone_name, zone_name_len));
CFG_LIST_FOREACH(listenlist, element) {
ns_listenelt_t *delt = NULL;
const cfg_obj_t *listener = cfg_listelt_value(element);
- result = listenelt_fromconfig(listener, config, aclctx, mctx,
- family, tlsctx_cache, &delt);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(listenelt_fromconfig(listener, config, aclctx, mctx,
+ family, tlsctx_cache, &delt));
ISC_LIST_APPEND(dlist->elts, delt, link);
}
*target = dlist;
"Error deleting zone %s "
"from NZD database: %s",
namebuf, mdb_strerror(status));
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
} else if (status != MDB_NOTFOUND) {
commit = true;
}
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"Unable to get options from config in "
"nzd_save()");
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
dzarg.magic = DZARG_MAGIC;
"Error writing zone config to "
"buffer in nzd_save(): %s",
isc_result_totext(dzarg.result));
- result = dzarg.result;
- goto cleanup;
+ CHECK(dzarg.result);
}
data.mv_data = isc_buffer_base(text);
"Error inserting zone in "
"NZD database: %s",
mdb_strerror(status));
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
commit = true;
origin = cfg_obj_asstring(cfg_tuple_get(zconfig, "name"));
if (origin == NULL) {
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
/* Normalize zone name */
zoptions = cfg_tuple_get(zconfig, "options");
if (zoptions == NULL) {
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
isc_buffer_clear(text);
"Error writing zone config to "
"buffer in load_nzf(): %s",
isc_result_totext(result));
- result = dzarg.result;
- goto cleanup;
+ CHECK(dzarg.result);
}
data.mv_data = isc_buffer_base(text);
"Error inserting zone in "
"NZD database: %s",
mdb_strerror(status));
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
commit = true;
TCHECK(putstr(text, "unable to open NZD database for '"));
TCHECK(putstr(text, view->newzone.db));
TCHECK(putstr(text, "'"));
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
#endif /* HAVE_LMDB */
CHECK(zone_from_args(server, lex, ptr, &zone, zonename, text, false));
if (zone == NULL) {
- result = ISC_R_UNEXPECTEDEND;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDEND);
}
INSIST(zonename != NULL);
TCHECK(putstr(text, zonename));
TCHECK(putstr(text,
"' cannot be deleted: response-policy zone."));
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
view = dns_zone_getview(zone);
/* Parse parameters */
CHECK(zone_from_args(server, lex, NULL, &zone, zonename, text, true));
if (zone == NULL) {
- result = ISC_R_UNEXPECTEDEND;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDEND);
}
zconfig = dns_zone_getcfg(zone);
CHECK(zone_from_args(server, lex, NULL, &zone, zonename, text, true));
if (zone == NULL) {
- result = ISC_R_UNEXPECTEDEND;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDEND);
}
/* Inline signing? */
} else {
snprintf(msg, sizeof(msg), "unknown command '%s'", cmd);
(void)putstr(text, msg);
- result = ISC_R_UNEXPECTED;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTED);
}
/* Look for the optional class name. */
if (zonestats != NULL) {
json_object *counters = json_object_new_object();
if (counters == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
+ CHECK(ISC_R_NOMEMORY);
}
result = dump_stats(zonestats, isc_statsformat_json,
if (gluecachestats != NULL) {
json_object *counters = json_object_new_object();
if (counters == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
+ CHECK(ISC_R_NOMEMORY);
}
result = dump_stats(
}
if (xfrinobj == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
+ CHECK(ISC_R_NOMEMORY);
}
result = dns_zone_getxfr(zone, &xfr, &is_firstrefresh, &is_running,
0);
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
- result = dumparg.result;
- goto cleanup;
+ CHECK(dumparg.result);
}
json_object_object_add(res, "adb",
result = (dns_name_fromtext(name, &namesrc, dns_rootname, \
DNS_NAME_DOWNCASE)); \
if (result != ISC_R_SUCCESS) { \
- goto failure; \
+ goto cleanup; \
}
#define parse_transport_option(map, transport, name, setter) \
}
return ISC_R_SUCCESS;
-failure:
+cleanup:
cfg_obj_log(doh, ISC_LOG_ERROR, "configuring DoH '%s': %s", dohid,
isc_result_totext(result));
tlsid = cfg_obj_asstring(cfg_map_getname(tls));
if (!strcmp(tlsid, "ephemeral")) {
- result = ISC_R_UNEXPECTEDTOKEN;
- goto failure;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
create_name(tlsid, tlsname);
}
return ISC_R_SUCCESS;
-failure:
+cleanup:
cfg_obj_log(tls, ISC_LOG_ERROR, "configuring tls '%s': %s", tlsid,
isc_result_totext(result));
dns_transport_set_tlsname(transport, "ephemeral");
return;
-failure:
+cleanup:
RUNTIME_CHECK(result == ISC_R_SUCCESS);
}
transport_list_add_ephemeral(list);
if (config != NULL) {
- result = transport_list_fromconfig(config, list);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(transport_list_fromconfig(config, list));
}
if (vconfig != NULL) {
*listp = list;
return ISC_R_SUCCESS;
-failure:
+cleanup:
dns_transport_list_detach(&list);
return result;
}
const char *keyid = NULL;
unsigned char *secret = NULL;
int secretalloc = 0;
- isc_result_t ret;
+ isc_result_t result;
CFG_LIST_FOREACH(list, element) {
const cfg_obj_t *algobj = NULL;
*/
isc_buffer_constinit(&keynamesrc, keyid, strlen(keyid));
isc_buffer_add(&keynamesrc, strlen(keyid));
- ret = dns_name_fromtext(keyname, &keynamesrc, dns_rootname,
- DNS_NAME_DOWNCASE);
- if (ret != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(dns_name_fromtext(keyname, &keynamesrc, dns_rootname,
+ DNS_NAME_DOWNCASE));
/*
* Create the algorithm.
"key '%s': has a "
"unsupported algorithm '%s'",
keyid, algstr);
- ret = DNS_R_BADALG;
- goto failure;
+ CHECK(DNS_R_BADALG);
}
secretstr = cfg_obj_asstring(secretobj);
secretalloc = secretlen = strlen(secretstr) * 3 / 4;
secret = isc_mem_get(mctx, secretlen);
isc_buffer_init(&secretbuf, secret, secretlen);
- ret = isc_base64_decodestring(secretstr, &secretbuf);
- if (ret != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_base64_decodestring(secretstr, &secretbuf));
secretlen = isc_buffer_usedlength(&secretbuf);
- ret = dns_tsigkey_create(keyname, alg, secret, secretlen, mctx,
- &tsigkey);
+ result = dns_tsigkey_create(keyname, alg, secret, secretlen,
+ mctx, &tsigkey);
isc_mem_put(mctx, secret, secretalloc);
- if (ret == ISC_R_SUCCESS) {
- ret = dns_tsigkeyring_add(ring, tsigkey);
+ if (result == ISC_R_SUCCESS) {
+ result = dns_tsigkeyring_add(ring, tsigkey);
}
- if (ret != ISC_R_SUCCESS) {
+ if (result != ISC_R_SUCCESS) {
if (tsigkey != NULL) {
dns_tsigkey_detach(&tsigkey);
}
- goto failure;
+ goto cleanup;
}
/*
* Set digest bits.
return ISC_R_SUCCESS;
-failure:
+cleanup:
if (secret != NULL) {
isc_mem_put(mctx, secret, secretalloc);
}
cfg_obj_log(key, ISC_LOG_ERROR, "configuring key '%s': %s", keyid,
- isc_result_totext(ret));
- return ret;
+ isc_result_totext(result));
+ return result;
}
isc_result_t
if (result != ISC_R_SUCCESS) {
continue;
}
- result = add_initial_keys(keylist, ring, mctx);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(add_initial_keys(keylist, ring, mctx));
}
*ringp = ring;
return ISC_R_SUCCESS;
-failure:
+cleanup:
dns_tsigkeyring_detach(&ring);
return result;
}
"failed to enable auto DDNS policy "
"for zone %s: session key not found",
zname);
- result = ISC_R_NOTFOUND;
- goto cleanup;
+ CHECK(ISC_R_NOTFOUND);
}
dns_ssutable_addrule(
"No NS record is configured for a "
"static-stub zone '%s'",
zname);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
/*
return ISC_R_FILENOTFOUND;
}
- result = cfg_parse_file(mctx, keyfile, &cfg_type_sessionkey, 0,
- &sessionkey);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_parse_file(mctx, keyfile, &cfg_type_sessionkey, 0,
+ &sessionkey));
- result = cfg_map_get(sessionkey, "key", &key);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_map_get(sessionkey, "key", &key));
(void)cfg_map_get(key, "secret", &secretobj);
(void)cfg_map_get(key, "algorithm", &algorithmobj);
if (argc != 2) {
log_error("exactly two parameters "
"(absolute zone names) are required");
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
result = dns_name_fromstring(z1, argv[0], dns_rootname, 0, mctx);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
- result = loadjournal(olddb, journal);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(loadjournal(olddb, journal));
result = dns_db_getsoaserial(olddb, NULL, &s2);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
isc_buffer_add(&buffer, size);
isc_buffer_setactive(&buffer, size);
- result = parse_message(&buffer, &message);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(parse_message(&buffer, &message));
- result = print_message(message);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(print_message(message));
- result = render_message(&message);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(render_message(&message));
- result = print_message(message);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(print_message(message));
cleanup:
if (message != NULL) {
RUNTIME_CHECK(isc_lex_openbuffer(lex, &inbuf) == ISC_R_SUCCESS);
- result = isc_lex_gettoken(lex, options | ISC_LEXOPT_NUMBER, &token);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_lex_gettoken(lex, options | ISC_LEXOPT_NUMBER, &token));
if (token.type == isc_tokentype_eof) {
goto cleanup;
}
}
rdclass = (dns_rdataclass_t)token.value.as_ulong;
} else if (token.type == isc_tokentype_string) {
- result = dns_rdataclass_fromtext(&rdclass,
- &token.value.as_textregion);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdataclass_fromtext(&rdclass,
+ &token.value.as_textregion));
} else {
goto cleanup;
}
- result = isc_lex_gettoken(lex, options | ISC_LEXOPT_NUMBER, &token);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_lex_gettoken(lex, options | ISC_LEXOPT_NUMBER, &token));
if (token.type == isc_tokentype_eol) {
goto cleanup;
}
}
rdtype = (dns_rdatatype_t)token.value.as_ulong;
} else if (token.type == isc_tokentype_string) {
- result = dns_rdatatype_fromtext(&rdtype,
- &token.value.as_textregion);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdatatype_fromtext(&rdtype,
+ &token.value.as_textregion));
} else {
goto cleanup;
}
/*
* Create the database
*/
- result = cache_create_db(cache, &cache->db, &cache->tmctx,
- &cache->hmctx);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cache_create_db(cache, &cache->db, &cache->tmctx, &cache->hmctx));
*cachep = cache;
return ISC_R_SUCCESS;
nodename = dns_fixedname_initname(&fnodename);
- result = dns_db_createiterator(db, 0, &iter);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_createiterator(db, 0, &iter));
result = dns_dbiterator_seek(iter, name);
if (result == DNS_R_PARTIALMATCH) {
}
if (dns_name_countlabels(&ptr.ptr) == 0) {
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
- result = isc_ht_find(catz->entries, mhash->base, mhash->length,
- (void **)&entry);
- if (result != ISC_R_SUCCESS) {
- /* The entry was not found .*/
- goto cleanup;
- }
+ CHECK(isc_ht_find(catz->entries, mhash->base, mhash->length,
+ (void **)&entry));
if (dns_name_countlabels(&entry->name) == 0) {
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
catz_coo_add(catz, entry, &ptr.ptr);
return result;
}
- result = dns_rdata_txt_first(&rdatatxt);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdata_txt_first(&rdatatxt));
- result = dns_rdata_txt_current(&rdatatxt, &rdatastr);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdata_txt_current(&rdatatxt, &rdatastr));
result = dns_rdata_txt_next(&rdatatxt);
if (result != ISC_R_NOMORE) {
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
if (rdatastr.length > 15) {
- result = ISC_R_BADNUMBER;
- goto cleanup;
+ CHECK(ISC_R_BADNUMBER);
}
memmove(t, rdatastr.data, rdatastr.length);
t[rdatastr.length] = 0;
- result = isc_parse_uint32(&tversion, t, 10);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_parse_uint32(&tversion, t, 10));
catz->version = tversion;
result = ISC_R_SUCCESS;
isc_buffer_putstr(tbuf, catz->catzs->view->name);
isc_buffer_putstr(tbuf, "_");
- result = dns_name_totext(&catz->name, DNS_NAME_OMITFINALDOT, tbuf);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_name_totext(&catz->name, DNS_NAME_OMITFINALDOT, tbuf));
isc_buffer_putstr(tbuf, "_");
- result = dns_name_totext(&entry->name, DNS_NAME_OMITFINALDOT, tbuf);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_name_totext(&entry->name, DNS_NAME_OMITFINALDOT, tbuf));
/*
* Search for slash and other special characters in the view and
rlen += strlen(entry->opts.zonedir) + 1;
}
- result = isc_buffer_reserve(*buffer, (unsigned int)rlen);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_buffer_reserve(*buffer, (unsigned int)rlen));
if (entry->opts.zonedir != NULL) {
isc_buffer_putstr(*buffer, entry->opts.zonedir);
unsigned int digestlen;
/* we can do that because digest string < 2 * DNS_NAME */
- result = isc_md(ISC_MD_SHA256, r.base, r.length, digest,
- &digestlen);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = digest2hex(digest, digestlen, (char *)r.base,
- ISC_SHA256_DIGESTLENGTH * 2 + 1);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_md(ISC_MD_SHA256, r.base, r.length, digest,
+ &digestlen));
+ CHECK(digest2hex(digest, digestlen, (char *)r.base,
+ ISC_SHA256_DIGESTLENGTH * 2 + 1));
isc_buffer_putstr(*buffer, (char *)r.base);
} else {
isc_buffer_copyregion(*buffer, &r);
"catz: zone '%s' uses an invalid primary "
"(no IP address assigned)",
zname);
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
isc_netaddr_fromsockaddr(&netaddr,
&entry->opts.masters.addrs[i]);
if (entry->opts.masters.keys[i] != NULL) {
isc_buffer_putstr(buffer, " key ");
- result = dns_name_totext(entry->opts.masters.keys[i],
- DNS_NAME_OMITFINALDOT, buffer);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_name_totext(entry->opts.masters.keys[i],
+ DNS_NAME_OMITFINALDOT, buffer));
}
if (entry->opts.masters.tlss[i] != NULL) {
isc_buffer_putstr(buffer, " tls ");
- result = dns_name_totext(entry->opts.masters.tlss[i],
- DNS_NAME_OMITFINALDOT, buffer);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_name_totext(entry->opts.masters.tlss[i],
+ DNS_NAME_OMITFINALDOT, buffer));
}
isc_buffer_putstr(buffer, "; ");
}
isc_buffer_putstr(buffer, "}; ");
if (!entry->opts.in_memory) {
isc_buffer_putstr(buffer, "file \"");
- result = dns_catz_generate_masterfilename(catz, entry, &buffer);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_catz_generate_masterfilename(catz, entry, &buffer));
isc_buffer_putstr(buffer, "\"; ");
}
if (entry->opts.allow_query != NULL) {
LOCK(&catzs->lock);
if (catzs->zones == NULL) {
- result = ISC_R_SHUTTINGDOWN;
- goto cleanup;
- }
- result = isc_ht_find(catzs->zones, r.base, r.length, (void **)&catz);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
+ CHECK(ISC_R_SHUTTINGDOWN);
}
+ CHECK(isc_ht_find(catzs->zones, r.base, r.length, (void **)&catz));
/* New zone came as AXFR */
if (catz->db != NULL && catz->db != db) {
isc_result_t result;
isc_portset_create(mctx, &v4portset);
- result = isc_net_getudpportrange(AF_INET, &udpport_low, &udpport_high);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_net_getudpportrange(AF_INET, &udpport_low, &udpport_high));
isc_portset_addrange(v4portset, udpport_low, udpport_high);
isc_portset_create(mctx, &v6portset);
- result = isc_net_getudpportrange(AF_INET6, &udpport_low, &udpport_high);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_net_getudpportrange(AF_INET6, &udpport_low, &udpport_high));
isc_portset_addrange(v6portset, udpport_low, udpport_high);
result = dns_dispatchmgr_setavailports(manager, v4portset, v6portset);
.link = ISC_LINK_INITIALIZER,
};
- result = getrdataset(mctx, &rdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(getrdataset(mctx, &rdataset));
rctx->rdataset = rdataset;
if (want_dnssec) {
- result = getrdataset(mctx, &sigrdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(getrdataset(mctx, &sigrdataset));
}
rctx->sigrdataset = sigrdataset;
/* Create a new database using implementation 'drivername'. */
result = ((impinfo->methods->create)(mctx, dlzname, argc, argv,
impinfo->driverarg, &db->dbdata));
-
RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
- /* mark the DLZ driver as valid */
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(result);
+ /* Mark the DLZ driver as valid */
db->magic = DNS_DLZ_MAGIC;
isc_mem_attach(mctx, &db->mctx);
isc_log_write(DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ,
ISC_LOG_DEBUG(2), "DLZ driver loaded successfully.");
*dbp = db;
return ISC_R_SUCCESS;
-failure:
+cleanup:
isc_log_write(DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ,
ISC_LOG_ERROR, "DLZ driver failed to load.");
isc_buffer_constinit(&buffer, zone_name, strlen(zone_name));
isc_buffer_add(&buffer, strlen(zone_name));
dns_fixedname_init(&fixorigin);
- result = dns_name_fromtext(dns_fixedname_name(&fixorigin), &buffer,
- dns_rootname, 0);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_name_fromtext(dns_fixedname_name(&fixorigin), &buffer,
+ dns_rootname, 0));
origin = dns_fixedname_name(&fixorigin);
if (!dlzdb->search) {
result = dns_view_findzone(view, origin, DNS_ZTFIND_EXACT, &dupzone);
if (result == ISC_R_SUCCESS) {
dns_zone_detach(&dupzone);
- result = ISC_R_EXISTS;
- goto cleanup;
+ CHECK(ISC_R_EXISTS);
}
INSIST(dupzone == NULL);
}
dns_zone_setssutable(zone, dlzdb->ssutable);
- result = dlzdb->configure_callback(view, dlzdb, zone);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dlzdb->configure_callback(view, dlzdb, zone));
result = dns_view_addzone(view, zone);
newctx->drop = ictx->drop;
}
- result = (lctx->openfile)(lctx, master_file);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK((lctx->openfile)(lctx, master_file));
newctx->parent = ictx;
lctx->inc = newctx;
sizeof(uint16_t) + sizeof(uint16_t) +
sizeof(uint32_t) + sizeof(uint32_t);
if (totallen < minlen) {
- result = ISC_R_RANGE;
- goto cleanup;
+ CHECK(ISC_R_RANGE);
}
totallen -= sizeof(totallen);
*/
readlen = totallen;
}
- result = isc_stdio_read(target.base, 1, readlen, lctx->f, NULL);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_stdio_read(target.base, 1, readlen, lctx->f, NULL));
isc_buffer_add(&target, (unsigned int)readlen);
totallen -= (uint32_t)readlen;
dns_rdatalist_init(&rdatalist);
rdatalist.rdclass = isc_buffer_getuint16(&target);
if (lctx->zclass != rdatalist.rdclass) {
- result = DNS_R_BADCLASS;
- goto cleanup;
+ CHECK(DNS_R_BADCLASS);
}
rdatalist.type = isc_buffer_getuint16(&target);
rdatalist.covers = isc_buffer_getuint16(&target);
rdatalist.ttl = isc_buffer_getuint32(&target);
rdcount = isc_buffer_getuint32(&target);
if (rdcount == 0 || rdcount > 0xffff) {
- result = ISC_R_RANGE;
- goto cleanup;
+ CHECK(ISC_R_RANGE);
}
INSIST(isc_buffer_consumedlength(&target) <= readlen);
/* Owner name: length followed by name */
- result = read_and_check(sequential_read, &target,
- sizeof(namelen), lctx->f, &totallen);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(read_and_check(sequential_read, &target, sizeof(namelen),
+ lctx->f, &totallen));
namelen = isc_buffer_getuint16(&target);
if (namelen > sizeof(namebuf)) {
- result = ISC_R_RANGE;
- goto cleanup;
+ CHECK(ISC_R_RANGE);
}
- result = read_and_check(sequential_read, &target, namelen,
- lctx->f, &totallen);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(read_and_check(sequential_read, &target, namelen, lctx->f,
+ &totallen));
isc_buffer_setactive(&target, (unsigned int)namelen);
- result = dns_name_fromwire(name, &target, dctx, NULL);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_name_fromwire(name, &target, dctx, NULL));
if ((lctx->options & DNS_MASTER_CHECKTTL) != 0 &&
rdatalist.ttl > lctx->maxttl)
"TTL %d exceeds configured "
"max-zone-ttl %d",
rdatalist.ttl, lctx->maxttl);
- result = ISC_R_RANGE;
- goto cleanup;
+ CHECK(ISC_R_RANGE);
}
/* Rdata contents. */
}
/* rdata length */
- result = read_and_check(sequential_read, &target,
- sizeof(rdlen), lctx->f,
- &totallen);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(read_and_check(sequential_read, &target,
+ sizeof(rdlen), lctx->f,
+ &totallen));
rdlen = isc_buffer_getuint16(&target);
/* rdata */
- result = read_and_check(sequential_read, &target, rdlen,
- lctx->f, &totallen);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(read_and_check(sequential_read, &target, rdlen,
+ lctx->f, &totallen));
isc_buffer_setactive(&target, (unsigned int)rdlen);
/*
* It is safe to have the source active region and
*/
isc_buffer_init(&buf, isc_buffer_current(&target),
(unsigned int)rdlen);
- result = dns_rdata_fromwire(
- &rdata[i], rdatalist.rdclass, rdatalist.type,
- &target, dctx, &buf);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdata_fromwire(&rdata[i], rdatalist.rdclass,
+ rdatalist.type, &target, dctx,
+ &buf));
ISC_LIST_APPEND(rdatalist.rdata, &rdata[i], link);
}
* or malformed data.
*/
if (isc_buffer_remaininglength(&target) != 0 || totallen != 0) {
- result = ISC_R_RANGE;
- goto cleanup;
+ CHECK(ISC_R_RANGE);
}
ISC_LIST_APPEND(head, &rdatalist, link);
lctx->maxttl = maxttl;
- result = (lctx->openfile)(lctx, master_file);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK((lctx->openfile)(lctx, master_file));
result = (lctx->load)(lctx);
INSIST(result != DNS_R_CONTINUE);
loadctx_create(dns_masterformat_text, mctx, options, 0, top, zclass,
origin, callbacks, NULL, NULL, NULL, NULL, NULL, &lctx);
- result = isc_lex_openbuffer(lctx->lex, buffer);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_lex_openbuffer(lctx->lex, buffer));
result = (lctx->load)(lctx);
INSIST(result != DNS_R_CONTINUE);
} else {
options = 0;
}
- result = dns_db_createiterator(dctx->db, options, &dctx->dbiter);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_createiterator(dctx->db, options, &dctx->dbiter));
isc_mutex_init(&dctx->lock);
isc_mem_attach(mctx, &dctx->mctx);
tempnamelen = strlen(file) + 20;
tempname = isc_mem_allocate(mctx, tempnamelen);
- result = isc_file_mktemplate(file, tempname, tempnamelen);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_file_mktemplate(file, tempname, tempnamelen));
result = isc_file_openunique(tempname, &f);
if (result != ISC_R_SUCCESS) {
return result;
}
- result = dumpctx_create(mctx, db, version, style, f, &dctx, format,
- header);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dumpctx_create(mctx, db, version, style, f, &dctx, format,
+ header));
result = dumptostream(dctx);
INSIST(result != DNS_R_CONTINUE);
*/
isc_buffer_remainingregion(source, &r);
isc_buffer_setactive(source, r.length);
- result = getname(name, source, msg, dctx);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(getname(name, source, msg, dctx));
ISC_LIST_APPEND(*section, name, link);
*/
isc_buffer_remainingregion(source, &r);
if (r.length < 4) {
- result = ISC_R_UNEXPECTEDEND;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDEND);
}
rdtype = isc_buffer_getuint16(source);
rdclass = isc_buffer_getuint16(source);
*/
isc_buffer_remainingregion(source, &r);
isc_buffer_setactive(source, r.length);
- result = getname(name, source, msg, dctx);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(getname(name, source, msg, dctx));
/*
* Get type, class, ttl, and rdatalen. Verify that at least
*/
isc_buffer_remainingregion(source, &r);
if (r.length < 2 + 2 + 4 + 2) {
- result = ISC_R_UNEXPECTEDEND;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDEND);
}
rdtype = isc_buffer_getuint16(source);
rdclass = isc_buffer_getuint16(source);
rdatalen = isc_buffer_getuint16(source);
r.length -= (2 + 2 + 4 + 2);
if (r.length < rdatalen) {
- result = ISC_R_UNEXPECTEDEND;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDEND);
}
/*
update(sectionid, rdclass))
{
if (rdatalen != 0) {
- result = DNS_R_FORMERR;
- goto cleanup;
+ CHECK(DNS_R_FORMERR);
}
/*
* When the rdata is empty, the data pointer is
if (rdtype == dns_rdatatype_nsec3 &&
!dns_rdata_checkowner(name, msg->rdclass, rdtype, false))
{
- result = DNS_R_BADOWNERNAME;
- goto cleanup;
+ CHECK(DNS_R_BADOWNERNAME);
}
/*
msgresetopt(msg);
- result = dns_rdataset_first(opt);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdataset_first(opt));
dns_rdataset_current(opt, &rdata);
msg->opt_reserved = 11 + rdata.length;
result = dns_message_renderreserve(msg, msg->opt_reserved);
if (isc_buffer_availablelength(target) <
1)
{
- result = ISC_R_NOSPACE;
- goto cleanup;
+ CHECK(ISC_R_NOSPACE);
}
isc_buffer_putmem(target, &data[i], 1);
} else {
switch (optcode) {
case DNS_OPT_LLQ:
if (optlen == 18U) {
- result = render_llq(&optbuf, msg, style,
- target);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(render_llq(&optbuf, msg, style,
+ target));
ADD_STRING(target, "\n");
continue;
}
ADD_STRING(target, buf);
ADD_STRING(target, " # ");
- result = dns_ttl_totext(secs, true,
- true, target);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_ttl_totext(secs, true, true,
+ target));
ADD_STRING(target, "\n");
if (optlen == 8U) {
ADD_STRING(target, buf);
ADD_STRING(target, " # ");
- result = dns_ttl_totext(
- key, true, true,
- target);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_ttl_totext(key, true,
+ true,
+ target));
ADD_STRING(target, "\n");
}
continue;
snprintf(buf, sizeof(buf), " %u", secs);
ADD_STRING(target, buf);
ADD_STRING(target, " # ");
- result = dns_ttl_totext(secs, true,
- true, target);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_ttl_totext(secs, true, true,
+ target));
ADD_STRING(target, "\n");
continue;
}
if (optlen >= 2U) {
isc_buffer_t zonebuf = optbuf;
isc_buffer_setactive(&zonebuf, optlen);
- result = render_zoneversion(
- msg, &zonebuf, style, target);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(render_zoneversion(
+ msg, &zonebuf, style, target));
isc_buffer_forward(&optbuf, optlen);
ADD_STRING(target, "\n");
continue;
ADD_STRING(target, buf);
}
ADD_STRING(target, " (");
- result = dns_ttl_totext(secs, true,
- true, target);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_ttl_totext(secs, true, true,
+ target));
if (optlen == 8U) {
ADD_STRING(target, "/");
- result = dns_ttl_totext(
- key, true, true,
- target);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_ttl_totext(key, true,
+ true,
+ target));
}
ADD_STRING(target, ")\n");
continue;
if (optlen >= 2U) {
isc_buffer_t zonebuf = optbuf;
isc_buffer_setactive(&zonebuf, optlen);
- result = render_zoneversion(
- msg, &zonebuf, style, target);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(render_zoneversion(
+ msg, &zonebuf, style, target));
ADD_STRING(target, "\n");
isc_buffer_forward(&optbuf, optlen);
continue;
}
if (len > 0xffffU) {
- result = ISC_R_NOSPACE;
- goto cleanup;
+ CHECK(ISC_R_NOSPACE);
}
isc_buffer_allocate(message->mctx, &buf, len);
goto cleanup;
}
- result = notify_createmessage(notify, &message);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(notify_createmessage(notify, &message));
if (notify->key != NULL) {
/* Transfer ownership of key */
isc_sockaddr_any6(&newnotify->src);
}
startup = ((notify->flags & DNS_NOTIFY_STARTUP) != 0);
- result = dns_notify_queue(newnotify, startup);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_notify_queue(newnotify, startup));
newnotify = NULL;
}
dns_rdataset_init(&rdataset);
dns_rdata_init(&rdata);
- result = dns_nsec_buildrdata(db, version, node, target, data, &rdata);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(dns_nsec_buildrdata(db, version, node, target, data, &rdata));
dns_rdatalist_init(&rdatalist);
rdatalist.rdclass = dns_db_class(db);
result = ISC_R_SUCCESS;
}
-failure:
+cleanup:
if (dns_rdataset_isassociated(&rdataset)) {
dns_rdataset_disassociate(&rdataset);
}
}
first = false;
- result = putstr(buf, obuf);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(putstr(buf, obuf));
}
cleanup:
result = dns_rdataset_getnoqname(rdataset, &name, &neg, &negsig);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
- result = dns_rdataslab_fromrdataset(&neg, mctx, &r1, maxrrperset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdataslab_fromrdataset(&neg, mctx, &r1, maxrrperset));
- result = dns_rdataslab_fromrdataset(&negsig, mctx, &r2, maxrrperset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdataslab_fromrdataset(&negsig, mctx, &r2, maxrrperset));
noqname = isc_mem_get(mctx, sizeof(*noqname));
*noqname = (dns_slabheader_proof_t){
result = dns_rdataset_getclosest(rdataset, &name, &neg, &negsig);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
- result = dns_rdataslab_fromrdataset(&neg, mctx, &r1, maxrrperset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdataslab_fromrdataset(&neg, mctx, &r1, maxrrperset));
- result = dns_rdataslab_fromrdataset(&negsig, mctx, &r2, maxrrperset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdataslab_fromrdataset(&negsig, mctx, &r2, maxrrperset));
closest = isc_mem_get(mctx, sizeof(*closest));
*closest = (dns_slabheader_proof_t){
isc_buffer_allocate(mctx, &buf, token.value.as_ulong);
if (token.value.as_ulong != 0U) {
- result = isc_hex_tobuffer(lexer, buf,
- (unsigned int)token.value.as_ulong);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_hex_tobuffer(lexer, buf,
+ (unsigned int)token.value.as_ulong));
if (isc_buffer_usedlength(buf) != token.value.as_ulong) {
- result = ISC_R_UNEXPECTEDEND;
- goto failure;
+ CHECK(ISC_R_UNEXPECTEDEND);
}
}
isc_buffer_usedregion(buf, &r);
result = isc_buffer_copyregion(target, &r);
}
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(result);
isc_buffer_free(&buf);
return ISC_R_SUCCESS;
-failure:
+cleanup:
isc_buffer_free(&buf);
return result;
}
* than ncount, then we found such a duplicate.
*/
if (((flags & DNS_RDATASLAB_EXACT) != 0) && (tcount < ncount)) {
- result = DNS_R_NOTEXACT;
- goto cleanup;
+ CHECK(DNS_R_NOTEXACT);
}
/*
* FORCE flag isn't set, we're done.
*/
if (tcount == 0 && (flags & DNS_RDATASLAB_FORCE) == 0) {
- result = DNS_R_UNCHANGED;
- goto cleanup;
+ CHECK(DNS_R_UNCHANGED);
}
/* Add to tcount the total number of items from the old slab. */
/* Single types can't have more than one RR. */
if (tcount > 1 && dns_rdatatype_issingleton(type)) {
- result = DNS_R_SINGLETON;
- goto cleanup;
+ CHECK(DNS_R_SINGLETON);
}
if (tcount > 0xffff) {
- result = ISC_R_NOSPACE;
- goto cleanup;
+ CHECK(ISC_R_NOSPACE);
}
/* Allocate the target buffer and copy the new slab's header */
* duplicates.)
*/
if ((flags & DNS_RDATASLAB_EXACT) != 0 && rcount != scount) {
- result = DNS_R_NOTEXACT;
- goto cleanup;
+ CHECK(DNS_R_NOTEXACT);
}
/*
* create a new buffer, just return.
*/
if (tcount == 0) {
- result = DNS_R_NXRRSET;
- goto cleanup;
+ CHECK(DNS_R_NXRRSET);
}
/*
* If nothing is going to change, stop.
*/
if (rcount == 0) {
- result = DNS_R_UNCHANGED;
- goto cleanup;
+ CHECK(DNS_R_UNCHANGED);
}
/*
timeout, udptimeout, udpretries);
isc_buffer_allocate(mctx, &request->query, r.length + (tcp ? 2 : 0));
- result = isc_buffer_copyregion(request->query, &r);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_buffer_copyregion(request->query, &r));
again:
- result = get_dispatch(tcp, newtcp, requestmgr, srcaddr, destaddr,
- transport, &request->dispatch);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(get_dispatch(tcp, newtcp, requestmgr, srcaddr, destaddr,
+ transport, &request->dispatch));
if ((options & DNS_REQUESTOPT_FIXEDID) != 0) {
id = (r.base[0] << 8) | r.base[1];
dns_tsigkey_attach(key, &request->tsigkey);
}
- result = dns_message_settsigkey(message, request->tsigkey);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_message_settsigkey(message, request->tsigkey));
again:
- result = get_dispatch(tcp, false, requestmgr, srcaddr, destaddr,
- transport, &request->dispatch);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(get_dispatch(tcp, false, requestmgr, srcaddr, destaddr, transport,
+ &request->dispatch));
- result = dns_dispatch_add(request->dispatch, loop, 0,
- request->connect_timeout, request->timeout,
- destaddr, transport, tlsctx_cache,
- req_connected, req_senddone, req_response,
- request, &id, &request->dispentry);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_dispatch_add(request->dispatch, loop, 0,
+ request->connect_timeout, request->timeout,
+ destaddr, transport, tlsctx_cache, req_connected,
+ req_senddone, req_response, request, &id,
+ &request->dispentry));
message->id = id;
result = req_render(message, &request->query, options, mctx);
goto cleanup;
}
- result = dns_message_getquerytsig(message, mctx, &request->tsig);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_message_getquerytsig(message, mctx, &request->tsig));
request->destaddr = *destaddr;
request->flags |= DNS_REQUEST_F_CONNECTING;
/*
* Render message.
*/
- result = dns_message_renderbegin(message, &cctx, buf1);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_message_rendersection(message, DNS_SECTION_QUESTION, 0);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_message_rendersection(message, DNS_SECTION_ANSWER, 0);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_message_rendersection(message, DNS_SECTION_AUTHORITY, 0);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_message_rendersection(message, DNS_SECTION_ADDITIONAL, 0);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_message_renderend(message);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_message_renderbegin(message, &cctx, buf1));
+ CHECK(dns_message_rendersection(message, DNS_SECTION_QUESTION, 0));
+ CHECK(dns_message_rendersection(message, DNS_SECTION_ANSWER, 0));
+ CHECK(dns_message_rendersection(message, DNS_SECTION_AUTHORITY, 0));
+ CHECK(dns_message_rendersection(message, DNS_SECTION_ADDITIONAL, 0));
+ CHECK(dns_message_renderend(message));
/*
* Copy rendered message to exact sized buffer.
*/
isc_buffer_usedregion(buf1, &r);
if ((options & DNS_REQUESTOPT_TCP) == 0 && r.length > 512) {
- result = DNS_R_USETCP;
- goto cleanup;
+ CHECK(DNS_R_USETCP);
}
isc_buffer_allocate(mctx, &buf2, r.length);
- result = isc_buffer_copyregion(buf2, &r);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_buffer_copyregion(buf2, &r));
/*
* Cleanup and return.
address = isc_mem_get(mctx, sizeof(*address));
if (res->ai_addrlen > sizeof(address->type)) {
isc_mem_put(mctx, address, sizeof(*address));
- result = ISC_R_RANGE;
- goto cleanup;
+ CHECK(ISC_R_RANGE);
}
if (res->ai_family == AF_INET) {
isc_mem_put(mctx, address, sizeof(*address));
UNEXPECTED_ERROR("ai_family (%d) not INET nor INET6",
res->ai_family);
- result = ISC_R_UNEXPECTED;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTED);
}
address->length = (unsigned int)res->ai_addrlen;
fcount_decr(fctx);
dns_name_copy(fname, fctx->domain);
- result = fcount_incr(fctx, false);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(fcount_incr(fctx, false));
dns_name_copy(dcname, fctx->qmindcname);
fctx->ns_ttl = fctx->nameservers.ttl;
{
MSG_SECTION_FOREACH(message, section, name) {
if (name->attributes.cache) {
- result = rctx_cachename(rctx, message, name);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(rctx_cachename(rctx, message, name));
}
}
}
fcount_decr(fctx);
dns_name_copy(fctx->nsname, fctx->domain);
- result = fcount_incr(fctx, false);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(fcount_incr(fctx, false));
/* Try again. */
fctx_try(fctx, true);
* made. Interrupt the DS chasing process, returning SERVFAIL.
*/
if (dns_name_equal(fctx->nsname, fetch->private->domain)) {
- result = DNS_R_SERVFAIL;
- goto cleanup;
+ CHECK(DNS_R_SERVFAIL);
}
/* Get nameservers from fetch before we destroy it. */
" spilled %" PRIuFAST32 ")",
nb, count, allowed, dropped);
- result = isc_buffer_reserve(buf, strlen(text));
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_buffer_reserve(buf, strlen(text)));
isc_buffer_putstr(buf, text);
}
if (result == ISC_R_NOMORE) {
dns_rdataset_init(&rootns);
(void)dns_db_find(db, dns_rootname, NULL, dns_rdatatype_ns, 0, now,
NULL, name, &rootns, NULL);
- result = dns_db_createiterator(db, 0, &dbiter);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_createiterator(db, 0, &dbiter));
DNS_DBITERATOR_FOREACH(dbiter) {
- result = dns_dbiterator_current(dbiter, &node, name);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_db_allrdatasets(db, node, NULL, 0, now, &rdsiter);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = check_node(&rootns, name, rdsiter);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_dbiterator_current(dbiter, &node, name));
+ CHECK(dns_db_allrdatasets(db, node, NULL, 0, now, &rdsiter));
+ CHECK(check_node(&rootns, name, rdsiter));
dns_rdatasetiter_destroy(&rdsiter);
dns_db_detachnode(&node);
}
REQUIRE(target != NULL && *target == NULL);
- result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
- dns_dbtype_zone, rdclass, 0, NULL, &db);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname, dns_dbtype_zone,
+ rdclass, 0, NULL, &db));
len = strlen(root_ns);
isc_buffer_init(&source, root_ns, len);
isc_buffer_add(&source, len);
dns_rdatacallbacks_init(&callbacks);
- result = dns_db_beginload(db, &callbacks);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(dns_db_beginload(db, &callbacks));
if (filename != NULL) {
/*
* Load the hints from the specified filename.
if (result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE) {
result = eresult;
}
- if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
- goto failure;
+ if (result != DNS_R_SEENINCLUDE) {
+ CHECK(result);
}
if (check_hints(db) != ISC_R_SUCCESS) {
isc_log_write(DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_HINTS,
*target = db;
return ISC_R_SUCCESS;
-failure:
+cleanup:
isc_log_write(DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_HINTS,
ISC_LOG_ERROR,
"could not configure root hints from "
dns_rdatasetiter_t *rdsiter = NULL;
dns_dbnode_t *node = NULL;
- result = dns__rpz_shuttingdown(rpz->rpzs);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns__rpz_shuttingdown(rpz->rpzs));
result = dns_dbiterator_current(updbit, &node, name);
if (result != ISC_R_SUCCESS) {
isc_ht_init(&newnodes, rpz->rpzs->mctx, 1, ISC_HT_CASE_SENSITIVE);
- result = update_nodes(rpz, newnodes);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(update_nodes(rpz, newnodes));
- result = cleanup_nodes(rpz);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cleanup_nodes(rpz));
/* Finalize the update */
ISC_SWAP(rpz->nodes, newnodes);
isc_buffer_allocate(mctx, &buffer, 1024);
- result = dns_master_stylecreate(&style, 0, 0, 0, 0, 0, 0, 1, 0xffffffff,
- mctx);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_master_stylecreate(&style, 0, 0, 0, 0, 0, 0, 1, 0xffffffff,
+ mctx));
- result = dns_master_rdatasettotext(&sdlznode->name, rdataset, style,
- NULL, buffer);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_master_rdatasettotext(&sdlznode->name, rdataset, style, NULL,
+ buffer));
if (isc_buffer_usedlength(buffer) < 1) {
- result = ISC_R_BADADDRESSFORM;
- goto cleanup;
+ CHECK(ISC_R_BADADDRESSFORM);
}
rdatastr = isc_buffer_base(buffer);
isc_buffer_constinit(&b, data, strlen(data));
isc_buffer_add(&b, strlen(data));
- result = isc_lex_openbuffer(lex, &b);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_lex_openbuffer(lex, &b));
rdatabuf = NULL;
isc_buffer_allocate(mctx, &rdatabuf, size);
} while (result == ISC_R_NOSPACE);
if (result != ISC_R_SUCCESS) {
- result = DNS_R_SERVFAIL;
- goto failure;
+ CHECK(DNS_R_SERVFAIL);
}
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
return ISC_R_SUCCESS;
-failure:
+cleanup:
if (rdatabuf != NULL) {
isc_buffer_free(&rdatabuf);
}
* parameters from the configuration file and try to
* store it for further reuse.
*/
- result = isc_tlsctx_createclient(&tlsctx);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_tlsctx_createclient(&tlsctx));
tls_versions = dns_transport_get_tls_versions(transport);
if (tls_versions != 0) {
isc_tlsctx_set_protocols(tlsctx, tls_versions);
* which case the store with system-wide
* CA certificates will be created.
*/
- result = isc_tls_cert_store_create(ca_file,
- &store);
-
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_tls_cert_store_create(ca_file,
+ &store));
} else {
store = found_store;
}
* Only SubjectAltName must be checked.
*/
hostname_ignore_subject = true;
- result = isc_tlsctx_enable_peer_verification(
+ CHECK(isc_tlsctx_enable_peer_verification(
tlsctx, false, store, hostname,
- hostname_ignore_subject);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ hostname_ignore_subject));
/*
* Let's load client certificate and enable
if (cert_file != NULL) {
INSIST(key_file != NULL);
- result = isc_tlsctx_load_certificate(
- tlsctx, key_file, cert_file);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_tlsctx_load_certificate(
+ tlsctx, key_file, cert_file));
}
}
return ISC_R_SUCCESS;
-failure:
+cleanup:
if (tlsctx != NULL) {
isc_tlsctx_free(&tlsctx);
}
dns_resolver_destroyfetch(&val->fetch);
if (CANCELED(val) || CANCELING(val)) {
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
if (trustchain) {
dns_resolver_destroyfetch(&val->fetch);
if (CANCELED(val) || CANCELING(val)) {
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
if (trustchain) {
val->subvalidator = NULL;
if (CANCELED(val) || CANCELING(val)) {
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
validator_log(val, ISC_LOG_DEBUG(3), "in validator_callback_dnskey");
val->subvalidator = NULL;
if (CANCELED(val) || CANCELING(val)) {
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
validator_log(val, ISC_LOG_DEBUG(3), "in validator_callback_ds");
val->subvalidator = NULL;
if (CANCELED(val) || CANCELING(val)) {
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
validator_log(val, ISC_LOG_DEBUG(3), "in validator_callback_cname");
val->subvalidator = NULL;
if (CANCELED(val) || CANCELING(val)) {
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
validator_log(val, ISC_LOG_DEBUG(3), "in validator_callback_nsec");
val->attributes &= ~VALATTR_OFFLOADED;
if (CANCELING(val)) {
validator_cancel_finish(val);
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
if (val->resume) {
val->attributes &= ~VALATTR_OFFLOADED;
if (CANCELING(val)) {
validator_cancel_finish(val);
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
val->resume = false;
val->attributes &= ~VALATTR_OFFLOADED;
if (CANCELING(val)) {
validator_cancel_finish(val);
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
dns_rdata_reset(&val->rdata);
val->siginfo = isc_mem_get(val->view->mctx,
sizeof(*val->siginfo));
}
- result = dns_rdata_tostruct(&val->rdata, val->siginfo, NULL);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdata_tostruct(&val->rdata, val->siginfo, NULL));
/*
* At this point we could check that the signature algorithm
next_key:
result = validate_async_run(val, validate_answer_iter_next);
- goto cleanup;
cleanup:
validate_async_done(val, result);
dns_rdata_ds_t ds;
if (CANCELED(val) || CANCELING(val)) {
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
/*
validator_log(val, ISC_LOG_DEBUG(3),
"no trusted root key");
}
- result = DNS_R_NOVALIDSIG;
- goto cleanup;
+ CHECK(DNS_R_NOVALIDSIG);
}
/*
isc_result_t result = ISC_R_FAILURE;
if (CANCELED(val) || CANCELING(val)) {
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
validator_log(val, ISC_LOG_DEBUG(3), "starting");
try_hints = true;
goto finish;
} else {
- result = DNS_R_NXDOMAIN;
- goto cleanup;
+ CHECK(DNS_R_NXDOMAIN);
}
} else if (result != ISC_R_SUCCESS) {
/*
REQUIRE(view->rdclass == dns_rdataclass_in);
if (rdtype != dns_rdatatype_dnskey && rdtype != dns_rdatatype_ds) {
- result = ISC_R_NOTIMPLEMENTED;
- goto cleanup;
+ CHECK(ISC_R_NOTIMPLEMENTED);
}
isc_buffer_init(&b, rdatabuf, sizeof(rdatabuf));
if ((flags & DNS_ZONELOADFLAG_THAW) != 0) {
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_THAW);
}
- result = ISC_R_LOADING;
- goto cleanup;
+ CHECK(ISC_R_LOADING);
}
INSIST(zone->db_argc >= 1);
ISC_LOG_DEBUG(1),
"skipping load: master file "
"older than last load");
- result = DNS_R_UPTODATE;
- goto cleanup;
+ CHECK(DNS_R_UPTODATE);
}
/*
"DLZ %s does not exist or is set "
"to 'search yes;'",
zone->db_argv[1]);
- result = ISC_R_NOTFOUND;
- goto cleanup;
+ CHECK(ISC_R_NOTFOUND);
}
ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_write);
load->callbacks.rawdata = zone_setrawdata;
zone_iattach(zone, &load->callbacks.zone);
- result = dns_db_beginload(db, &load->callbacks);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_beginload(db, &load->callbacks));
if (zone->zmgr != NULL && zone->db != NULL) {
- result = dns_master_loadfileasync(
+ CHECK(dns_master_loadfileasync(
zone->masterfile, dns_db_origin(db), dns_db_origin(db),
zone->rdclass, options, 0, &load->callbacks, zone->loop,
zone_loaddone, load, &zone->loadctx,
zone_registerinclude, zone, zone->mctx,
- zone->masterformat, zone->maxttl);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ zone->masterformat, zone->maxttl));
return DNS_R_CONTINUE;
} else if (zone->stream != NULL) {
}
DNS_DBITERATOR_FOREACH(dbiterator) {
- result = dns_dbiterator_current(dbiterator, &node, name);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_dbiterator_current(dbiterator, &node, name));
/*
* Is this name visible in the zone?
bool logged_algorithm[DST_MAX_ALGS] = { 0 };
bool alldeprecated = true;
- result = dns_db_findnode(db, &zone->origin, false, &node);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findnode(db, &zone->origin, false, &node));
dns_db_currentversion(db, &version);
dns_rdataset_init(&rdataset);
- result = dns_db_findrdataset(db, node, version, dns_rdatatype_dnskey,
- dns_rdatatype_none, 0, &rdataset, NULL);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findrdataset(db, node, version, dns_rdatatype_dnskey,
+ dns_rdatatype_none, 0, &rdataset, NULL));
DNS_RDATASET_FOREACH(&rdataset) {
char algbuf[DNS_SECALG_FORMATSIZE];
goto cleanup;
}
- result = dns_db_findnode(db, &zone->origin, false, &node);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findnode(db, &zone->origin, false, &node));
dns_db_currentversion(db, &version);
dns_rdataset_init(&rdataset);
goto cleanup;
}
- result = dns_db_findnode(db, &zone->origin, false, &node);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findnode(db, &zone->origin, false, &node));
dns_db_currentversion(db, &version);
* a sane starting point.)
*/
if (noprimary && zone->type == dns_zone_key) {
- result = add_soa(zone, db);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(add_soa(zone, db));
}
/*
!DNS_ZONE_OPTION(zone, DNS_ZONEOPT_NOMERGE) &&
!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED))
{
- result = zone_journal_rollforward(zone, db, &needdump,
- &fixjournal);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(zone_journal_rollforward(zone, db, &needdump,
+ &fixjournal));
}
/*
goto cleanup;
}
if (zone->type == dns_zone_primary && errors != 0) {
- result = DNS_R_BADZONE;
- goto cleanup;
+ CHECK(DNS_R_BADZONE);
}
if (zone->type != dns_zone_stub &&
zone->type != dns_zone_redirect)
{
- result = check_nsec3param(zone, db);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(check_nsec3param(zone, db));
}
if (zone->type == dns_zone_primary &&
DNS_ZONE_OPTION(zone, DNS_ZONEOPT_CHECKINTEGRITY) &&
!integrity_checks(zone, db))
{
- result = DNS_R_BADZONE;
- goto cleanup;
+ CHECK(DNS_R_BADZONE);
}
if (zone->type == dns_zone_primary &&
DNS_ZONE_OPTION(zone, DNS_ZONEOPT_CHECKDUPRR) &&
!zone_check_dup(zone, db))
{
- result = DNS_R_BADZONE;
- goto cleanup;
+ CHECK(DNS_R_BADZONE);
}
if (zone->type == dns_zone_primary) {
dns_zone_log(zone, ISC_LOG_ERROR,
"'log-report-channel' is set, but no "
"'*._er/TXT' wildcard found");
- result = DNS_R_BADZONE;
- goto cleanup;
+ CHECK(DNS_R_BADZONE);
}
- result = dns_zone_verifydb(zone, db, NULL);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_zone_verifydb(zone, db, NULL));
if (zone->db != NULL) {
unsigned int oldsoacount;
"new serial (%u) out of range "
"[%u - %u]",
serial, serialmin, serialmax);
- result = DNS_R_BADZONE;
- goto cleanup;
+ CHECK(DNS_R_BADZONE);
} else if (!isc_serial_ge(serial, oldserial)) {
dns_zone_logc(zone, DNS_LOGCATEGORY_ZONELOAD,
ISC_LOG_ERROR,
default:
UNEXPECTED_ERROR("unexpected zone type %d", zone->type);
- result = ISC_R_UNEXPECTED;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTED);
}
/*
}
break;
default:
- result = ISC_R_NOTIMPLEMENTED;
- goto cleanup;
+ CHECK(ISC_R_NOTIMPLEMENTED);
}
/*
dns_dbiterator_pause(dbiterator);
- result = dns_db_findnode(db, name, true, &node);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findnode(db, name, true, &node));
- result = dns_db_allrdatasets(rawdb, rawnode, NULL, 0, 0, &rdsit);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_allrdatasets(rawdb, rawnode, NULL, 0, 0, &rdsit));
DNS_RDATASETITER_FOREACH(rdsit) {
dns_rdataset_t rdataset = DNS_RDATASET_INIT;
mr = dns_message_getrawmessage(msg);
if (mr == NULL) {
- result = ISC_R_UNEXPECTEDEND;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDEND);
}
isc_buffer_allocate(zone->mctx, &forward->msgbuf, mr->length);
- result = isc_buffer_copyregion(forward->msgbuf, mr);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_buffer_copyregion(forward->msgbuf, mr));
isc_mem_attach(zone->mctx, &forward->mctx);
dns_zone_iattach(zone, &forward->zone);
buf = isc_mem_get(zone->mctx, buflen);
- result = isc_file_template(path, templat, buf, buflen);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_file_template(path, templat, buf, buflen));
- result = isc_file_renameunique(path, buf);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_file_renameunique(path, buf));
dns_zone_log(zone, ISC_LOG_WARNING,
"unable to load from '%s'; "
ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read);
if (db == NULL) {
- result = ISC_R_NOTFOUND;
- goto cleanup;
+ CHECK(ISC_R_NOTFOUND);
}
dns_db_attach(db, &signing->db);
checkds->zone->view->requestmgr == NULL ||
checkds->zone->db == NULL)
{
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
/*
dns_zone_log(checkds->zone, ISC_LOG_DEBUG(3),
"checkds: ignoring IPv6 mapped IPV4 address: %s",
addrbuf);
- result = ISC_R_CANCELED;
- goto cleanup;
+ CHECK(ISC_R_CANCELED);
}
checkds_createmessage(checkds->zone, &message);
}
newcheckds = NULL;
- result = checkds_create(checkds->mctx, 0, &newcheckds);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(checkds_create(checkds->mctx, 0, &newcheckds));
zone_iattach(zone, &newcheckds->zone);
ISC_LIST_APPEND(newcheckds->zone->checkds_requests, newcheckds,
link);
* publicly available on the default transport protocol.
*/
- result = isc_ratelimiter_enqueue(
- newcheckds->zone->zmgr->checkdsrl,
- newcheckds->zone->loop, checkds_send_toaddr, newcheckds,
- &newcheckds->rlevent);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(isc_ratelimiter_enqueue(newcheckds->zone->zmgr->checkdsrl,
+ newcheckds->zone->loop,
+ checkds_send_toaddr, newcheckds,
+ &newcheckds->rlevent));
newcheckds = NULL;
}
return DNS_R_CONTINUE;
}
- result = dns_zonefetch_verify(fetch, eresult, dns_trust_secure);
- if (result != ISC_R_SUCCESS) {
- goto done;
- }
+ CHECK(dns_zonefetch_verify(fetch, eresult, dns_trust_secure));
/* Record the number of NS records we found. */
zone->parent_nscount = dns_rdataset_count(nsrrset);
LOCK_ZONE(zone);
-done:
+cleanup:
if (result != ISC_R_SUCCESS) {
dnssec_log(
zone, ISC_LOG_ERROR,
&crdata, &dnskey,
&rdata);
if (result != ISC_R_SUCCESS) {
- result = DNS_R_BADCDS;
- goto cleanup;
+ CHECK(DNS_R_BADCDS);
}
CHECK(dns_rdata_tostruct(&rdata, &structdnskey,
NULL));
* is NULL, then we have neither a DNSKEY nor a DS format
* trust anchor, and can give up.
*/
- result = dns_keytable_find(vctx->secroots, vctx->origin, &keynode);
- if (result != ISC_R_SUCCESS) {
- /* No such trust anchor */
- goto cleanup;
- }
+ CHECK(dns_keytable_find(vctx->secroots, vctx->origin, &keynode));
/*
* If the keynode has any DS format trust anchors, that means
strerror_r(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR("getting interface addresses: getifaddrs: %s",
strbuf);
- result = ISC_R_UNEXPECTED;
- goto failure;
+ CHECK(ISC_R_UNEXPECTED);
}
/*
*iterp = iter;
return ISC_R_SUCCESS;
-failure:
+cleanup:
if (iter->ifaddrs != NULL) { /* just in case */
freeifaddrs(iter->ifaddrs);
}
}
if (isc__nmsocket_closing(sock)) {
- result = ISC_R_CANCELED;
- goto failure;
+ CHECK(ISC_R_CANCELED);
}
if (!sock->reading_throttled) {
- result = isc__nm_start_reading(sock);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc__nm_start_reading(sock));
}
sock->reading = true;
}
return;
-failure:
+cleanup:
isc__nm_tcp_failed_read_cb(sock, result, true);
}
* isc__nm_tcp_close() can't handle uninitalized TCP nmsocket.
*/
if (isc__nmsocket_closing(csock)) {
- result = ISC_R_CANCELED;
- goto failure;
+ CHECK(ISC_R_CANCELED);
}
r = uv_accept(&csock->server->uv_handle.stream,
&csock->uv_handle.stream);
if (r != 0) {
result = isc_uverr2result(r);
- goto failure;
+ goto cleanup;
}
/* Check if the connection is not expired */
* it has expired. We cannot do anything better than
* drop it on the floor at this point.
*/
- result = ISC_R_TIMEDOUT;
- goto failure;
+ CHECK(ISC_R_TIMEDOUT);
} else {
/* Adjust the initial read timeout accordingly */
csock->read_timeout -= time_elapsed_ms;
&(int){ sizeof(ss) });
if (r != 0) {
result = isc_uverr2result(r);
- goto failure;
+ goto cleanup;
}
- result = isc_sockaddr_fromsockaddr(&csock->peer,
- (struct sockaddr *)&ss);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_sockaddr_fromsockaddr(&csock->peer, (struct sockaddr *)&ss));
r = uv_tcp_getsockname(&csock->uv_handle.tcp, (struct sockaddr *)&ss,
&(int){ sizeof(ss) });
if (r != 0) {
result = isc_uverr2result(r);
- goto failure;
+ goto cleanup;
}
- result = isc_sockaddr_fromsockaddr(&local, (struct sockaddr *)&ss);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ CHECK(isc_sockaddr_fromsockaddr(&local, (struct sockaddr *)&ss));
handle = isc__nmhandle_get(csock, NULL, &local);
result = csock->accept_cb(handle, ISC_R_SUCCESS, csock->accept_cbarg);
if (result != ISC_R_SUCCESS) {
isc_nmhandle_detach(&handle);
- goto failure;
+ goto cleanup;
}
csock->accepting = false;
return ISC_R_SUCCESS;
-failure:
+cleanup:
csock->active = false;
csock->accepting = false;
transports = isc_nm_httpsocket;
encrypted = false;
} else {
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
}
* the nestedacl element, not the iptable entry.
*/
setpos = (nest_level != 0 || !neg);
- result = dns_iptable_addprefix(iptab, &addr, bitlen,
- setpos);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_iptable_addprefix(iptab, &addr, bitlen,
+ setpos));
if (nest_level > 0) {
INSIST(dacl->length < dacl->alloc);
if (inneracl != NULL) {
dns_acl_detach(&inneracl);
}
- result = cfg_acl_fromconfig(ce, cctx, ctx, mctx,
- new_nest_level, &inneracl);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_acl_fromconfig(ce, cctx, ctx, mctx,
+ new_nest_level, &inneracl));
nested_acl:
if (nest_level > 0 || inneracl->has_negatives) {
INSIST(dacl->length < dacl->alloc);
de->type = dns_aclelementtype_keyname;
de->negative = neg;
dns_name_init(&de->keyname);
- result = convert_keyname(ce, mctx, &de->keyname);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(convert_keyname(ce, mctx, &de->keyname));
#if defined(HAVE_GEOIP2)
} else if (cfg_obj_istuple(ce) &&
cfg_obj_isvoid(cfg_tuple_get(ce, "negated")))
{
INSIST(dacl->length < dacl->alloc);
- result = parse_geoip_element(ce, ctx, de);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(parse_geoip_element(ce, ctx, de));
de->type = dns_aclelementtype_geoip;
de->negative = neg;
#endif /* HAVE_GEOIP2 */
if (strcasecmp(name, "any") == 0) {
/* Iptable entry with zero bit length. */
setpos = (nest_level != 0 || !neg);
- result = dns_iptable_addprefix(iptab, NULL, 0,
- setpos);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_iptable_addprefix(iptab, NULL, 0,
+ setpos));
if (nest_level != 0) {
INSIST(dacl->length < dacl->alloc);
* "!none;".
*/
setpos = (nest_level != 0 || neg);
- result = dns_iptable_addprefix(iptab, NULL, 0,
- setpos);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_iptable_addprefix(iptab, NULL, 0,
+ setpos));
if (!neg) {
dacl->has_negatives = !neg;
* This call should just find the cached
* of the named acl.
*/
- result = convert_named_acl(ce, cctx, ctx, mctx,
- new_nest_level,
- &inneracl);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(convert_named_acl(ce, cctx, ctx, mctx,
+ new_nest_level,
+ &inneracl));
goto nested_acl;
}
cfg_obj_log(ce, ISC_LOG_WARNING,
"address match list contains "
"unsupported element type");
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
/*
result = cfg_map_get(goptions, "allow-recursion", &obj);
}
if (result == ISC_R_SUCCESS) {
- result = cfg_acl_fromconfig(obj, config, aclctx, mctx, 0, &acl);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_acl_fromconfig(obj, config, aclctx, mctx, 0, &acl));
retval = !dns_acl_isnone(acl);
}
"key '%s': "
"invalid initialization method '%s'",
namestr, atstr);
- result = ISC_R_FAILURE;
/*
* We can't interpret the trust anchor, so
* we skip all other checks.
*/
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
+ UNREACHABLE();
}
switch (anchortype) {
key->lifetime = 0; /* unlimited */
key->algorithm = DST_ALG_ECDSA256;
key->length = -1;
- result = dns_keystorelist_find(keystorelist,
- DNS_KEYSTORE_KEYDIRECTORY,
- &key->keystore);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_keystorelist_find(keystorelist,
+ DNS_KEYSTORE_KEYDIRECTORY,
+ &key->keystore));
} else {
const char *rolestr = NULL;
const char *keydir = NULL;
"allowed when offline-ksk "
"is enabled");
}
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
key->role |= DNS_KASP_KEY_ROLE_KSK;
key->role |= DNS_KASP_KEY_ROLE_ZSK;
"not exist",
keydir);
}
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
} else if (result != ISC_R_SUCCESS) {
if (log_errors) {
cfg_obj_log(obj, ISC_LOG_ERROR,
"dnssec-policy: bad keystore %s",
keydir);
}
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
INSIST(key->keystore != NULL);
"takes to "
"do a rollover");
}
- result = ISC_R_FAILURE;
- goto cleanup;
+ CHECK(ISC_R_FAILURE);
}
}
"dnssec-policy: bad algorithm %s",
alg.base);
}
- result = DNS_R_BADALG;
- goto cleanup;
+ CHECK(DNS_R_BADALG);
}
if (check_algorithms && isc_crypto_fips_mode() &&
(key->algorithm == DST_ALG_RSASHA1 ||
"in FIPS mode",
alg.base);
}
- result = DNS_R_BADALG;
- goto cleanup;
+ CHECK(DNS_R_BADALG);
}
if (check_algorithms &&
"supported",
alg.base);
}
- result = DNS_R_BADALG;
- goto cleanup;
+ CHECK(DNS_R_BADALG);
}
switch (key->algorithm) {
"key length %u",
alg.base, size);
}
- result = ISC_R_RANGE;
- goto cleanup;
+ CHECK(ISC_R_RANGE);
}
break;
case DST_ALG_ECDSA256:
"dnssec-policy: tag-min "
"too big");
}
- result = ISC_R_RANGE;
- goto cleanup;
+ CHECK(ISC_R_RANGE);
}
obj = cfg_tuple_get(tagrange, "tag-max");
tag_max = cfg_obj_asuint32(obj);
"dnssec-policy: tag-max "
"too big");
}
- result = ISC_R_RANGE;
- goto cleanup;
+ CHECK(ISC_R_RANGE);
}
if (tag_min >= tag_max) {
if (log_errors) {
"dnssec-policy: tag-min >= "
"tag_max");
}
- result = ISC_R_RANGE;
- goto cleanup;
+ CHECK(ISC_R_RANGE);
}
key->tag_min = tag_min;
key->tag_max = tag_max;
(void)confget(maps, "cds-digest-types", &cds);
if (cds != NULL) {
CFG_LIST_FOREACH(cds, element) {
- result = add_digest(kasp, cfg_listelt_value(element),
- log_errors);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(add_digest(kasp, cfg_listelt_value(element),
+ log_errors));
}
} else {
dns_kasp_adddigest(kasp, DNS_DSDIGEST_SHA256);
}
} else {
dns_kasp_setnsec3(kasp, true);
- result = cfg_nsec3param_fromconfig(nsec3, kasp, log_errors);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(cfg_nsec3param_fromconfig(nsec3, kasp, log_errors));
}
/* Append it to the list for future lookups. */
new_key->lifetime = 0;
new_key->algorithm = DST_ALG_ECDSA256;
new_key->length = 256;
- result = dns_keystorelist_find(keystorelist,
- DNS_KEYSTORE_KEYDIRECTORY,
- &new_key->keystore);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_keystorelist_find(keystorelist,
+ DNS_KEYSTORE_KEYDIRECTORY,
+ &new_key->keystore));
dns_kasp_addkey(kasp, new_key);
}
} else {
cfg_parser_error(pctx, CFG_LOG_NEAR,
"unexpected token");
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
} else {
break;
if (f->name == NULL) {
cfg_parser_error(pctx, 0, "unexpected '%s'",
TOKEN_STRING(pctx));
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
if (obj->value.tuple[fn] == NULL &&
strcasecmp(f->name, TOKEN_STRING(pctx)) == 0)
CHECK(cfg_gettoken(pctx, 0));
if (pctx->token.type != isc_tokentype_string) {
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
CHECK(parse_unitstring(TOKEN_STRING(pctx), &val));
CHECK(cfg_gettoken(pctx, 0));
if (pctx->token.type != isc_tokentype_string) {
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
percent = strtoull(TOKEN_STRING(pctx), &endp, 10);
} else {
cfg_parser_error(pctx, CFG_LOG_NEAR, "expected '%s'",
kw->name);
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
}
CHECK(cfg_gettoken(pctx, 0));
if (pctx->token.type != isc_tokentype_string) {
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
return parse_duration(pctx, ret);
CHECK(cfg_gettoken(pctx, 0));
if (pctx->token.type != isc_tokentype_string) {
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
if (strcmp(TOKEN_STRING(pctx), "unlimited") == 0) {
CHECK(cfg_gettoken(pctx, CFG_LEXOPT_QSTRING));
if (pctx->token.type == isc_tokentype_eof) {
cfg_ungettoken(pctx);
- result = ISC_R_EOF;
- goto cleanup;
+ CHECK(ISC_R_EOF);
}
isc_lex_getlasttokentext(pctx->lexer, &pctx->token, &r);
if (pctx->token.type == isc_tokentype_eof || braces < 0) {
cfg_parser_error(pctx, CFG_LOG_NEAR,
"unexpected token");
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
CHECK(cfg_parse_listelt(pctx, listobj, &cfg_type_token, &elt));
if (have_address != 1) {
cfg_parser_error(pctx, 0, "expected exactly one address");
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
if (!is_port_ok && have_port > 0) {
cfg_parser_error(pctx, 0, "subconfig 'port' no longer exists");
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
if (have_port > 1) {
cfg_parser_error(pctx, 0, "expected at most one port");
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
if (have_tls > 1) {
cfg_parser_error(pctx, 0, "expected at most one tls");
- result = ISC_R_UNEXPECTEDTOKEN;
- goto cleanup;
+ CHECK(ISC_R_UNEXPECTEDTOKEN);
}
cfg_obj_create(pctx->mctx, cfg_parser_currentfile(pctx), pctx->line,
* Create an OPT for our reply.
*/
if ((client->inner.attributes & NS_CLIENTATTR_WANTOPT) != 0) {
- result = ns_client_addopt(client, client->message);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(ns_client_addopt(client, client->message));
opt_included = true;
}
dns_compress_init(&cctx, client->manager->mctx, compflags);
cleanup_cctx = true;
- result = dns_message_renderbegin(client->message, &cctx, &buffer);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_message_renderbegin(client->message, &cctx, &buffer));
result = dns_message_rendersection(client->message,
DNS_SECTION_QUESTION, 0);
goto cleanup;
}
renderend:
- result = dns_message_renderend(client->message);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_message_renderend(client->message));
#ifdef HAVE_DNSTAP
memset(&zr, 0, sizeof(zr));
dns_clientinfo_setecs(&ci, &qctx.client->inner.ecs);
}
- result = qctx_prepare_buffers(&qctx, &buffer);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(qctx_prepare_buffers(&qctx, &buffer));
dboptions = qctx.client->query.dboptions;
dboptions |= DNS_DBFIND_STALEOK;
if (zbits != 0) {
isc_netaddr_fromsockaddr(
&netaddr, &client->inner.peeraddr);
- result = rpz_rewrite_ip(client, &netaddr, qtype,
- DNS_RPZ_TYPE_CLIENT_IP,
- zbits, &rdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(rpz_rewrite_ip(client, &netaddr, qtype,
+ DNS_RPZ_TYPE_CLIENT_IP,
+ zbits, &rdataset));
}
}
* There is a first time for each name in a CNAME chain
*/
if ((st->state & DNS_RPZ_DONE_QNAME) == 0) {
- result = rpz_rewrite_name(client, client->query.qname,
- qtype, DNS_RPZ_TYPE_QNAME,
- allowed, &rdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(rpz_rewrite_name(client, client->query.qname,
+ qtype, DNS_RPZ_TYPE_QNAME,
+ allowed, &rdataset));
/*
* Check IPv4 addresses in A RRs next.
qresult_type == qresult_type_done &&
rpz_get_zbits(client, qtype, DNS_RPZ_TYPE_IP) != 0)
{
- result = rpz_rewrite_ip_rrsets(client, client->query.qname,
- qtype, DNS_RPZ_TYPE_IP,
- &rdataset, resuming);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(rpz_rewrite_ip_rrsets(client, client->query.qname, qtype,
+ DNS_RPZ_TYPE_IP, &rdataset,
+ resuming));
/*
* We are finished checking the IP addresses for the qname.
* Start with IPv4 if we will check NS IP addresses.
was_glue = true;
FALLTHROUGH;
case ISC_R_SUCCESS:
- result = dns_rdataset_first(st->r.ns_rdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_rdataset_first(st->r.ns_rdataset));
st->state &= ~(DNS_RPZ_DONE_NSDNAME |
DNS_RPZ_DONE_IPv4);
break;
dns_rdataset_init(&rdataset);
- result = dns_db_getoriginnode(db, &node);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_getoriginnode(db, &node));
- result = dns_db_findrdataset(db, node, version, dns_rdatatype_soa, 0, 0,
- &rdataset, NULL);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_rdataset_first(&rdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_db_findrdataset(db, node, version, dns_rdatatype_soa, 0, 0,
+ &rdataset, NULL));
+ CHECK(dns_rdataset_first(&rdataset));
dns_rdataset_current(&rdataset, &rdata);
result = dns_rdata_tostruct(&rdata, &soa, NULL);
REQUIRE(client->query.hookasyncctx == NULL);
REQUIRE(FETCH_RECTYPE_NORMAL(client) == NULL);
- result = acquire_recursionquota(client);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(acquire_recursionquota(client));
qctx_save(qctx, &saved_qctx);
result = runasync(saved_qctx, client->manager->mctx, arg,
flags |= DNS_DNS64_RECURSIVE;
}
- result = dns_dns64_apply(client->manager->mctx, view->dns64,
- view->dns64cnt, client->message,
- client->manager->aclenv,
- &client->inner.peeraddr, client->inner.signer,
- flags, qctx->rdataset, &dns64_rdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_dns64_apply(client->manager->mctx, view->dns64,
+ view->dns64cnt, client->message,
+ client->manager->aclenv, &client->inner.peeraddr,
+ client->inner.signer, flags, qctx->rdataset,
+ &dns64_rdataset));
dns_rdataset_setownercase(dns64_rdataset, mname);
client->query.attributes |= NS_QUERYATTR_NOADDITIONAL;
* Look for SOA record to construct NODATA response.
*/
dns_db_attach(qctx->db, &db);
- result = dns_db_findext(db, signer, qctx->version,
- dns_rdatatype_soa, dboptions,
- qctx->client->inner.now, &node, fname,
- &cm, &ci, soardataset, sigsoardataset);
+ CHECK(dns_db_findext(db, signer, qctx->version,
+ dns_rdatatype_soa, dboptions,
+ qctx->client->inner.now, &node, fname, &cm,
+ &ci, soardataset, sigsoardataset));
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
(void)query_synthnodata(qctx, signer, &soardataset,
&sigsoardataset);
done = true;
/*
* Look for SOA record to construct NXDOMAIN response.
*/
- result = dns_db_findext(db, signer, qctx->version, dns_rdatatype_soa,
- dboptions, qctx->client->inner.now, &node,
- fname, &cm, &ci, soardataset, sigsoardataset);
+ CHECK(dns_db_findext(db, signer, qctx->version, dns_rdatatype_soa,
+ dboptions, qctx->client->inner.now, &node, fname,
+ &cm, &ci, soardataset, sigsoardataset));
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
(void)query_synthnxdomainnodata(qctx, exists, nowild, &rdataset,
&sigrdataset, signer, &soardataset,
&sigsoardataset);
* Find the right database.
*/
do {
- result = query_getdb(client, &qname, dns_rdatatype_ns,
- (dns_getdb_options_t){ 0 }, &zone, &db,
- &version, &is_zone);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(query_getdb(client, &qname, dns_rdatatype_ns,
+ (dns_getdb_options_t){
+ 0,
+ },
+ &zone, &db, &version, &is_zone));
/*
* If this is a static stub zone look for a parent zone.
/*
* Add the no wildcard proof.
*/
- result = dns_name_concatenate(dns_wildcardname, cname, wname);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_name_concatenate(dns_wildcardname, cname, wname));
query_findclosestnsec3(wname, qctx->db, qctx->version, client,
rdataset, sigrdataset, fname, nodata,
ns_server_create(isc_g_mctx, matchview, &sctx);
- result = dns_dispatchmgr_create(isc_g_mctx, &dispatchmgr);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
-
- result = ns_interfacemgr_create(isc_g_mctx, sctx, dispatchmgr, NULL,
- &interfacemgr);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ CHECK(dns_dispatchmgr_create(isc_g_mctx, &dispatchmgr));
+ CHECK(ns_interfacemgr_create(isc_g_mctx, sctx, dispatchmgr, NULL,
+ &interfacemgr));
isc_loop_setup(isc_loop_main(), scan_interfaces, NULL);