From f9bcabff244b05692e790d74e5df433f9f1f063d Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Mon, 25 Sep 2023 12:33:29 +0000 Subject: [PATCH] Fix return value and docs for dns_zone_getxfr() When the given zone is not associated with a zone manager, the function currently returns ISC_R_NOTFOUND, which is documented as the return value for the case in which no incoming zone transfer is found. Make the function return ISC_R_FAILURE in such a case instead. Also update the description of the function as the value it returns is not meant to indicate whether an ongoing incoming transfer for the given zone exists. The boolean variables that the function sets via the pointers provided as its parameters, combined with either keeping '*xfrp' set to NULL or updating it to a valid pointer, can be used by the caller to infer all the necessary information. --- lib/dns/include/dns/zone.h | 5 ++--- lib/dns/zone.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index 694104659e..2e3b10ebfa 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -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 diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 3c6d4557f5..65bbde5946 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -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. */