2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

bin/named/server.c: Fix couple of DbC conditions reported by Cppcheck

This commit is contained in:
Ondřej Surý
2019-09-27 09:19:36 +02:00
parent 9366ca769f
commit 476277a6e6
2 changed files with 26 additions and 24 deletions

View File

@@ -66,6 +66,8 @@
(concat directory-of-current-dir-locals-file "bin/dig/include"))
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/named/include"))
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/named/unix/include"))
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/rndc/include"))
(expand-file-name

View File

@@ -2485,15 +2485,17 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps,
} else {
old = NULL;
}
if (old == NULL)
if (old == NULL) {
*old_rpz_okp = false;
else
} else {
*old_rpz_okp = true;
}
for (i = 0;
zone_element != NULL;
++i, zone_element = cfg_list_next(zone_element)) {
INSIST(old != NULL || !*old_rpz_okp);
++i, zone_element = cfg_list_next(zone_element))
{
INSIST(!*old_rpz_okp || old != NULL);
if (*old_rpz_okp && i < old->p.num_zones) {
old_zone = old->zones[i];
} else {
@@ -2518,24 +2520,21 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps,
* zones are unchanged, then use the same policy data.
* Data for individual zones that must be reloaded will be merged.
*/
if (*old_rpz_okp &&
old != NULL && memcmp(&old->p, &zones->p, sizeof(zones->p)) != 0)
{
*old_rpz_okp = false;
}
if (*old_rpz_okp &&
(old == NULL ||
old->rps_cstr == NULL) != (zones->rps_cstr == NULL))
{
*old_rpz_okp = false;
}
if (*old_rpz_okp &&
(zones->rps_cstr != NULL &&
strcmp(old->rps_cstr, zones->rps_cstr) != 0))
{
*old_rpz_okp = false;
if (*old_rpz_okp) {
if (old != NULL &&
memcmp(&old->p, &zones->p, sizeof(zones->p)) != 0)
{
*old_rpz_okp = false;
} else if ((old == NULL || old->rps_cstr == NULL) !=
(zones->rps_cstr == NULL))
{
*old_rpz_okp = false;
} else if (old != NULL &&
zones->rps_cstr != NULL &&
strcmp(old->rps_cstr, zones->rps_cstr) != 0)
{
*old_rpz_okp = false;
}
}
if (*old_rpz_okp) {
@@ -2549,8 +2548,9 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps,
view->rpzs->rpz_ver);
}
if (pview != NULL)
if (pview != NULL) {
dns_view_detach(&pview);
}
return (ISC_R_SUCCESS);
}
@@ -6769,7 +6769,7 @@ dotat(dns_keytable_t *keytable, dns_keynode_t *keynode, void *arg) {
REQUIRE(keytable != NULL);
REQUIRE(keynode != NULL);
REQUIRE(arg != NULL);
REQUIRE(dotat_arg != NULL);
view = dotat_arg->view;
task = dotat_arg->task;