switch to CHECK where it wasn't being used

replace all instances of the pattern:

        result = <statement>
        if (result != ISC_R_SUCCESS) {
                goto cleanup;
        }

with:

        CHECK(<statement>);
This commit is contained in:
Evan Hunt 2025-05-21 17:13:44 -07:00
parent 52bba5cc34
commit 38e94cc7da
52 changed files with 481 additions and 1228 deletions

View file

@ -676,8 +676,7 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client, dns_view_t *toview) {
delv_log(ISC_LOG_ERROR,
"key '%s': invalid initialization method '%s'",
keynamestr, atstr);
result = ISC_R_FAILURE;
goto cleanup;
CHECK(ISC_R_FAILURE);
}
}

View file

@ -862,26 +862,19 @@ setup_text_key(void) {
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));
@ -1086,16 +1079,10 @@ read_confkey(void) {
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);
@ -1147,7 +1134,7 @@ setup_file_key(void) {
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)) {
@ -1175,7 +1162,7 @@ setup_file_key(void) {
}
}
failure:
cleanup:
if (dstkey != NULL) {
dst_key_free(&dstkey);
}
@ -2764,21 +2751,14 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
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);
@ -2788,23 +2768,17 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
* 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) {
@ -2840,7 +2814,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
INSIST(!query->lookup->tls_ca_set || found_store != NULL);
return found_ctx;
failure:
cleanup:
if (ctx != NULL) {
isc_tlsctx_free(&ctx);
}

View file

@ -1384,11 +1384,8 @@ setsoaserial(uint32_t serial, dns_updatemethod_t method) {
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);
@ -2520,22 +2517,14 @@ loadzonekeys(bool preserve_keys, bool load_public) {
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,
@ -2886,12 +2875,8 @@ set_nsec3params(bool update, bool set_salt, bool set_optout, bool set_iter) {
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;
@ -2928,16 +2913,10 @@ set_nsec3params(bool update, bool set_salt, bool set_optout, bool set_iter) {
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");

View file

@ -1173,15 +1173,13 @@ create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
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;

View file

@ -72,11 +72,8 @@ named_config_parsefile(cfg_obj_t **conf) {
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.
@ -85,11 +82,7 @@ named_config_parsefile(cfg_obj_t **conf) {
* 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;
@ -568,24 +561,15 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
/*
* 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);

View file

@ -101,15 +101,9 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
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.
@ -140,8 +134,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
"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,

View file

@ -305,11 +305,8 @@ control_respond(controlconnection_t *conn) {
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;
@ -445,14 +442,12 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
}
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();
@ -462,20 +457,17 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
*/
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);
}
/*
@ -484,8 +476,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
if (isccc_cc_lookupuint32(conn->ctrl, "_exp", &exp) == ISC_R_SUCCESS &&
conn->now > exp)
{
result = DNS_R_EXPIRED;
goto cleanup;
CHECK(DNS_R_EXPIRED);
}
/*
@ -508,8 +499,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
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);

View file

@ -44,10 +44,7 @@ named_log_init(bool safe) {
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();
@ -199,12 +196,8 @@ isc_result_t
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) {

View file

@ -670,7 +670,7 @@ ta_fromconfig(const cfg_obj_t *key, bool *initialp, const char **namestrp,
INIT_DS,
STATIC_DS,
TRUSTED
} anchortype;
} anchortype = TRUSTED;
dst_algorithm_t algorithm;
REQUIRE(namestrp != NULL && *namestrp == NULL);
@ -711,11 +711,8 @@ ta_fromconfig(const cfg_obj_t *key, bool *initialp, const char **namestrp,
"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));
@ -831,8 +828,7 @@ ta_fromconfig(const cfg_obj_t *key, bool *initialp, const char **namestrp,
"key '%s': "
"unknown ds digest type %u",
namestr, ds->digest_type);
result = ISC_R_FAILURE;
goto cleanup;
CHECK(ISC_R_FAILURE);
break;
}
@ -1152,8 +1148,7 @@ configure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig,
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);
}
}
@ -1184,8 +1179,7 @@ configure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig,
"managed-keys-directory '%s' "
"is not writable",
directory);
result = ISC_R_NOPERM;
goto cleanup;
CHECK(ISC_R_NOPERM);
}
}
@ -1520,10 +1514,7 @@ configure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
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;
@ -1533,11 +1524,8 @@ configure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
(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;
@ -1547,11 +1535,7 @@ configure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
(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;
@ -1562,10 +1546,7 @@ configure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
}
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;
@ -3861,8 +3842,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
"rpz '%s' is not a primary or a "
"secondary zone",
namebuf);
result = ISC_R_NOTFOUND;
goto cleanup;
CHECK(ISC_R_NOTFOUND);
}
}
}
@ -3920,11 +3900,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
(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 {
@ -4094,35 +4071,23 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
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);
}
@ -4144,11 +4109,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
&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);
}
@ -4409,8 +4371,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
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,
@ -5420,10 +5381,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
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));
}
/*
@ -6082,8 +6040,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
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);
@ -6095,8 +6052,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
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,
@ -6104,8 +6060,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
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,
@ -6115,8 +6070,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
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));
@ -6143,8 +6097,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
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);
@ -6160,8 +6113,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
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);
@ -6202,8 +6154,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
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);
@ -6242,8 +6193,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
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);
}
@ -6957,8 +6907,7 @@ generate_session_key(const char *filename, const char *keynamestr,
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,
@ -6970,10 +6919,7 @@ generate_session_key(const char *filename, const char *keynamestr,
(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;
@ -7419,11 +7365,8 @@ data_to_cfg(dns_view_t *view, MDB_val *key, MDB_val *data, isc_buffer_t *text,
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));
@ -10501,11 +10444,8 @@ listenlist_fromconfig(const cfg_obj_t *listenlist, const cfg_obj_t *config,
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;
@ -12386,8 +12326,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone,
"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;
}
@ -12401,8 +12340,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone,
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;
@ -12415,8 +12353,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone,
"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);
@ -12429,8 +12366,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone,
"Error inserting zone in "
"NZD database: %s",
mdb_strerror(status));
result = ISC_R_FAILURE;
goto cleanup;
CHECK(ISC_R_FAILURE);
}
commit = true;
@ -12724,8 +12660,7 @@ load_nzf(dns_view_t *view) {
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 */
@ -12741,8 +12676,7 @@ load_nzf(dns_view_t *view) {
zoptions = cfg_tuple_get(zconfig, "options");
if (zoptions == NULL) {
result = ISC_R_FAILURE;
goto cleanup;
CHECK(ISC_R_FAILURE);
}
isc_buffer_clear(text);
@ -12756,8 +12690,7 @@ load_nzf(dns_view_t *view) {
"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);
@ -12770,8 +12703,7 @@ load_nzf(dns_view_t *view) {
"Error inserting zone in "
"NZD database: %s",
mdb_strerror(status));
result = ISC_R_FAILURE;
goto cleanup;
CHECK(ISC_R_FAILURE);
}
commit = true;
@ -13050,8 +12982,7 @@ do_addzone(named_server_t *server, dns_view_t *view, dns_name_t *name,
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 */
@ -13712,8 +13643,7 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex,
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);
@ -13724,8 +13654,7 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex,
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);
@ -13832,8 +13761,7 @@ named_server_showzone(named_server_t *server, isc_lex_t *lex,
/* 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);
@ -14544,8 +14472,7 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
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? */
@ -15354,8 +15281,7 @@ named_server_mkeys(named_server_t *server, isc_lex_t *lex, isc_buffer_t *text) {
} 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. */

View file

@ -2405,8 +2405,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
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,
@ -2430,8 +2429,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
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(
@ -2584,8 +2582,7 @@ xfrin_jsonrender(dns_zone_t *zone, void *arg) {
}
if (xfrinobj == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
CHECK(ISC_R_NOMEMORY);
}
result = dns_zone_getxfr(zone, &xfr, &is_firstrefresh, &is_running,
@ -3167,8 +3164,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
0);
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
result = dumparg.result;
goto cleanup;
CHECK(dumparg.result);
}
json_object_object_add(res, "adb",

View file

@ -36,7 +36,7 @@
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) \
@ -126,7 +126,7 @@ add_doh_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
}
return ISC_R_SUCCESS;
failure:
cleanup:
cfg_obj_log(doh, ISC_LOG_ERROR, "configuring DoH '%s': %s", dohid,
isc_result_totext(result));
@ -147,8 +147,7 @@ add_tls_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
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);
@ -176,7 +175,7 @@ add_tls_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
}
return ISC_R_SUCCESS;
failure:
cleanup:
cfg_obj_log(tls, ISC_LOG_ERROR, "configuring tls '%s': %s", tlsid,
isc_result_totext(result));
@ -217,7 +216,7 @@ transport_list_add_ephemeral(dns_transport_list_t *list) {
dns_transport_set_tlsname(transport, "ephemeral");
return;
failure:
cleanup:
RUNTIME_CHECK(result == ISC_R_SUCCESS);
}
@ -232,10 +231,7 @@ named_transports_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
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) {
@ -245,7 +241,7 @@ named_transports_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
*listp = list;
return ISC_R_SUCCESS;
failure:
cleanup:
dns_transport_list_detach(&list);
return result;
}

View file

@ -38,7 +38,7 @@ add_initial_keys(const cfg_obj_t *list, dns_tsigkeyring_t *ring,
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;
@ -67,11 +67,8 @@ add_initial_keys(const cfg_obj_t *list, dns_tsigkeyring_t *ring,
*/
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.
@ -84,31 +81,27 @@ add_initial_keys(const cfg_obj_t *list, dns_tsigkeyring_t *ring,
"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.
@ -119,13 +112,13 @@ add_initial_keys(const cfg_obj_t *list, dns_tsigkeyring_t *ring,
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
@ -159,16 +152,13 @@ named_tsigkeyring_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
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;
}

View file

@ -369,8 +369,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, const cfg_obj_t *tconfig,
"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(
@ -609,8 +608,7 @@ configure_staticstub(const cfg_obj_t *zconfig, const cfg_obj_t *tconfig,
"No NS record is configured for a "
"static-stub zone '%s'",
zname);
result = ISC_R_FAILURE;
goto cleanup;
CHECK(ISC_R_FAILURE);
}
/*

View file

@ -569,16 +569,10 @@ read_sessionkey(isc_mem_t *mctx) {
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);

View file

@ -78,8 +78,7 @@ parse_params(isc_mem_t *mctx, int argc, char **argv, dns_name_t *z1,
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) {

View file

@ -177,10 +177,7 @@ main(int argc, char **argv) {
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);

View file

@ -156,25 +156,13 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
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) {

View file

@ -79,10 +79,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
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;
}
@ -98,18 +95,12 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
}
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;
}
@ -126,11 +117,8 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
}
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;
}

View file

@ -184,11 +184,7 @@ dns_cache_create(dns_rdataclass_t rdclass, const char *cachename,
/*
* 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;
@ -398,10 +394,7 @@ cleartree(dns_db_t *db, const dns_name_t *name) {
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) {

View file

@ -1214,20 +1214,14 @@ catz_process_coo(dns_catz_zone_t *catz, dns_label_t *mhash,
}
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);
@ -1333,31 +1327,20 @@ catz_process_version(dns_catz_zone_t *catz, dns_rdataset_t *value) {
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;
@ -1883,16 +1866,10 @@ dns_catz_generate_masterfilename(dns_catz_zone_t *catz, dns_catz_entry_t *entry,
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
@ -1913,10 +1890,7 @@ dns_catz_generate_masterfilename(dns_catz_zone_t *catz, dns_catz_entry_t *entry,
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);
@ -1930,16 +1904,10 @@ dns_catz_generate_masterfilename(dns_catz_zone_t *catz, dns_catz_entry_t *entry,
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);
@ -2002,8 +1970,7 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *catz, dns_catz_entry_t *entry,
"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]);
@ -2018,30 +1985,21 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *catz, dns_catz_entry_t *entry,
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) {
@ -2140,13 +2098,9 @@ dns_catz_dbupdate_callback(dns_db_t *db, void *fn_arg) {
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) {

View file

@ -142,17 +142,11 @@ setsourceports(isc_mem_t *mctx, dns_dispatchmgr_t *manager) {
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);
@ -900,17 +894,11 @@ startresolve(dns_client_t *client, const dns_name_t *name,
.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;

View file

@ -203,20 +203,17 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
/* 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.");
@ -402,11 +399,8 @@ dns_dlz_writeablezone(dns_view_t *view, dns_dlzdb_t *dlzdb,
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) {
@ -423,8 +417,7 @@ dns_dlz_writeablezone(dns_view_t *view, dns_dlzdb_t *dlzdb,
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);
@ -440,10 +433,7 @@ dns_dlz_writeablezone(dns_view_t *view, dns_dlzdb_t *dlzdb,
}
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);

View file

@ -2183,10 +2183,7 @@ pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) {
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;
@ -2400,8 +2397,7 @@ load_raw(dns_loadctx_t *lctx) {
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);
@ -2428,10 +2424,7 @@ load_raw(dns_loadctx_t *lctx) {
*/
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;
@ -2439,42 +2432,30 @@ load_raw(dns_loadctx_t *lctx) {
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)
@ -2484,8 +2465,7 @@ load_raw(dns_loadctx_t *lctx) {
"TTL %d exceeds configured "
"max-zone-ttl %d",
rdatalist.ttl, lctx->maxttl);
result = ISC_R_RANGE;
goto cleanup;
CHECK(ISC_R_RANGE);
}
/* Rdata contents. */
@ -2533,20 +2513,14 @@ load_raw(dns_loadctx_t *lctx) {
}
/* 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
@ -2556,12 +2530,9 @@ load_raw(dns_loadctx_t *lctx) {
*/
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);
}
@ -2571,8 +2542,7 @@ load_raw(dns_loadctx_t *lctx) {
* 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);
@ -2635,10 +2605,7 @@ dns_master_loadfile(const char *master_file, dns_name_t *top,
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);
@ -2729,10 +2696,7 @@ dns_master_loadbuffer(isc_buffer_t *buffer, dns_name_t *top, dns_name_t *origin,
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);

View file

@ -1571,10 +1571,7 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
} 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);
@ -1795,10 +1792,7 @@ opentmp(isc_mem_t *mctx, const char *file, char **tempp, FILE **fp) {
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) {
@ -1882,11 +1876,8 @@ dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
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);

View file

@ -965,10 +965,7 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
*/
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);
@ -979,8 +976,7 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
*/
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);
@ -1104,10 +1100,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
*/
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
@ -1116,8 +1109,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
*/
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);
@ -1226,8 +1218,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
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);
}
/*
@ -1241,8 +1232,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
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
@ -1309,8 +1299,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
if (rdtype == dns_rdatatype_nsec3 &&
!dns_rdata_checkowner(name, msg->rdclass, rdtype, false))
{
result = DNS_R_BADOWNERNAME;
goto cleanup;
CHECK(DNS_R_BADOWNERNAME);
}
/*
@ -2666,10 +2655,7 @@ dns_message_setopt(dns_message_t *msg) {
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);
@ -3628,8 +3614,7 @@ render_zoneversion(dns_message_t *msg, isc_buffer_t *optbuf,
if (isc_buffer_availablelength(target) <
1)
{
result = ISC_R_NOSPACE;
goto cleanup;
CHECK(ISC_R_NOSPACE);
}
isc_buffer_putmem(target, &data[i], 1);
} else {
@ -3755,11 +3740,8 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
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;
}
@ -3777,11 +3759,8 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
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) {
@ -3795,12 +3774,9 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
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;
@ -3829,11 +3805,8 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
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;
}
@ -3920,11 +3893,8 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
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;
@ -4221,19 +4191,13 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section,
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;
@ -4365,11 +4329,8 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section,
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;
@ -4940,8 +4901,7 @@ buildopt(dns_message_t *message, dns_rdataset_t **rdatasetp) {
}
if (len > 0xffffU) {
result = ISC_R_NOSPACE;
goto cleanup;
CHECK(ISC_R_NOSPACE);
}
isc_buffer_allocate(message->mctx, &buf, len);

View file

@ -347,10 +347,7 @@ notify_send_toaddr(void *arg) {
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 */
@ -654,10 +651,7 @@ notify_send(dns_notify_t *notify) {
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;
}

View file

@ -173,10 +173,7 @@ dns_nsec_build(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
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);
@ -189,7 +186,7 @@ dns_nsec_build(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
result = ISC_R_SUCCESS;
}
failure:
cleanup:
if (dns_rdataset_isassociated(&rdataset)) {
dns_rdataset_disassociate(&rdataset);
}

View file

@ -509,10 +509,7 @@ dns_ntatable_totext(dns_ntatable_t *ntatable, const char *view,
}
first = false;
result = putstr(buf, obuf);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
CHECK(putstr(buf, obuf));
}
cleanup:

View file

@ -2981,15 +2981,9 @@ addnoqname(isc_mem_t *mctx, dns_slabheader_t *newheader, uint32_t maxrrperset,
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){
@ -3020,15 +3014,9 @@ addclosest(isc_mem_t *mctx, dns_slabheader_t *newheader, uint32_t maxrrperset,
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){

View file

@ -1090,14 +1090,10 @@ unknown_fromtext(dns_rdataclass_t rdclass, dns_rdatatype_t type,
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);
}
}
@ -1108,14 +1104,12 @@ unknown_fromtext(dns_rdataclass_t rdclass, dns_rdatatype_t type,
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;
}

View file

@ -514,8 +514,7 @@ dns_rdataslab_merge(dns_slabheader_t *oheader, dns_slabheader_t *nheader,
* 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);
}
/*
@ -523,8 +522,7 @@ dns_rdataslab_merge(dns_slabheader_t *oheader, dns_slabheader_t *nheader,
* 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. */
@ -535,13 +533,11 @@ dns_rdataslab_merge(dns_slabheader_t *oheader, dns_slabheader_t *nheader,
/* 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 */
@ -677,8 +673,7 @@ dns_rdataslab_subtract(dns_slabheader_t *oheader, dns_slabheader_t *sheader,
* duplicates.)
*/
if ((flags & DNS_RDATASLAB_EXACT) != 0 && rcount != scount) {
result = DNS_R_NOTEXACT;
goto cleanup;
CHECK(DNS_R_NOTEXACT);
}
/*
@ -686,16 +681,14 @@ dns_rdataslab_subtract(dns_slabheader_t *oheader, dns_slabheader_t *sheader,
* 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);
}
/*

View file

@ -463,17 +463,11 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf,
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];
@ -589,26 +583,17 @@ dns_request_create(dns_requestmgr_t *requestmgr, dns_message_t *message,
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);
@ -624,10 +609,7 @@ again:
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;
@ -692,44 +674,22 @@ req_render(dns_message_t *message, isc_buffer_t **bufferp, unsigned int options,
/*
* 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.

View file

@ -217,8 +217,7 @@ add_server(isc_mem_t *mctx, const char *address_str,
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) {
@ -238,8 +237,7 @@ add_server(isc_mem_t *mctx, const char *address_str,
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;

View file

@ -4524,10 +4524,7 @@ resume_qmin(void *arg) {
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;
@ -6314,10 +6311,7 @@ rctx_cachemessage(respctx_t *rctx) {
{
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));
}
}
}
@ -6968,10 +6962,7 @@ resume_dslookup(void *arg) {
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);
@ -7001,8 +6992,7 @@ resume_dslookup(void *arg) {
* 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. */
@ -10855,10 +10845,7 @@ dns_resolver_dumpquota(dns_resolver_t *res, isc_buffer_t *buf) {
" 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) {

View file

@ -164,23 +164,11 @@ check_hints(dns_db_t *db) {
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);
}
@ -212,21 +200,15 @@ dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
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.
@ -249,8 +231,8 @@ dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
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,
@ -260,7 +242,7 @@ dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
*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 "

View file

@ -1738,10 +1738,7 @@ update_nodes(dns_rpz_zone_t *rpz, isc_ht_t *newnodes) {
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) {
@ -1921,15 +1918,9 @@ update_rpz_cb(void *data) {
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);

View file

@ -990,21 +990,14 @@ modrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
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);
@ -1654,10 +1647,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
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);
@ -1678,8 +1668,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
} 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);
@ -1691,7 +1680,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
return ISC_R_SUCCESS;
failure:
cleanup:
if (rdatabuf != NULL) {
isc_buffer_free(&rdatabuf);
}

View file

@ -436,10 +436,7 @@ dns_transport_get_tlsctx(dns_transport_t *transport, const isc_sockaddr_t *peer,
* 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);
@ -475,12 +472,8 @@ dns_transport_get_tlsctx(dns_transport_t *transport, const isc_sockaddr_t *peer,
* 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;
}
@ -503,12 +496,9 @@ dns_transport_get_tlsctx(dns_transport_t *transport, const isc_sockaddr_t *peer,
* 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
@ -519,11 +509,8 @@ dns_transport_get_tlsctx(dns_transport_t *transport, const isc_sockaddr_t *peer,
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));
}
}
@ -597,7 +584,7 @@ dns_transport_get_tlsctx(dns_transport_t *transport, const isc_sockaddr_t *peer,
return ISC_R_SUCCESS;
failure:
cleanup:
if (tlsctx != NULL) {
isc_tlsctx_free(&tlsctx);
}

View file

@ -445,8 +445,7 @@ fetch_callback_dnskey(void *arg) {
dns_resolver_destroyfetch(&val->fetch);
if (CANCELED(val) || CANCELING(val)) {
result = ISC_R_CANCELED;
goto cleanup;
CHECK(ISC_R_CANCELED);
}
if (trustchain) {
@ -541,8 +540,7 @@ fetch_callback_ds(void *arg) {
dns_resolver_destroyfetch(&val->fetch);
if (CANCELED(val) || CANCELING(val)) {
result = ISC_R_CANCELED;
goto cleanup;
CHECK(ISC_R_CANCELED);
}
if (trustchain) {
@ -650,8 +648,7 @@ validator_callback_dnskey(void *arg) {
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");
@ -704,8 +701,7 @@ validator_callback_ds(void *arg) {
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");
@ -769,8 +765,7 @@ validator_callback_cname(void *arg) {
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");
@ -814,8 +809,7 @@ validator_callback_nsec(void *arg) {
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");
@ -1575,8 +1569,7 @@ validate_answer_iter_start(dns_validator_t *val) {
val->attributes &= ~VALATTR_OFFLOADED;
if (CANCELING(val)) {
validator_cancel_finish(val);
result = ISC_R_CANCELED;
goto cleanup;
CHECK(ISC_R_CANCELED);
}
if (val->resume) {
@ -1607,8 +1600,7 @@ validate_answer_iter_next(void *arg) {
val->attributes &= ~VALATTR_OFFLOADED;
if (CANCELING(val)) {
validator_cancel_finish(val);
result = ISC_R_CANCELED;
goto cleanup;
CHECK(ISC_R_CANCELED);
}
val->resume = false;
@ -1698,8 +1690,7 @@ validate_answer_process(void *arg) {
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);
@ -1709,10 +1700,7 @@ validate_answer_process(void *arg) {
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
@ -1760,7 +1748,6 @@ validate_answer_process(void *arg) {
next_key:
result = validate_async_run(val, validate_answer_iter_next);
goto cleanup;
cleanup:
validate_async_done(val, result);
@ -2256,8 +2243,7 @@ validate_dnskey(void *arg) {
dns_rdata_ds_t ds;
if (CANCELED(val) || CANCELING(val)) {
result = ISC_R_CANCELED;
goto cleanup;
CHECK(ISC_R_CANCELED);
}
/*
@ -2292,8 +2278,7 @@ validate_dnskey(void *arg) {
validator_log(val, ISC_LOG_DEBUG(3),
"no trusted root key");
}
result = DNS_R_NOVALIDSIG;
goto cleanup;
CHECK(DNS_R_NOVALIDSIG);
}
/*
@ -3587,8 +3572,7 @@ validator_start(void *arg) {
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");

View file

@ -1075,8 +1075,7 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name,
try_hints = true;
goto finish;
} else {
result = DNS_R_NXDOMAIN;
goto cleanup;
CHECK(DNS_R_NXDOMAIN);
}
} else if (result != ISC_R_SUCCESS) {
/*
@ -2125,8 +2124,7 @@ dns_view_addtrustedkey(dns_view_t *view, dns_rdatatype_t rdtype,
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));

View file

@ -2339,8 +2339,7 @@ zone_load(dns_zone_t *zone, unsigned int flags, bool locked) {
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);
@ -2404,8 +2403,7 @@ zone_load(dns_zone_t *zone, unsigned int flags, bool locked) {
ISC_LOG_DEBUG(1),
"skipping load: master file "
"older than last load");
result = DNS_R_UPTODATE;
goto cleanup;
CHECK(DNS_R_UPTODATE);
}
/*
@ -2455,8 +2453,7 @@ zone_load(dns_zone_t *zone, unsigned int flags, bool locked) {
"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);
@ -2847,21 +2844,15 @@ zone_startload(dns_db_t *db, dns_zone_t *zone, isc_time_t loadtime) {
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) {
@ -3470,10 +3461,7 @@ integrity_checks(dns_zone_t *zone, dns_db_t *db) {
}
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?
@ -3857,18 +3845,12 @@ zone_check_dnskeys(dns_zone_t *zone, dns_db_t *db) {
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];
@ -3972,10 +3954,7 @@ resume_signingwithkey(dns_zone_t *zone) {
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);
@ -4240,10 +4219,7 @@ resume_addnsec3chain(dns_zone_t *zone) {
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);
@ -5332,10 +5308,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
* 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));
}
/*
@ -5345,11 +5318,8 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
!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));
}
/*
@ -5447,30 +5417,24 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
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) {
@ -5488,14 +5452,10 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
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;
@ -5538,8 +5498,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
"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,
@ -5624,8 +5583,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
default:
UNEXPECTED_ERROR("unexpected zone type %d", zone->type);
result = ISC_R_UNEXPECTED;
goto cleanup;
CHECK(ISC_R_UNEXPECTED);
}
/*
@ -14282,8 +14240,7 @@ again:
}
break;
default:
result = ISC_R_NOTIMPLEMENTED;
goto cleanup;
CHECK(ISC_R_NOTIMPLEMENTED);
}
/*
@ -16944,15 +16901,9 @@ copy_non_dnssec_records(dns_db_t *db, dns_dbversion_t *version, dns_db_t *rawdb,
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;
@ -18442,15 +18393,11 @@ dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg,
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);
@ -19028,15 +18975,9 @@ zone_saveunique(dns_zone_t *zone, const char *path, const char *templat) {
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'; "
@ -19688,8 +19629,7 @@ zone_signwithkey(dns_zone_t *zone, dst_algorithm_t algorithm, uint16_t keyid,
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);
@ -20692,8 +20632,7 @@ checkds_send_toaddr(void *arg) {
checkds->zone->view->requestmgr == NULL ||
checkds->zone->db == NULL)
{
result = ISC_R_CANCELED;
goto cleanup;
CHECK(ISC_R_CANCELED);
}
/*
@ -20707,8 +20646,7 @@ checkds_send_toaddr(void *arg) {
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);
@ -20843,10 +20781,7 @@ checkds_send_tons(dns_checkds_t *checkds) {
}
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);
@ -20868,13 +20803,10 @@ checkds_send_tons(dns_checkds_t *checkds) {
* 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;
}
@ -21107,10 +21039,7 @@ nsfetch_done(dns_zonefetch_t *fetch, isc_result_t eresult) {
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);
@ -21163,7 +21092,7 @@ nsfetch_done(dns_zonefetch_t *fetch, isc_result_t eresult) {
LOCK_ZONE(zone);
done:
cleanup:
if (result != ISC_R_SUCCESS) {
dnssec_log(
zone, ISC_LOG_ERROR,
@ -22407,8 +22336,7 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
&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));

View file

@ -1486,11 +1486,7 @@ check_dnskey_sigs(vctx_t *vctx, const dns_rdata_dnskey_t *dnskey,
* 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

View file

@ -170,8 +170,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
strerror_r(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR("getting interface addresses: getifaddrs: %s",
strbuf);
result = ISC_R_UNEXPECTED;
goto failure;
CHECK(ISC_R_UNEXPECTED);
}
/*
@ -185,7 +184,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
*iterp = iter;
return ISC_R_SUCCESS;
failure:
cleanup:
if (iter->ifaddrs != NULL) { /* just in case */
freeifaddrs(iter->ifaddrs);
}

View file

@ -720,15 +720,11 @@ isc__nm_tcp_read(isc_nmhandle_t *handle, isc_nm_recv_cb_t cb, void *cbarg) {
}
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;
@ -738,7 +734,7 @@ isc__nm_tcp_read(isc_nmhandle_t *handle, isc_nm_recv_cb_t cb, void *cbarg) {
}
return;
failure:
cleanup:
isc__nm_tcp_failed_read_cb(sock, result, true);
}
@ -916,15 +912,14 @@ accept_connection(isc_nmsocket_t *csock) {
* 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 */
@ -941,8 +936,7 @@ accept_connection(isc_nmsocket_t *csock) {
* 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;
@ -953,33 +947,26 @@ accept_connection(isc_nmsocket_t *csock) {
&(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;
@ -1001,7 +988,7 @@ accept_connection(isc_nmsocket_t *csock) {
return ISC_R_SUCCESS;
failure:
cleanup:
csock->active = false;
csock->accepting = false;

View file

@ -699,8 +699,7 @@ cfg_acl_fromconfig(const cfg_obj_t *acl_data, const cfg_obj_t *cctx,
transports = isc_nm_httpsocket;
encrypted = false;
} else {
result = ISC_R_FAILURE;
goto cleanup;
CHECK(ISC_R_FAILURE);
}
}
@ -762,11 +761,8 @@ cfg_acl_fromconfig(const cfg_obj_t *acl_data, const cfg_obj_t *cctx,
* 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);
@ -785,11 +781,8 @@ cfg_acl_fromconfig(const cfg_obj_t *acl_data, const cfg_obj_t *cctx,
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);
@ -822,19 +815,13 @@ cfg_acl_fromconfig(const cfg_obj_t *acl_data, const cfg_obj_t *cctx,
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 */
@ -844,11 +831,8 @@ cfg_acl_fromconfig(const cfg_obj_t *acl_data, const cfg_obj_t *cctx,
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);
@ -866,11 +850,8 @@ cfg_acl_fromconfig(const cfg_obj_t *acl_data, const cfg_obj_t *cctx,
* "!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;
@ -899,12 +880,9 @@ cfg_acl_fromconfig(const cfg_obj_t *acl_data, const cfg_obj_t *cctx,
* 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;
}
@ -912,8 +890,7 @@ cfg_acl_fromconfig(const cfg_obj_t *acl_data, const cfg_obj_t *cctx,
cfg_obj_log(ce, ISC_LOG_WARNING,
"address match list contains "
"unsupported element type");
result = ISC_R_FAILURE;
goto cleanup;
CHECK(ISC_R_FAILURE);
}
/*

View file

@ -2892,10 +2892,7 @@ check_recursion(const cfg_obj_t *config, const cfg_obj_t *voptions,
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);
}
@ -4913,12 +4910,12 @@ check_trust_anchor(const cfg_obj_t *key, unsigned int *flagsp) {
"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) {

View file

@ -131,12 +131,9 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
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;
@ -158,8 +155,7 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
"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;
@ -181,16 +177,14 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
"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);
@ -227,8 +221,7 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
"takes to "
"do a rollover");
}
result = ISC_R_FAILURE;
goto cleanup;
CHECK(ISC_R_FAILURE);
}
}
@ -243,8 +236,7 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
"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 ||
@ -257,8 +249,7 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
"in FIPS mode",
alg.base);
}
result = DNS_R_BADALG;
goto cleanup;
CHECK(DNS_R_BADALG);
}
if (check_algorithms &&
@ -270,8 +261,7 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
"supported",
alg.base);
}
result = DNS_R_BADALG;
goto cleanup;
CHECK(DNS_R_BADALG);
}
switch (key->algorithm) {
@ -316,8 +306,7 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
"key length %u",
alg.base, size);
}
result = ISC_R_RANGE;
goto cleanup;
CHECK(ISC_R_RANGE);
}
break;
case DST_ALG_ECDSA256:
@ -351,8 +340,7 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
"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);
@ -362,8 +350,7 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
"dnssec-policy: tag-max "
"too big");
}
result = ISC_R_RANGE;
goto cleanup;
CHECK(ISC_R_RANGE);
}
if (tag_min >= tag_max) {
if (log_errors) {
@ -371,8 +358,7 @@ cfg_kaspkey_fromconfig(const cfg_obj_t *config, dns_kasp_t *kasp,
"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;
@ -688,11 +674,8 @@ cfg_kasp_fromconfig(const cfg_obj_t *config, dns_kasp_t *default_kasp,
(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);
@ -852,10 +835,7 @@ cfg_kasp_fromconfig(const cfg_obj_t *config, dns_kasp_t *default_kasp,
}
} 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. */
@ -941,12 +921,9 @@ cfg_kasp_builtinconfig(isc_mem_t *mctx, const char *name,
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);
}

View file

@ -1802,8 +1802,7 @@ parse_dtout(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
} else {
cfg_parser_error(pctx, CFG_LOG_NEAR,
"unexpected token");
result = ISC_R_UNEXPECTEDTOKEN;
goto cleanup;
CHECK(ISC_R_UNEXPECTEDTOKEN);
}
} else {
break;
@ -1975,8 +1974,7 @@ cfg_parse_kv_tuple(cfg_parser_t *pctx, const cfg_type_t *type,
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)
@ -3164,8 +3162,7 @@ parse_sizeval(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
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));
@ -3194,8 +3191,7 @@ parse_sizeval_percent(cfg_parser_t *pctx, const cfg_type_t *type,
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);
@ -3348,8 +3344,7 @@ parse_maybe_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type,
} else {
cfg_parser_error(pctx, CFG_LOG_NEAR, "expected '%s'",
kw->name);
result = ISC_R_UNEXPECTEDTOKEN;
goto cleanup;
CHECK(ISC_R_UNEXPECTEDTOKEN);
}
}

View file

@ -1335,8 +1335,7 @@ cfg_parse_duration(cfg_parser_t *pctx, const cfg_type_t *type ISC_ATTR_UNUSED,
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);
@ -1357,8 +1356,7 @@ cfg_parse_duration_or_unlimited(cfg_parser_t *pctx,
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) {
@ -3008,8 +3006,7 @@ parse_token(cfg_parser_t *pctx, const cfg_type_t *type ISC_ATTR_UNUSED,
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);
@ -3064,8 +3061,7 @@ parse_unsupported(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
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));
@ -3514,25 +3510,21 @@ parse_sockaddrsub(cfg_parser_t *pctx, const cfg_type_t *type, int flags,
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,

View file

@ -610,10 +610,7 @@ ns_client_send(ns_client_t *client) {
* 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;
}
@ -642,10 +639,7 @@ ns_client_send(ns_client_t *client) {
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);
@ -689,10 +683,7 @@ ns_client_send(ns_client_t *client) {
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));

View file

@ -2745,10 +2745,7 @@ stale_refresh_aftermath(ns_client_t *client, isc_result_t result) {
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;
@ -4161,12 +4158,9 @@ rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, isc_result_t qresult,
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));
}
}
@ -4176,12 +4170,9 @@ rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, isc_result_t qresult,
* 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.
@ -4226,12 +4217,9 @@ rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, isc_result_t qresult,
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.
@ -4286,10 +4274,7 @@ rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, isc_result_t qresult,
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;
@ -4698,20 +4683,11 @@ dns64_ttl(dns_db_t *db, dns_dbversion_t *version) {
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);
@ -6757,10 +6733,7 @@ ns_query_hookasync(query_ctx_t *qctx, ns_query_starthookasync_t runasync,
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,
@ -8269,14 +8242,11 @@ query_dns64(query_ctx_t *qctx) {
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;
@ -9882,14 +9852,11 @@ query_coveringnsec(query_ctx_t *qctx) {
* 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;
@ -10005,13 +9972,10 @@ query_coveringnsec(query_ctx_t *qctx) {
/*
* 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);
@ -10738,12 +10702,11 @@ query_addbestns(query_ctx_t *qctx) {
* 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.
@ -11152,10 +11115,7 @@ again:
/*
* 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,

View file

@ -93,16 +93,9 @@ setup_server(void **state) {
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);