From c79e85f7d77317a9b5c34b4bb94eaf1779fc0b6e Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 24 May 2006 04:23:15 +0000 Subject: [PATCH] 2031. [bug] Emit a error message when "rndc refresh" is called on a non slave/stub zone. [RT # 16073] --- CHANGES | 3 +++ bin/named/server.c | 25 +++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 898fb3cecf..fae5647d8a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2031. [bug] Emit a error message when "rndc refresh" is called on + a non slave/stub zone. [RT # 16073] + 2030. [bug] We were being overly conservative when disabling openssl engine support. [RT #16030] diff --git a/bin/named/server.c b/bin/named/server.c index c3fbe7fb38..2f9ae8c5c0 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.464 2006/05/18 02:00:11 marka Exp $ */ +/* $Id: server.c,v 1.465 2006/05/24 04:23:15 marka Exp $ */ /*! \file */ @@ -4021,20 +4021,29 @@ isc_result_t ns_server_refreshcommand(ns_server_t *server, char *args, isc_buffer_t *text) { isc_result_t result; dns_zone_t *zone = NULL; - const unsigned char msg[] = "zone refresh queued"; + const unsigned char msg1[] = "zone refresh queued"; + const unsigned char msg2[] = "not a slave or stub zone"; + dns_zonetype_t type; result = zone_from_args(server, args, &zone); if (result != ISC_R_SUCCESS) return (result); if (zone == NULL) return (ISC_R_UNEXPECTEDEND); - - dns_zone_refresh(zone); - dns_zone_detach(&zone); - if (sizeof(msg) <= isc_buffer_availablelength(text)) - isc_buffer_putmem(text, msg, sizeof(msg)); - return (ISC_R_SUCCESS); + type = dns_zone_gettype(zone); + if (type == dns_zone_slave || type == dns_zone_stub) { + dns_zone_refresh(zone); + dns_zone_detach(&zone); + if (sizeof(msg1) <= isc_buffer_availablelength(text)) + isc_buffer_putmem(text, msg1, sizeof(msg1)); + return (ISC_R_SUCCESS); + } + + dns_zone_detach(&zone); + if (sizeof(msg2) <= isc_buffer_availablelength(text)) + isc_buffer_putmem(text, msg2, sizeof(msg2)); + return (ISC_R_FAILURE); } isc_result_t