Merge branch '4335-xfrin_xmlrender-cleanup-path-issue' into 'main'

Resolve "CID 465814: Control flow issues (DEADCODE) in statschannel.c"

Closes #4335

See merge request isc-projects/bind9!8334
This commit is contained in:
Arаm Sаrgsyаn
2023-09-27 11:19:51 +00:00
3 changed files with 29 additions and 18 deletions
+26 -14
View File
@@ -1454,7 +1454,6 @@ cleanup:
static isc_result_t
xfrin_xmlrender(dns_zone_t *zone, void *arg) {
isc_result_t result;
char buf[1024 + 32]; /* sufficiently large for zone name and class */
dns_rdataclass_t rdclass;
const char *ztype;
@@ -1479,23 +1478,30 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
return (ISC_R_SUCCESS);
}
result = dns_zone_getxfr(zone, &xfr, &is_running, &is_deferred,
&is_presoa, &is_pending, &needs_refresh);
if (result != ISC_R_SUCCESS) {
result = ISC_R_SUCCESS;
goto cleanup;
if (dns_zone_getxfr(zone, &xfr, &is_running, &is_deferred, &is_presoa,
&is_pending, &needs_refresh) != ISC_R_SUCCESS)
{
/*
* Failed to get information about the zone's incoming transfer
* (if any), but we still want to continue generating the
* remaining parts of the output.
*/
return (ISC_R_SUCCESS);
}
if (!is_running && !is_deferred && !is_presoa && !is_pending &&
!needs_refresh)
{
if (xfr != NULL) {
dns_xfrin_detach(&xfr);
}
/* No ongoing/queued transfer. */
goto cleanup;
return (ISC_R_SUCCESS);
}
if (is_running && xfr == NULL) {
/* The transfer is finished, and it's shutting down. */
goto cleanup;
return (ISC_R_SUCCESS);
}
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "xfrin"));
@@ -1696,16 +1702,22 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
TRY0(xmlTextWriterEndElement(writer)); /* xfrin */
if (xfr != NULL) {
dns_xfrin_detach(&xfr);
}
return (ISC_R_SUCCESS);
cleanup:
if (xfr != NULL) {
dns_xfrin_detach(&xfr);
}
if (result != ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"Failed at xfrin_xmlrender()");
}
return (result);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"Failed at xfrin_xmlrender()");
return (ISC_R_FAILURE);
}
static isc_result_t
+2 -3
View File
@@ -1856,9 +1856,8 @@ dns_zone_getxfr(dns_zone_t *zone, dns_xfrin_t **xfrp, bool *is_running,
*\li 'needs_refresh' to be non NULL.
*
* Returns:
* ISC_R_SUCCESS xfrin exists and the information was returned.
* ISC_R_NOTFOUND no xfrin was found for the zone.
* ISC_R_FAILED error while trying to get the xfrin information
* ISC_R_SUCCESS transfer information is returned
* ISC_R_FAILURE error while trying to get the transfer information
*/
void
+1 -1
View File
@@ -19293,7 +19293,7 @@ dns_zone_getxfr(dns_zone_t *zone, dns_xfrin_t **xfrp, bool *is_running,
REQUIRE(xfrp != NULL && *xfrp == NULL);
if (zone->zmgr == NULL) {
return (ISC_R_NOTFOUND);
return (ISC_R_FAILURE);
}
/* Reset. */