2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 10:10:06 +00:00

Use coccinelle to add braces to nested single line statement

Both clang-tidy and uncrustify chokes on statement like this:

for (...)
	if (...)
		break;

This commit uses a very simple semantic patch (below) to add braces around such
statements.

Semantic patch used:

@@
statement S;
expression E;
@@

while (...)
- if (E) S
+ { if (E) { S } }

@@
statement S;
expression E;
@@

for (...;...;...)
- if (E) S
+ { if (E) { S } }

@@
statement S;
expression E;
@@

if (...)
- if (E) S
+ { if (E) { S } }
This commit is contained in:
Ondřej Surý 2020-02-13 18:16:57 +01:00
parent c823ed4f07
commit 36c6105e4f
43 changed files with 537 additions and 273 deletions

View File

@ -692,9 +692,11 @@ resume:
listcount = newlen;
}
/* Seen? */
for (j = 0; j < l; j++)
if (strcasecmp(lists[j].name, listname) == 0)
for (j = 0; j < l; j++) {
if (strcasecmp(lists[j].name, listname) == 0) {
break;
}
}
if (j < l)
continue;
tresult = named_config_getmastersdef(config, listname,

View File

@ -945,10 +945,13 @@ update_listener(named_controls_t *cp, controllistener_t **listenerp,
isc_result_t result = ISC_R_SUCCESS;
for (listener = ISC_LIST_HEAD(cp->listeners); listener != NULL;
listener = ISC_LIST_NEXT(listener, link))
if (isc_sockaddr_equal(addr, &listener->address))
listener = ISC_LIST_NEXT(listener, link)) {
if (isc_sockaddr_equal(addr, &listener->address)) {
break;
}
}
if (listener == NULL) {
*listenerp = NULL;
return;

View File

@ -1744,10 +1744,16 @@ check_dbtype(dns_zone_t *zone, unsigned int dbtypec, const char **dbargv,
/*
* Check that all the arguments match.
*/
for (i = 0; i < dbtypec; i++)
if (argv[i] == NULL || strcmp(argv[i], dbargv[i]) != 0)
for (i = 0; i < dbtypec; i++) {
if (argv[i] == NULL || strcmp(argv[i], dbargv[i]) != 0) {
CHECK(ISC_R_FAILURE);
/*
* Check that there are not extra arguments.
*/
}
}
/*
* Check that there are not extra arguments.
*/
@ -10525,10 +10531,13 @@ add_view_tolist(struct dumpcontext *dctx, dns_view_t *view)
* Prevent duplicate views.
*/
for (vle = ISC_LIST_HEAD(dctx->viewlist); vle != NULL;
vle = ISC_LIST_NEXT(vle, link))
if (vle->view == view)
vle = ISC_LIST_NEXT(vle, link)) {
if (vle->view == view) {
return (ISC_R_SUCCESS);
}
}
vle = isc_mem_get(dctx->mctx, sizeof *vle);
vle->view = NULL;
dns_view_attach(view, &vle->view);

View File

@ -3660,10 +3660,13 @@ update_listener(named_server_t *server, named_statschannel_t **listenerp,
isc_result_t result = ISC_R_SUCCESS;
for (listener = ISC_LIST_HEAD(server->statschannels); listener != NULL;
listener = ISC_LIST_NEXT(listener, link))
if (isc_sockaddr_equal(addr, &listener->address))
listener = ISC_LIST_NEXT(listener, link)) {
if (isc_sockaddr_equal(addr, &listener->address)) {
break;
}
}
if (listener == NULL) {
*listenerp = NULL;
return;

View File

@ -468,11 +468,13 @@ main(int argc, char *argv[])
if (verbose && dbi != NULL) {
if (dbi->wversion != NULL)
printf("future version (%p)\n", dbi->wversion);
for (i = 0; i < dbi->rcount; i++)
if (dbi->rversions[i] != NULL)
for (i = 0; i < dbi->rcount; i++) {
if (dbi->rversions[i] != NULL) {
printf("open version %d (%p)\n", i,
dbi->rversions[i]);
}
}
}
dns_name_init(&name, offsets);
if (strcmp(s, "!R") == 0) {
DBI_CHECK(dbi);

View File

@ -679,15 +679,17 @@ odbc_getManyFields(SQLHSTMT *stmnt, SQLSMALLINT startField,
REQUIRE(startField > 0 && startField <= endField);
/* determine how large the data is */
for (i = startField; i <= endField; i++)
if (sqlOK(SQLColAttribute(stmnt, i, SQL_DESC_DISPLAY_SIZE, NULL,
0, NULL, &size)) &&
size > 0) {
for (i = startField; i <= endField; i++) {
if (sqlOK(SQLColAttribute(stmnt, i, SQL_DESC_DISPLAY_SIZE, NULL, 0, NULL, &size)) && size > 0) {
{
/* always allow for a " " (space) character */
totSize += (size + 1);
/* after the data item */
}
}
}
if (totSize < 1)
return ISC_R_FAILURE;

View File

@ -383,10 +383,12 @@ mysql_get_resultset(const char *zone, const char *record, const char *client,
qres = mysql_query((MYSQL *)dbi->dbconn, querystring);
if (qres == 0)
break;
for (j = 0; j < 4; j++)
if (mysql_ping((MYSQL *)dbi->dbconn) == 0)
for (j = 0; j < 4; j++) {
if (mysql_ping((MYSQL *)dbi->dbconn) == 0) {
break;
}
}
}
if (qres == 0) {
result = ISC_R_SUCCESS;

View File

@ -437,10 +437,13 @@ build_query(mysql_data_t *state, mysql_instance_t *dbi, const char *command,
*query = '\0';
for (item = DLZ_LIST_HEAD(arglist); item != NULL;
item = DLZ_LIST_NEXT(item, link))
if (item->arg != NULL)
item = DLZ_LIST_NEXT(item, link)) {
if (item->arg != NULL) {
strcat(query, item->arg);
}
}
fail:
va_end(ap1);

View File

@ -4478,10 +4478,18 @@ bind9_check_namedconf(const cfg_obj_t *config, bool check_plugins,
(void)cfg_map_get(config, "view", &views);
if (views != NULL && options != NULL)
if (check_dual_stack(options, logctx) != ISC_R_SUCCESS)
if (views != NULL && options != NULL) {
if (check_dual_stack(options, logctx) != ISC_R_SUCCESS) {
result = ISC_R_FAILURE;
/*
* Use case insensitive comparision as not all file systems are
* case sensitive. This will prevent people using FOO.DB and foo.db
* on case sensitive file systems but that shouldn't be a major issue.
*/
}
}
/*
* Use case insensitive comparision as not all file systems are
* case sensitive. This will prevent people using FOO.DB and foo.db
@ -4622,9 +4630,11 @@ bind9_check_namedconf(const cfg_obj_t *config, bool check_plugins,
aclname = cfg_obj_asstring(cfg_tuple_get(acl, "name"));
for (i = 0; i < sizeof(builtin) / sizeof(builtin[0]);
i++)
i++) {
if (strcasecmp(aclname, builtin[i]) == 0) {
cfg_obj_log(acl, logctx, ISC_LOG_ERROR,
{
cfg_obj_log(acl, logctx,
ISC_LOG_ERROR,
"attempt to redefine "
"builtin acl '%s'",
aclname);
@ -4632,6 +4642,9 @@ bind9_check_namedconf(const cfg_obj_t *config, bool check_plugins,
break;
}
}
}
for (elt2 = cfg_list_next(elt); elt2 != NULL;
elt2 = cfg_list_next(elt2)) {
const cfg_obj_t *acl2 = cfg_listelt_value(elt2);

View File

@ -610,10 +610,16 @@ grow_entries(isc_task_t *task, isc_event_t *ev)
/*
* Are we shutting down?
*/
for (i = 0; i < adb->nentries; i++)
if (adb->entry_sd[i])
for (i = 0; i < adb->nentries; i++) {
if (adb->entry_sd[i]) {
goto cleanup;
/*
* Grab all the resources we need.
*/
}
}
/*
* Grab all the resources we need.
*/
@ -764,10 +770,16 @@ grow_names(isc_task_t *task, isc_event_t *ev)
/*
* Are we shutting down?
*/
for (i = 0; i < adb->nnames; i++)
if (adb->name_sd[i])
for (i = 0; i < adb->nnames; i++) {
if (adb->name_sd[i]) {
goto cleanup;
/*
* Grab all the resources we need.
*/
}
}
/*
* Grab all the resources we need.
*/
@ -963,9 +975,11 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
link_entry(adb, addr_bucket, entry);
} else {
for (anh = ISC_LIST_HEAD(*hookhead); anh != NULL;
anh = ISC_LIST_NEXT(anh, plink))
if (anh->entry == foundentry)
anh = ISC_LIST_NEXT(anh, plink)) {
if (anh->entry == foundentry) {
break;
}
}
if (anh == NULL) {
foundentry->refcnt++;
foundentry->nh++;

View File

@ -291,9 +291,11 @@ dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr,
cleanup_db:
dns_db_detach(&cache->db);
cleanup_dbargv:
for (i = extra; i < cache->db_argc; i++)
if (cache->db_argv[i] != NULL)
for (i = extra; i < cache->db_argc; i++) {
if (cache->db_argv[i] != NULL) {
isc_mem_free(cmctx, cache->db_argv[i]);
}
}
if (cache->db_argv != NULL)
isc_mem_put(cmctx, cache->db_argv,
cache->db_argc * sizeof(char *));

View File

@ -85,9 +85,11 @@ impfind(const char *name)
dns_dbimplementation_t *imp;
for (imp = ISC_LIST_HEAD(implementations); imp != NULL;
imp = ISC_LIST_NEXT(imp, link))
if (strcasecmp(name, imp->name) == 0)
imp = ISC_LIST_NEXT(imp, link)) {
if (strcasecmp(name, imp->name) == 0) {
return (imp);
}
}
return (NULL);
}

View File

@ -93,9 +93,11 @@ dlz_impfind(const char *name)
dns_dlzimplementation_t *imp;
for (imp = ISC_LIST_HEAD(dlz_implementations); imp != NULL;
imp = ISC_LIST_NEXT(imp, link))
if (strcasecmp(name, imp->name) == 0)
imp = ISC_LIST_NEXT(imp, link)) {
if (strcasecmp(name, imp->name) == 0) {
return (imp);
}
}
return (NULL);
}

View File

@ -1406,10 +1406,18 @@ dns_dnssec_findmatchingkeys(const dns_name_t *origin, const char *directory,
dir.entry.name[i] != '+')
continue;
for (i++; i < dir.entry.length; i++)
if (dir.entry.name[i] < '0' || dir.entry.name[i] > '9')
for (i++; i < dir.entry.length; i++) {
if (dir.entry.name[i] < '0' || dir.entry.name[i] > '9') {
break;
/*
* Did we not read exactly 5 more digits?
* Did we overflow?
* Did we correctly terminate?
*/
}
}
/*
* Did we not read exactly 5 more digits?
* Did we overflow?

View File

@ -257,9 +257,11 @@ dst_lib_destroy(void)
RUNTIME_CHECK(dst_initialized == true);
dst_initialized = false;
for (i = 0; i < DST_MAX_ALGS; i++)
if (dst_t_func[i] != NULL && dst_t_func[i]->cleanup != NULL)
for (i = 0; i < DST_MAX_ALGS; i++) {
if (dst_t_func[i] != NULL && dst_t_func[i]->cleanup != NULL) {
dst_t_func[i]->cleanup();
}
}
dst__openssl_destroy();
#if USE_PKCS11
(void)dst__pkcs11_destroy();

View File

@ -181,9 +181,11 @@ check_rsa(const dst_private_t *priv, bool external)
have[i] = false;
for (j = 0; j < priv->nelements; j++) {
for (i = 0; i < RSA_NTAGS; i++)
if (priv->elements[j].tag == TAG(DST_ALG_RSA, i))
for (i = 0; i < RSA_NTAGS; i++) {
if (priv->elements[j].tag == TAG(DST_ALG_RSA, i)) {
break;
}
}
if (i == RSA_NTAGS)
return (-1);
have[i] = true;
@ -214,9 +216,11 @@ check_dh(const dst_private_t *priv)
if (priv->nelements != DH_NTAGS)
return (-1);
for (i = 0; i < DH_NTAGS; i++) {
for (j = 0; j < priv->nelements; j++)
if (priv->elements[j].tag == TAG(DST_ALG_DH, i))
for (j = 0; j < priv->nelements; j++) {
if (priv->elements[j].tag == TAG(DST_ALG_DH, i)) {
break;
}
}
if (j == priv->nelements)
return (-1);
}
@ -237,9 +241,11 @@ check_ecdsa(const dst_private_t *priv, bool external)
for (i = 0; i < ECDSA_NTAGS; i++)
have[i] = false;
for (j = 0; j < priv->nelements; j++) {
for (i = 0; i < ECDSA_NTAGS; i++)
if (priv->elements[j].tag == TAG(DST_ALG_ECDSA256, i))
for (i = 0; i < ECDSA_NTAGS; i++) {
if (priv->elements[j].tag == TAG(DST_ALG_ECDSA256, i)) {
break;
}
}
if (i == ECDSA_NTAGS)
return (-1);
have[i] = true;
@ -268,9 +274,11 @@ check_eddsa(const dst_private_t *priv, bool external)
for (i = 0; i < EDDSA_NTAGS; i++)
have[i] = false;
for (j = 0; j < priv->nelements; j++) {
for (i = 0; i < EDDSA_NTAGS; i++)
if (priv->elements[j].tag == TAG(DST_ALG_ED25519, i))
for (i = 0; i < EDDSA_NTAGS; i++) {
if (priv->elements[j].tag == TAG(DST_ALG_ED25519, i)) {
break;
}
}
if (i == EDDSA_NTAGS)
return (-1);
have[i] = true;
@ -304,9 +312,11 @@ check_hmac_md5(const dst_private_t *priv, bool old)
* We must be new format at this point.
*/
for (i = 0; i < HMACMD5_NTAGS; i++) {
for (j = 0; j < priv->nelements; j++)
if (priv->elements[j].tag == TAG(DST_ALG_HMACMD5, i))
for (j = 0; j < priv->nelements; j++) {
if (priv->elements[j].tag == TAG(DST_ALG_HMACMD5, i)) {
break;
}
}
if (j == priv->nelements)
return (-1);
}
@ -320,9 +330,11 @@ check_hmac_sha(const dst_private_t *priv, unsigned int ntags, unsigned int alg)
if (priv->nelements != ntags)
return (-1);
for (i = 0; i < ntags; i++) {
for (j = 0; j < priv->nelements; j++)
if (priv->elements[j].tag == TAG(alg, i))
for (j = 0; j < priv->nelements; j++) {
if (priv->elements[j].tag == TAG(alg, i)) {
break;
}
}
if (j == priv->nelements)
return (-1);
}

View File

@ -76,9 +76,11 @@ impfind(const char *name)
dyndb_implementation_t *imp;
for (imp = ISC_LIST_HEAD(dyndb_implementations); imp != NULL;
imp = ISC_LIST_NEXT(imp, link))
if (strcasecmp(name, imp->name) == 0)
imp = ISC_LIST_NEXT(imp, link)) {
if (strcasecmp(name, imp->name) == 0) {
return (imp);
}
}
return (NULL);
}
@ -367,10 +369,13 @@ dns_dyndb_load(const char *libname, const char *name, const char *parameters,
result = ISC_R_SUCCESS;
cleanup:
if (result != ISC_R_SUCCESS)
if (implementation != NULL)
if (result != ISC_R_SUCCESS) {
if (implementation != NULL) {
unload_library(&implementation);
}
}
UNLOCK(&dyndb_lock);
return (result);
}

View File

@ -1925,12 +1925,16 @@ dns_diff_subtract(dns_diff_t diff[2], dns_diff_t *r)
if (p[0] == NULL && p[1] == NULL)
break;
for (i = 0; i < 2; i++)
for (i = 0; i < 2; i++) {
if (p[!i] == NULL) {
ISC_LIST_UNLINK(diff[i].tuples, p[i], link);
{
ISC_LIST_UNLINK(diff[i].tuples, p[i],
link);
ISC_LIST_APPEND(r->tuples, p[i], link);
goto next;
}
}
}
t = rdata_order(&p[0], &p[1]);
if (t < 0) {
ISC_LIST_UNLINK(diff[0].tuples, p[0], link);

View File

@ -363,9 +363,9 @@ gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *token, bool eol,
}
/*NOTREACHED*/
}
if (eol != true)
if (token->type == isc_tokentype_eol ||
token->type == isc_tokentype_eof) {
if (eol != true) {
if (token->type == isc_tokentype_eol || token->type == isc_tokentype_eof) {
{
unsigned long int line;
const char *what;
const char *file;
@ -382,6 +382,8 @@ gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *token, bool eol,
file, line, what);
return (ISC_R_UNEXPECTEDEND);
}
}
}
return (ISC_R_SUCCESS);
}

View File

@ -2475,10 +2475,12 @@ dns_name_isdnssd(const dns_name_t *name)
if (dns_name_countlabels(name) > 3U) {
dns_name_init(&prefix, NULL);
dns_name_getlabelsequence(name, 0, 3, &prefix);
for (i = 0; i < (sizeof(dns_sd) / sizeof(dns_sd[0])); i++)
if (dns_name_equal(&prefix, &dns_sd[i]))
for (i = 0; i < (sizeof(dns_sd) / sizeof(dns_sd[0])); i++) {
if (dns_name_equal(&prefix, &dns_sd[i])) {
return (true);
}
}
}
return (false);
}
@ -2534,9 +2536,11 @@ dns_name_isrfc1918(const dns_name_t *name)
{
size_t i;
for (i = 0; i < (sizeof(rfc1918names) / sizeof(*rfc1918names)); i++)
if (dns_name_issubdomain(name, &rfc1918names[i]))
for (i = 0; i < (sizeof(rfc1918names) / sizeof(*rfc1918names)); i++) {
if (dns_name_issubdomain(name, &rfc1918names[i])) {
return (true);
}
}
return (false);
}
@ -2553,9 +2557,11 @@ dns_name_isula(const dns_name_t *name)
{
size_t i;
for (i = 0; i < (sizeof(ulanames) / sizeof(*ulanames)); i++)
if (dns_name_issubdomain(name, &ulanames[i]))
for (i = 0; i < (sizeof(ulanames) / sizeof(*ulanames)); i++) {
if (dns_name_issubdomain(name, &ulanames[i])) {
return (true);
}
}
return (false);
}

View File

@ -75,9 +75,11 @@ dns_nsec_compressbitmap(unsigned char *map, const unsigned char *raw,
for (window = 0; window < 256; window++) {
if (window * 256 > max_type)
break;
for (octet = 31; octet >= 0; octet--)
if (*(raw + octet) != 0)
for (octet = 31; octet >= 0; octet--) {
if (*(raw + octet) != 0) {
break;
}
}
if (octet < 0) {
raw += 32;
continue;

View File

@ -137,10 +137,13 @@ dns_peerlist_addpeer(dns_peerlist_t *peers, dns_peer_t *peer)
* More specifics to front of list.
*/
for (p = ISC_LIST_HEAD(peers->elements); p != NULL;
p = ISC_LIST_NEXT(p, next))
if (p->prefixlen < peer->prefixlen)
p = ISC_LIST_NEXT(p, next)) {
if (p->prefixlen < peer->prefixlen) {
break;
}
}
if (p != NULL)
ISC_LIST_INSERTBEFORE(peers->elements, p, peer, next);
else

View File

@ -249,13 +249,16 @@ err:
if (hKey != CK_INVALID_HANDLE)
(void)pkcs_C_DestroyObject(pk11_ctx->session, hKey);
for (i = 5; i <= 6; i++)
for (i = 5; i <= 6; i++) {
if (keyTemplate[i].pValue != NULL) {
{
memset(keyTemplate[i].pValue, 0,
keyTemplate[i].ulValueLen);
isc_mem_put(dctx->mctx, keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
}
}
}
pk11_return_session(pk11_ctx);
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
isc_mem_put(dctx->mctx, pk11_ctx, sizeof(*pk11_ctx));
@ -340,13 +343,16 @@ err:
if (hKey != CK_INVALID_HANDLE)
(void)pkcs_C_DestroyObject(pk11_ctx->session, hKey);
for (i = 5; i <= 6; i++)
for (i = 5; i <= 6; i++) {
if (keyTemplate[i].pValue != NULL) {
{
memset(keyTemplate[i].pValue, 0,
keyTemplate[i].ulValueLen);
isc_mem_put(dctx->mctx, keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
}
}
}
pk11_return_session(pk11_ctx);
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
isc_mem_put(dctx->mctx, pk11_ctx, sizeof(*pk11_ctx));

View File

@ -230,13 +230,16 @@ err:
if (hKey != CK_INVALID_HANDLE)
(void)pkcs_C_DestroyObject(pk11_ctx->session, hKey);
for (i = 5; i <= 6; i++)
for (i = 5; i <= 6; i++) {
if (keyTemplate[i].pValue != NULL) {
{
memset(keyTemplate[i].pValue, 0,
keyTemplate[i].ulValueLen);
isc_mem_put(dctx->mctx, keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
}
}
}
pk11_return_session(pk11_ctx);
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
isc_mem_put(dctx->mctx, pk11_ctx, sizeof(*pk11_ctx));
@ -328,13 +331,16 @@ err:
if (hKey != CK_INVALID_HANDLE)
(void)pkcs_C_DestroyObject(pk11_ctx->session, hKey);
for (i = 5; i <= 6; i++)
for (i = 5; i <= 6; i++) {
if (keyTemplate[i].pValue != NULL) {
{
memset(keyTemplate[i].pValue, 0,
keyTemplate[i].ulValueLen);
isc_mem_put(dctx->mctx, keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
}
}
}
pk11_return_session(pk11_ctx);
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
isc_mem_put(dctx->mctx, pk11_ctx, sizeof(*pk11_ctx));

View File

@ -233,26 +233,33 @@ token_key:
dctx->ctxdata.pk11_ctx = pk11_ctx;
for (i = 6; i <= 13; i++)
for (i = 6; i <= 13; i++) {
if (keyTemplate[i].pValue != NULL) {
{
isc_safe_memwipe(keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
isc_mem_put(dctx->mctx, keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
}
}
}
return (ISC_R_SUCCESS);
err:
if (!pk11_ctx->ontoken && (pk11_ctx->object != CK_INVALID_HANDLE))
(void)pkcs_C_DestroyObject(pk11_ctx->session, pk11_ctx->object);
for (i = 6; i <= 13; i++)
for (i = 6; i <= 13; i++) {
if (keyTemplate[i].pValue != NULL) {
{
isc_safe_memwipe(keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
isc_mem_put(dctx->mctx, keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
}
}
}
pk11_return_session(pk11_ctx);
isc_safe_memwipe(pk11_ctx, sizeof(*pk11_ctx));
isc_mem_put(dctx->mctx, pk11_ctx, sizeof(*pk11_ctx));
@ -374,26 +381,33 @@ pkcs11rsa_createctx_verify(dst_key_t *key, unsigned int maxbits,
dctx->ctxdata.pk11_ctx = pk11_ctx;
for (i = 5; i <= 6; i++)
for (i = 5; i <= 6; i++) {
if (keyTemplate[i].pValue != NULL) {
{
isc_safe_memwipe(keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
isc_mem_put(dctx->mctx, keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
}
}
}
return (ISC_R_SUCCESS);
err:
if (!pk11_ctx->ontoken && (pk11_ctx->object != CK_INVALID_HANDLE))
(void)pkcs_C_DestroyObject(pk11_ctx->session, pk11_ctx->object);
for (i = 5; i <= 6; i++)
for (i = 5; i <= 6; i++) {
if (keyTemplate[i].pValue != NULL) {
{
isc_safe_memwipe(keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
isc_mem_put(dctx->mctx, keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
}
}
}
pk11_return_session(pk11_ctx);
isc_safe_memwipe(pk11_ctx, sizeof(*pk11_ctx));
isc_mem_put(dctx->mctx, pk11_ctx, sizeof(*pk11_ctx));
@ -838,13 +852,16 @@ token_key:
err:
if (hKey != CK_INVALID_HANDLE)
(void)pkcs_C_DestroyObject(pk11_ctx->session, hKey);
for (i = 6; i <= 13; i++)
for (i = 6; i <= 13; i++) {
if (keyTemplate[i].pValue != NULL) {
{
isc_safe_memwipe(keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
isc_mem_put(dctx->mctx, keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
}
}
}
pk11_return_session(pk11_ctx);
isc_safe_memwipe(pk11_ctx, sizeof(*pk11_ctx));
isc_mem_put(dctx->mctx, pk11_ctx, sizeof(*pk11_ctx));
@ -957,13 +974,16 @@ pkcs11rsa_verify(dst_context_t *dctx, const isc_region_t *sig)
err:
if (hKey != CK_INVALID_HANDLE)
(void)pkcs_C_DestroyObject(pk11_ctx->session, hKey);
for (i = 5; i <= 6; i++)
for (i = 5; i <= 6; i++) {
if (keyTemplate[i].pValue != NULL) {
{
isc_safe_memwipe(keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
isc_mem_put(dctx->mctx, keyTemplate[i].pValue,
keyTemplate[i].ulValueLen);
}
}
}
pk11_return_session(pk11_ctx);
isc_safe_memwipe(pk11_ctx, sizeof(*pk11_ctx));
isc_mem_put(dctx->mctx, pk11_ctx, sizeof(*pk11_ctx));

View File

@ -2101,14 +2101,20 @@ restore_locks:
/*
* Relock a read lock, or unlock the write lock if no lock was held.
*/
if (tlock == isc_rwlocktype_none)
if (write_locked)
if (tlock == isc_rwlocktype_none) {
if (write_locked) {
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
if (tlock == isc_rwlocktype_read)
if (write_locked)
}
}
if (tlock == isc_rwlocktype_read) {
if (write_locked) {
isc_rwlock_downgrade(&rbtdb->tree_lock);
}
}
return (no_reference);
}
@ -5286,9 +5292,10 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now)
"reprieve by RETAIN() %s",
printname);
}
} else if (isc_mem_isovermem(rbtdb->common.mctx) && log)
} else if (isc_mem_isovermem(rbtdb->common.mctx) && log) {
isc_log_write(dns_lctx, category, module, level,
"overmem cache: saved %s", printname);
}
NODE_UNLOCK(&rbtdb->node_locks[rbtnode->locknum].lock,
isc_rwlocktype_write);
@ -5829,9 +5836,11 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion,
* type so they can be marked ancient later.
*/
for (topheader = rbtnode->data; topheader != NULL;
topheader = topheader->next)
if (topheader->type == sigtype)
topheader = topheader->next) {
if (topheader->type == sigtype) {
sigheader = topheader;
}
}
negtype = RBTDB_RDATATYPE_VALUE(covers, 0);
} else {
/*
@ -8312,9 +8321,11 @@ cleanup_deadnodes:
cleanup_heaps:
if (rbtdb->heaps != NULL) {
for (i = 0; i < (int)rbtdb->node_lock_count; i++)
if (rbtdb->heaps[i] != NULL)
for (i = 0; i < (int)rbtdb->node_lock_count; i++) {
if (rbtdb->heaps[i] != NULL) {
isc_heap_destroy(&rbtdb->heaps[i]);
}
}
isc_mem_put(hmctx, rbtdb->heaps,
rbtdb->node_lock_count * sizeof(isc_heap_t *));
}
@ -9319,11 +9330,14 @@ setownercase(rdatasetheader_t *header, const dns_name_t *name)
*/
memset(header->upper, 0, sizeof(header->upper));
fully_lower = true;
for (i = 0; i < name->length; i++)
for (i = 0; i < name->length; i++) {
if (name->ndata[i] >= 0x41 && name->ndata[i] <= 0x5a) {
{
header->upper[i / 8] |= 1 << (i % 8);
fully_lower = false;
}
}
}
header->attributes |= RDATASET_ATTR_CASESET;
if (ISC_LIKELY(fully_lower))
header->attributes |= RDATASET_ATTR_CASEFULLYLOWER;
@ -9785,10 +9799,13 @@ restart:
*/
RWLOCK(&rbtversion->glue_rwlock, isc_rwlocktype_read);
for (cur = rbtversion->glue_table[idx]; cur != NULL; cur = cur->next)
if (cur->node == node)
for (cur = rbtversion->glue_table[idx]; cur != NULL; cur = cur->next) {
if (cur->node == node) {
break;
}
}
if (cur == NULL) {
goto no_glue;
}

View File

@ -302,9 +302,11 @@ static inline isc_result_t fromtext_caa(ARGS_FROMTEXT)
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
false));
tr = token.value.as_textregion;
for (i = 0; i < tr.length; i++)
if (!alphanumeric[(unsigned char)tr.base[i]])
for (i = 0; i < tr.length; i++) {
if (!alphanumeric[(unsigned char)tr.base[i]]) {
RETTOK(DNS_R_SYNTAX);
}
}
RETERR(uint8_tobuffer(tr.length, target));
RETERR(mem_tobuffer(target, tr.base, tr.length));
@ -388,9 +390,14 @@ static inline isc_result_t fromwire_caa(ARGS_FROMWIRE)
RETERR(DNS_R_FORMERR);
/* Check the Tag's value */
for (i = 0; i < len; i++)
if (!alphanumeric[sr.base[i]])
for (i = 0; i < len; i++) {
if (!alphanumeric[sr.base[i]]) {
RETERR(DNS_R_FORMERR);
/*
* Tag + Value
*/
}
}
/*
* Tag + Value
*/
@ -460,9 +467,11 @@ static inline isc_result_t fromstruct_caa(ARGS_FROMSTRUCT)
*/
region.base = caa->tag;
region.length = caa->tag_len;
for (i = 0; i < region.length; i++)
if (!alphanumeric[region.base[i]])
for (i = 0; i < region.length; i++) {
if (!alphanumeric[region.base[i]]) {
RETERR(DNS_R_SYNTAX);
}
}
RETERR(isc_buffer_copyregion(target, &region));
/*

View File

@ -307,9 +307,11 @@ getalt:
* We don't just multiply out as we will overflow.
*/
if (m > 0) {
for (exp = 0; exp < 7; exp++)
if (m < poweroften[exp + 1])
for (exp = 0; exp < 7; exp++) {
if (m < poweroften[exp + 1]) {
break;
}
}
man = m / poweroften[exp];
exp += 2;
} else {
@ -360,9 +362,11 @@ getalt:
* We don't just multiply out as we will overflow.
*/
if (m > 0) {
for (exp = 0; exp < 7; exp++)
if (m < poweroften[exp + 1])
for (exp = 0; exp < 7; exp++) {
if (m < poweroften[exp + 1]) {
break;
}
}
man = m / poweroften[exp];
exp += 2;
} else if (cm >= 10) {
@ -411,9 +415,11 @@ getalt:
* We don't just multiply out as we will overflow.
*/
if (m > 0) {
for (exp = 0; exp < 7; exp++)
if (m < poweroften[exp + 1])
for (exp = 0; exp < 7; exp++) {
if (m < poweroften[exp + 1]) {
break;
}
}
man = m / poweroften[exp];
exp += 2;
} else if (cm >= 10) {
@ -592,28 +598,39 @@ static inline isc_result_t fromwire_loc(ARGS_FROMWIRE)
* Size.
*/
c = sr.base[1];
if (c != 0)
if ((c & 0xf) > 9 || ((c >> 4) & 0xf) > 9 ||
((c >> 4) & 0xf) == 0)
if (c != 0) {
if ((c & 0xf) > 9 || ((c >> 4) & 0xf) > 9 || ((c >> 4) & 0xf) == 0) {
return (ISC_R_RANGE);
/*
* Horizontal precision.
*/
}
}
/*
* Horizontal precision.
*/
c = sr.base[2];
if (c != 0)
if ((c & 0xf) > 9 || ((c >> 4) & 0xf) > 9 ||
((c >> 4) & 0xf) == 0)
if (c != 0) {
if ((c & 0xf) > 9 || ((c >> 4) & 0xf) > 9 || ((c >> 4) & 0xf) == 0) {
return (ISC_R_RANGE);
/*
* Vertical precision.
*/
}
}
/*
* Vertical precision.
*/
c = sr.base[3];
if (c != 0)
if ((c & 0xf) > 9 || ((c >> 4) & 0xf) > 9 ||
((c >> 4) & 0xf) == 0)
if (c != 0) {
if ((c & 0xf) > 9 || ((c >> 4) & 0xf) > 9 || ((c >> 4) & 0xf) == 0) {
return (ISC_R_RANGE);
}
}
isc_region_consume(&sr, 4);
/*

View File

@ -100,21 +100,23 @@ static inline isc_result_t totext_nxt(ARGS_TOTEXT)
for (i = 0; i < sr.length; i++) {
if (sr.base[i] != 0)
for (j = 0; j < 8; j++)
for (j = 0; j < 8; j++) {
if ((sr.base[i] & (0x80 >> j)) != 0) {
{
dns_rdatatype_t t = i * 8 + j;
RETERR(str_totext(" ", target));
if (dns_rdatatype_isknown(t)) {
RETERR(dns_rdatatype_totext(
t, target));
RETERR(dns_rdatatype_totext(t, target));
}else {
char buf[sizeof("65535")];
snprintf(buf, sizeof(buf), "%u",
t);
snprintf(buf, sizeof(buf),
"%u", t);
RETERR(str_totext(buf, target));
}
}
}
}
}
return (ISC_R_SUCCESS);
}

View File

@ -33,9 +33,11 @@ static inline isc_result_t fromtext_x25(ARGS_FROMTEXT)
false));
if (token.value.as_textregion.length < 4)
RETTOK(DNS_R_SYNTAX);
for (i = 0; i < token.value.as_textregion.length; i++)
if (!isdigit(token.value.as_textregion.base[i] & 0xff))
for (i = 0; i < token.value.as_textregion.length; i++) {
if (!isdigit(token.value.as_textregion.base[i] & 0xff)) {
RETTOK(ISC_R_RANGE);
}
}
RETTOK(txt_fromtext(&token.value.as_textregion, target));
return (ISC_R_SUCCESS);
}
@ -113,10 +115,13 @@ static inline isc_result_t fromstruct_x25(ARGS_FROMSTRUCT)
if (x25->x25_len < 4)
return (ISC_R_RANGE);
for (i = 0; i < x25->x25_len; i++)
if (!isdigit(x25->x25[i] & 0xff))
for (i = 0; i < x25->x25_len; i++) {
if (!isdigit(x25->x25[i] & 0xff)) {
return (ISC_R_RANGE);
}
}
RETERR(uint8_tobuffer(x25->x25_len, target));
return (mem_tobuffer(target, x25->x25, x25->x25_len));
}

View File

@ -64,9 +64,11 @@ static inline isc_result_t fromtext_in_apl(ARGS_FROMTEXT)
RETTOK(DNS_R_BADDOTTEDQUAD);
if (prefix > 32)
RETTOK(ISC_R_RANGE);
for (len = 4; len > 0; len--)
if (addr[len - 1] != 0)
for (len = 4; len > 0; len--) {
if (addr[len - 1] != 0) {
break;
}
}
break;
case 2:
@ -77,9 +79,11 @@ static inline isc_result_t fromtext_in_apl(ARGS_FROMTEXT)
RETTOK(DNS_R_BADAAAA);
if (prefix > 128)
RETTOK(ISC_R_RANGE);
for (len = 16; len > 0; len--)
if (addr[len - 1] != 0)
for (len = 16; len > 0; len--) {
if (addr[len - 1] != 0) {
break;
}
}
break;
default:

View File

@ -163,10 +163,13 @@ static inline isc_result_t fromtext_in_wks(ARGS_FROMTEXT)
* case sensitive and the database is usually in lowercase.
*/
strlcpy(service, DNS_AS_STR(token), sizeof(service));
for (i = strlen(service) - 1; i >= 0; i--)
if (isupper(service[i] & 0xff))
for (i = strlen(service) - 1; i >= 0; i--) {
if (isupper(service[i] & 0xff)) {
service[i] = tolower(service[i] & 0xff);
}
}
port = strtol(DNS_AS_STR(token), &e, 10);
if (*e == 0)
;
@ -222,14 +225,17 @@ static inline isc_result_t totext_in_wks(ARGS_TOTEXT)
INSIST(sr.length <= 8 * 1024);
for (i = 0; i < sr.length; i++) {
if (sr.base[i] != 0)
for (j = 0; j < 8; j++)
for (j = 0; j < 8; j++) {
if ((sr.base[i] & (0x80 >> j)) != 0) {
snprintf(buf, sizeof(buf), "%u",
i * 8 + j);
{
snprintf(buf, sizeof(buf),
"%u", i * 8 + j);
RETERR(str_totext(" ", target));
RETERR(str_totext(buf, target));
}
}
}
}
return (ISC_R_SUCCESS);
}

View File

@ -375,9 +375,14 @@ isc__rdatalist_setownercase(dns_rdataset_t *rdataset, const dns_name_t *name)
*/
rdatalist = rdataset->private1;
memset(rdatalist->upper, 0, sizeof(rdatalist->upper));
for (i = 1; i < name->length; i++)
if (name->ndata[i] >= 0x41 && name->ndata[i] <= 0x5a)
for (i = 1; i < name->length; i++) {
if (name->ndata[i] >= 0x41 && name->ndata[i] <= 0x5a) {
rdatalist->upper[i / 8] |= 1 << (i % 8);
/*
* Record that upper has been set.
*/
}
}
/*
* Record that upper has been set.
*/

View File

@ -1314,34 +1314,46 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp,
if (finish != NULL || age_untried)
for (addrinfo = ISC_LIST_HEAD(fctx->forwaddrs);
addrinfo != NULL;
addrinfo = ISC_LIST_NEXT(addrinfo, publink))
if (UNMARKED(addrinfo))
addrinfo = ISC_LIST_NEXT(addrinfo, publink)) {
if (UNMARKED(addrinfo)) {
dns_adb_agesrtt(fctx->adb, addrinfo, now);
}
}
if ((finish != NULL || age_untried) && TRIEDFIND(fctx))
for (find = ISC_LIST_HEAD(fctx->finds); find != NULL;
find = ISC_LIST_NEXT(find, publink))
find = ISC_LIST_NEXT(find, publink)) {
for (addrinfo = ISC_LIST_HEAD(find->list);
addrinfo != NULL;
addrinfo = ISC_LIST_NEXT(addrinfo, publink))
if (UNMARKED(addrinfo))
addrinfo = ISC_LIST_NEXT(addrinfo, publink)) {
if (UNMARKED(addrinfo)) {
dns_adb_agesrtt(fctx->adb, addrinfo,
now);
}
}
}
if ((finish != NULL || age_untried) && TRIEDALT(fctx)) {
for (addrinfo = ISC_LIST_HEAD(fctx->altaddrs); addrinfo != NULL;
addrinfo = ISC_LIST_NEXT(addrinfo, publink))
if (UNMARKED(addrinfo))
addrinfo = ISC_LIST_NEXT(addrinfo, publink)) {
if (UNMARKED(addrinfo)) {
dns_adb_agesrtt(fctx->adb, addrinfo, now);
}
}
for (find = ISC_LIST_HEAD(fctx->altfinds); find != NULL;
find = ISC_LIST_NEXT(find, publink))
find = ISC_LIST_NEXT(find, publink)) {
for (addrinfo = ISC_LIST_HEAD(find->list);
addrinfo != NULL;
addrinfo = ISC_LIST_NEXT(addrinfo, publink))
if (UNMARKED(addrinfo))
addrinfo = ISC_LIST_NEXT(addrinfo, publink)) {
if (UNMARKED(addrinfo)) {
dns_adb_agesrtt(fctx->adb, addrinfo,
now);
}
}
}
}
/*
* Check for any outstanding socket events. If they exist, cancel
@ -7199,10 +7211,12 @@ betterreferral(fetchctx_t *fctx)
if (!isstrictsubdomain(name, &fctx->domain))
continue;
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link))
if (rdataset->type == dns_rdatatype_ns)
rdataset = ISC_LIST_NEXT(rdataset, link)) {
if (rdataset->type == dns_rdatatype_ns) {
return (true);
}
}
}
return (false);
}

View File

@ -260,9 +260,11 @@ initial_size(unsigned int len)
{
unsigned int size;
for (size = 1024; size < (64 * 1024); size *= 2)
if (len < size)
for (size = 1024; size < (64 * 1024); size *= 2) {
if (len < size) {
return (size);
}
}
return (65535);
}

View File

@ -2417,10 +2417,13 @@ zone_registerinclude(const char *filename, void *arg)
* Suppress duplicates.
*/
for (inc = ISC_LIST_HEAD(zone->newincludes); inc != NULL;
inc = ISC_LIST_NEXT(inc, link))
if (strcmp(filename, inc->name) == 0)
inc = ISC_LIST_NEXT(inc, link)) {
if (strcmp(filename, inc->name) == 0) {
return;
}
}
inc = isc_mem_get(zone->mctx, sizeof(dns_include_t));
inc->name = isc_mem_strdup(zone->mctx, filename);
ISC_LINK_INIT(inc, link);
@ -5869,9 +5872,11 @@ same_addrs(isc_sockaddr_t const *oldlist, isc_sockaddr_t const *newlist,
{
unsigned int i;
for (i = 0; i < count; i++)
if (!isc_sockaddr_equal(&oldlist[i], &newlist[i]))
for (i = 0; i < count; i++) {
if (!isc_sockaddr_equal(&oldlist[i], &newlist[i])) {
return (false);
}
}
return (true);
}
@ -12377,11 +12382,14 @@ next_master:
/*
* Did we get a good answer from all the masters?
*/
for (j = 0; j < zone->masterscnt; j++)
for (j = 0; j < zone->masterscnt; j++) {
if (zone->mastersok[j] == false) {
{
done = false;
break;
}
}
}
} else
done = true;
if (!done) {
@ -12873,11 +12881,14 @@ next_master:
/*
* Did we get a good answer from all the masters?
*/
for (j = 0; j < zone->masterscnt; j++)
for (j = 0; j < zone->masterscnt; j++) {
if (zone->mastersok[j] == false) {
{
done = false;
break;
}
}
}
} else
done = true;
if (!done) {
@ -18008,9 +18019,11 @@ dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state)
break;
case DNS_ZONESTATE_SOAQUERY:
for (zone = ISC_LIST_HEAD(zmgr->zones); zone != NULL;
zone = ISC_LIST_NEXT(zone, link))
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_REFRESH))
zone = ISC_LIST_NEXT(zone, link)) {
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_REFRESH)) {
count++;
}
}
break;
case DNS_ZONESTATE_ANY:
for (zone = ISC_LIST_HEAD(zmgr->zones); zone != NULL;

View File

@ -170,11 +170,14 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
#endif
family = sa->sa_family;
for (i = 0; afdl[i].a_af; i++)
for (i = 0; afdl[i].a_af; i++) {
if (afdl[i].a_af == family) {
{
afd = &afdl[i];
goto found;
}
}
}
ERR(EAI_FAMILY);
found:

View File

@ -520,9 +520,14 @@ have_header(isc_httpd_t *httpd, const char *header, const char *value,
* Terminate token search on NULL or EOL.
*/
while (*h != 0 && *h != '\r' && *h != '\n') {
if (strncasecmp(h, value, vlen) == 0)
if (strchr(eov, h[vlen]) != NULL)
if (strncasecmp(h, value, vlen) == 0) {
if (strchr(eov, h[vlen]) != NULL) {
return (true);
/*
* Skip to next token.
*/
}
}
/*
* Skip to next token.
*/

View File

@ -748,10 +748,13 @@ isc_log_usechannel(isc_logconfig_t *lcfg, const char *name,
REQUIRE(module == NULL || module->id < lctx->module_count);
for (channel = ISC_LIST_HEAD(lcfg->channels); channel != NULL;
channel = ISC_LIST_NEXT(channel, link))
if (strcmp(name, channel->name) == 0)
channel = ISC_LIST_NEXT(channel, link)) {
if (strcmp(name, channel->name) == 0) {
break;
}
}
if (channel == NULL)
return (ISC_R_NOTFOUND);
@ -845,13 +848,14 @@ isc_log_setdebuglevel(isc_log_t *lctx, unsigned int level)
*/
if (lctx->debug_level == 0)
for (channel = ISC_LIST_HEAD(lctx->logconfig->channels);
channel != NULL; channel = ISC_LIST_NEXT(channel, link))
if (channel->type == ISC_LOG_TOFILE &&
(channel->flags & ISC_LOG_DEBUGONLY) != 0 &&
FILE_STREAM(channel) != NULL) {
channel != NULL; channel = ISC_LIST_NEXT(channel, link)) {
if (channel->type == ISC_LOG_TOFILE && (channel->flags & ISC_LOG_DEBUGONLY) != 0 && FILE_STREAM(channel) != NULL) {
{
(void)fclose(FILE_STREAM(channel));
FILE_STREAM(channel) = NULL;
}
}
}
UNLOCK(&lctx->lock);
}
@ -922,13 +926,15 @@ isc_log_closefilelogs(isc_log_t *lctx)
LOCK(&lctx->lock);
for (channel = ISC_LIST_HEAD(lctx->logconfig->channels);
channel != NULL; channel = ISC_LIST_NEXT(channel, link))
channel != NULL; channel = ISC_LIST_NEXT(channel, link)) {
if (channel->type == ISC_LOG_TOFILE &&
FILE_STREAM(channel) != NULL) {
if (channel->type == ISC_LOG_TOFILE && FILE_STREAM(channel) != NULL) {
{
(void)fclose(FILE_STREAM(channel));
FILE_STREAM(channel) = NULL;
}
}
}
UNLOCK(&lctx->lock);
}

View File

@ -291,15 +291,19 @@ pk11_get_session(pk11_context_t *ctx, pk11_optype_t optype, bool need_services,
switch (optype) {
case OP_ANY:
for (token = ISC_LIST_HEAD(tokens); token != NULL;
token = ISC_LIST_NEXT(token, link))
if (token->slotid == slot)
token = ISC_LIST_NEXT(token, link)) {
if (token->slotid == slot) {
break;
}
}
break;
default:
for (token = ISC_LIST_HEAD(tokens); token != NULL;
token = ISC_LIST_NEXT(token, link))
if (token->slotid == slot)
token = ISC_LIST_NEXT(token, link)) {
if (token->slotid == slot) {
break;
}
}
break;
}
if (token == NULL)
@ -698,9 +702,11 @@ pk11_attribute_bytype(const pk11_object_t *obj, CK_ATTRIBUTE_TYPE type)
CK_ATTRIBUTE *attr;
for (attr = pk11_attribute_first(obj); attr != NULL;
attr = pk11_attribute_next(obj, attr))
if (attr->type == type)
attr = pk11_attribute_next(obj, attr)) {
if (attr->type == type) {
return (attr);
}
}
return (NULL);
}
@ -899,33 +905,41 @@ pk11_parse_uri(pk11_object_t *obj, const char *label, isc_mem_t *mctx,
if (token == NULL)
for (token = ISC_LIST_HEAD(tokens);
token != NULL;
token = ISC_LIST_NEXT(token, link))
if (pk11strcmp(v, l, token->name, 32))
token = ISC_LIST_NEXT(token, link)) {
if (pk11strcmp(v, l, token->name, 32)) {
break;
}
}
} else if (strcmp(a, "manufacturer") == 0) {
/* manufacturer: CK_TOKEN_INFO manufacturerID */
if (token == NULL)
for (token = ISC_LIST_HEAD(tokens);
token != NULL;
token = ISC_LIST_NEXT(token, link))
if (pk11strcmp(v, l, token->manuf, 32))
token = ISC_LIST_NEXT(token, link)) {
if (pk11strcmp(v, l, token->manuf, 32)) {
break;
}
}
} else if (strcmp(a, "serial") == 0) {
/* serial: CK_TOKEN_INFO serialNumber */
if (token == NULL)
for (token = ISC_LIST_HEAD(tokens);
token != NULL;
token = ISC_LIST_NEXT(token, link))
if (pk11strcmp(v, l, token->serial, 16))
token = ISC_LIST_NEXT(token, link)) {
if (pk11strcmp(v, l, token->serial, 16)) {
break;
}
}
} else if (strcmp(a, "model") == 0) {
/* model: CK_TOKEN_INFO model */
if (token == NULL)
for (token = ISC_LIST_HEAD(tokens);
token != NULL;
token = ISC_LIST_NEXT(token, link))
if (pk11strcmp(v, l, token->model, 16))
token = ISC_LIST_NEXT(token, link)) {
if (pk11strcmp(v, l, token->model, 16)) {
break;
}
}
} else if (strcmp(a, "library-manufacturer") == 0) {
/* ignored */
} else if (strcmp(a, "library-description") == 0) {

View File

@ -297,9 +297,11 @@ isc_file_renameunique(const char *file, char *templet)
}
}
}
if (unlink(file) < 0)
if (errno != ENOENT)
if (unlink(file) < 0) {
if (errno != ENOENT) {
return (isc__errno2result(errno));
}
}
return (ISC_R_SUCCESS);
}

View File

@ -3039,10 +3039,12 @@ parse_unsupported(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret)
braces++;
else if (pctx->token.value.as_char == '}')
braces--;
else if (pctx->token.value.as_char == ';')
if (braces == 0)
else if (pctx->token.value.as_char == ';') {
if (braces == 0) {
break;
}
}
}
if (pctx->token.type == isc_tokentype_eof || braces < 0) {
cfg_parser_error(pctx, CFG_LOG_NEAR,
"unexpected token");

View File

@ -10535,15 +10535,18 @@ query_glueanswer(query_ctx_t *qctx)
msg = qctx->client->message;
for (name = ISC_LIST_HEAD(msg->sections[section]); name != NULL;
name = ISC_LIST_NEXT(name, link))
name = ISC_LIST_NEXT(name, link)) {
if (dns_name_equal(name, qctx->client->query.qname)) {
for (rdataset = ISC_LIST_HEAD(name->list);
rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link))
if (rdataset->type == qctx->qtype)
rdataset = ISC_LIST_NEXT(rdataset, link)) {
if (rdataset->type == qctx->qtype) {
break;
}
}
break;
}
}
if (rdataset != NULL) {
ISC_LIST_UNLINK(msg->sections[section], name, link);
ISC_LIST_PREPEND(msg->sections[section], name, link);