2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Make rndc showzone print a message when allow-new-zones is not configured (#40009)

Squashed commit of the following:

commit 77f12b02cf4e81f13e10db3cfac90e9de0b53928
Author: Mukund Sivaraman <muks@isc.org>
Date:   Mon Jul 13 05:28:13 2015 +0530

    Some tweaks

commit 9c521020b03c2fe7293ec4c970225fff479efd40
Author: Tony Finch <dot@dotat.at>
Date:   Thu Jul 9 15:36:15 2015 +0100

    rndc addzone error reporting improvements

    Clearer error messages from rndc addzone and modzone when the view is not
    known or when allow-new-zones is off.

    Also, remove a spurious newline from the delzone response.
This commit is contained in:
Mukund Sivaraman
2015-07-21 09:29:50 +05:30
parent 80a51d24ea
commit 2cc21870b0
2 changed files with 24 additions and 5 deletions

View File

@@ -1,3 +1,7 @@
4156. [func] Print informative output from rndc showzone when
allow-new-zones is not enabled for a view. Thanks to
Tony Finch for submitting a patch. [RT #40009]
4165. [security] A failure to reset a value to NULL in tkey.c could
result in an assertion failure. (CVE-2015-5477)
[RT #40046]

View File

@@ -9392,7 +9392,8 @@ nzf_append(FILE *fp, const char *viewname, const cfg_obj_t *zconfig) {
static isc_result_t
newzone_parse(ns_server_t *server, char *args, dns_view_t **viewp,
cfg_obj_t **zoneconfp, const cfg_obj_t **zoneobjp)
cfg_obj_t **zoneconfp, const cfg_obj_t **zoneobjp,
isc_buffer_t **text)
{
isc_result_t result;
isc_buffer_t argbuf;
@@ -9444,7 +9445,16 @@ newzone_parse(ns_server_t *server, char *args, dns_view_t **viewp,
viewname = cfg_obj_asstring(obj);
if (viewname == NULL || *viewname == '\0')
viewname = "_default";
CHECK(dns_viewlist_find(&server->viewlist, viewname, rdclass, &view));
result = dns_viewlist_find(&server->viewlist, viewname, rdclass,
&view);
if (result == ISC_R_NOTFOUND) {
(void) putstr(text, "no matching view found for '");
(void) putstr(text, viewname);
(void) putstr(text, "'");
goto cleanup;
} else if (result != ISC_R_SUCCESS) {
goto cleanup;
}
*viewp = view;
*zoneobjp = zoneobj;
@@ -9750,13 +9760,18 @@ ns_server_changezone(ns_server_t *server, char *args, isc_buffer_t **text) {
if (strncasecmp(args, "add", 3) == 0)
addzone = ISC_TRUE;
else
else {
INSIST(strncasecmp(args, "mod", 3) == 0);
addzone = ISC_FALSE;
}
CHECK(newzone_parse(server, args, &view, &zoneconf, &zoneobj));
CHECK(newzone_parse(server, args, &view, &zoneconf, &zoneobj, text));
/* Are we accepting new zones in this view? */
if (view->new_zone_file == NULL) {
(void) putstr(text, "Not allowing new zones in view '");
(void) putstr(text, view->name);
(void) putstr(text, "'");
result = ISC_R_NOPERM;
goto cleanup;
}
@@ -9930,7 +9945,7 @@ ns_server_delzone(ns_server_t *server, char *args, isc_buffer_t **text) {
TCHECK(putstr(text, "zone '"));
TCHECK(putstr(text, zonename));
TCHECK(putstr(text, "' was deleted.\n"));
TCHECK(putstr(text, "' was deleted."));
file = dns_zone_getfile(mayberaw);
first = inuse(file, ISC_TRUE, text);