mirror of
https://github.com/isc-projects/bind9.git
synced 2026-07-14 22:00:54 -04:00
Fix a bug in xfrin.c:xfrin_connect_done()
When the connect callback's result is ISC_R_SUCCESS and the callback
changes the result because of some condition, the 'xfr' should not
be detached, because it now belongs to the receive callback.
Detach the reference only if the callback's result is non-success.
(cherry picked from commit fb27599b58)
This commit is contained in:
parent
331231e203
commit
5f28dfbb64
1 changed files with 11 additions and 6 deletions
|
|
@ -243,7 +243,7 @@ static isc_result_t
|
|||
xfrin_start(dns_xfrin_t *xfr);
|
||||
|
||||
static void
|
||||
xfrin_connect_done(isc_result_t result, isc_region_t *region, void *arg);
|
||||
xfrin_connect_done(isc_result_t eresult, isc_region_t *region, void *arg);
|
||||
static isc_result_t
|
||||
xfrin_send_request(dns_xfrin_t *xfr);
|
||||
static void
|
||||
|
|
@ -1437,19 +1437,18 @@ cleanup:
|
|||
* A connection has been established.
|
||||
*/
|
||||
static void
|
||||
xfrin_connect_done(isc_result_t result, isc_region_t *region ISC_ATTR_UNUSED,
|
||||
xfrin_connect_done(isc_result_t eresult, isc_region_t *region ISC_ATTR_UNUSED,
|
||||
void *arg) {
|
||||
dns_xfrin_t *xfr = (dns_xfrin_t *)arg;
|
||||
char addrtext[ISC_SOCKADDR_FORMATSIZE];
|
||||
char signerbuf[DNS_NAME_FORMATSIZE];
|
||||
const char *signer = "", *sep = "";
|
||||
dns_zonemgr_t *zmgr = NULL;
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(VALID_XFRIN(xfr));
|
||||
|
||||
if (atomic_load(&xfr->shuttingdown)) {
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
}
|
||||
result = atomic_load(&xfr->shuttingdown) ? ISC_R_SHUTTINGDOWN : eresult;
|
||||
|
||||
LIBDNS_XFRIN_CONNECTED(xfr, xfr->info, result);
|
||||
|
||||
|
|
@ -1516,7 +1515,13 @@ cleanup:
|
|||
}
|
||||
|
||||
detach:
|
||||
dns_xfrin_detach(&xfr);
|
||||
/*
|
||||
* If the connection was successful, then the reference now belongs to
|
||||
* the receive callback. Otherwise, detach it.
|
||||
*/
|
||||
if (eresult != ISC_R_SUCCESS) {
|
||||
dns_xfrin_detach(&xfr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue