From f1387514c68c338fe35ed4bfaa73ec06136a9f92 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 30 Jan 2023 11:18:49 +1100 Subject: [PATCH] Handle address lookup failure more gracefully If the address lookup of the primary server fails just abort the current update request rather than calling exit. This allows nsupdate to cleanup gracefully. --- bin/nsupdate/nsupdate.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index a67a651db6..49ee0e3b08 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -2797,8 +2797,8 @@ recvsoa(isc_task_t *task, isc_event_t *event) { dns_request_destroy(&request); dns_message_detach(&soaquery); ddebug("Out of recvsoa"); - done_update(); seenerror = true; + done_update(); return; } @@ -2903,7 +2903,14 @@ lookforsoa: primary_total = get_addresses(serverstr, dnsport, primary_servers, primary_alloc); if (primary_total == 0) { - exit(1); + seenerror = true; + dns_rdata_freestruct(&soa); + dns_message_detach(&soaquery); + dns_request_destroy(&request); + dns_message_detach(&rcvmsg); + ddebug("Out of recvsoa"); + done_update(); + return; } primary_inuse = 0; } else {