2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Remove double non-NULL guard around bindrdataset()

The bindrdataset() already has a logic to skip the rest of the function
if the passed rdataset is NULL.  Remove the external guarding for
'addedrdataset' to simplify the code flow both from the zone and cache
databases.
This commit is contained in:
Ondřej Surý 2025-08-21 08:56:29 +02:00
parent bc5c9cf62b
commit c60bdbcf5c
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41
2 changed files with 17 additions and 31 deletions

View File

@ -2667,14 +2667,11 @@ add(qpcache_t *qpdb, qpcnode_t *qpnode, dns_slabheader_t *newheader,
* The NXDOMAIN/NODATA(QTYPE=ANY)
* is more trusted.
*/
if (addedrdataset != NULL) {
bindrdataset(
qpdb, qpnode,
top->header, now,
nlocktype, tlocktype,
addedrdataset
DNS__DB_FLARG_PASS);
}
bindrdataset(
qpdb, qpnode, top->header, now,
nlocktype, tlocktype,
addedrdataset
DNS__DB_FLARG_PASS);
return DNS_R_UNCHANGED;
}
/*
@ -2725,11 +2722,9 @@ find_header:
if (trust < header->trust &&
(ACTIVE(header, now) || !EXISTS(header)))
{
if (addedrdataset != NULL) {
bindrdataset(qpdb, qpnode, header, now,
nlocktype, tlocktype,
addedrdataset DNS__DB_FLARG_PASS);
}
bindrdataset(qpdb, qpnode, header, now, nlocktype,
tlocktype,
addedrdataset DNS__DB_FLARG_PASS);
return DNS_R_UNCHANGED;
}
@ -2764,11 +2759,9 @@ find_header:
header->closest = newheader->closest;
newheader->closest = NULL;
}
if (addedrdataset != NULL) {
bindrdataset(qpdb, qpnode, header, now,
nlocktype, tlocktype,
addedrdataset DNS__DB_FLARG_PASS);
}
bindrdataset(qpdb, qpnode, header, now, nlocktype,
tlocktype,
addedrdataset DNS__DB_FLARG_PASS);
return DNS_R_UNCHANGED;
}
@ -2816,11 +2809,9 @@ find_header:
header->closest = newheader->closest;
newheader->closest = NULL;
}
if (addedrdataset != NULL) {
bindrdataset(qpdb, qpnode, header, now,
nlocktype, tlocktype,
addedrdataset DNS__DB_FLARG_PASS);
}
bindrdataset(qpdb, qpnode, header, now, nlocktype,
tlocktype,
addedrdataset DNS__DB_FLARG_PASS);
return DNS_R_UNCHANGED;
}
@ -2893,10 +2884,8 @@ find_header:
}
}
if (addedrdataset != NULL) {
bindrdataset(qpdb, qpnode, newheader, now, nlocktype, tlocktype,
addedrdataset DNS__DB_FLARG_PASS);
}
bindrdataset(qpdb, qpnode, newheader, now, nlocktype, tlocktype,
addedrdataset DNS__DB_FLARG_PASS);
return ISC_R_SUCCESS;
}

View File

@ -2053,10 +2053,7 @@ add(qpzonedb_t *qpdb, qpznode_t *node, const dns_name_t *nodename,
return DNS_R_CNAMEANDOTHER;
}
if (addedrdataset != NULL) {
bindrdataset(qpdb, node, newheader,
addedrdataset DNS__DB_FLARG_PASS);
}
bindrdataset(qpdb, node, newheader, addedrdataset DNS__DB_FLARG_PASS);
return ISC_R_SUCCESS;
}