Date: | Thu, 27 Jul 2017 17:58:34 -1000 |
To: | bind9-public@isc.org |
From: | marka@isc.org |
Subject: | rndc various: class is not being treated as optional when it should be |
When developing server-stale it was noted:
> * If IN class string is only passed to rndc ttl-stretching, it doesn't
> look like it skips non-matching classes
The code matches that from other options with the same documentation.
These all need fixing to address this in a manner similar to this:
diff --git a/bin/named/server.c b/bin/named/server.c
index a444aef231..66ffec0939 100644
--- a/bin/named/server.c
+++ b/bin/named/server.c
@@ -13930,17 +13930,16 @@ ns_server_servestale(ns_server_t *server, isc_lex_t *lex,
viewtxt = next_token(lex, text);
}
- if (classtxt == NULL) {
- rdclass = dns_rdataclass_in;
- } else {
+ if (classtxt != NULL) {
isc_textregion_t r;
+
r.base = classtxt;
r.length = strlen(classtxt);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS) {
if (viewtxt == NULL) {
- rdclass = dns_rdataclass_in;
viewtxt = classtxt;
+ classtxt = NULL;
result = ISC_R_SUCCESS;
} else {
snprintf(msg, sizeof(msg),
@@ -13961,9 +13960,10 @@ ns_server_servestale(ns_server_t *server, isc_lex_t *lex,
dns_ttl_t stale_ttl = 0;
dns_db_t *db = NULL;
- if (viewtxt != NULL &&
- (rdclass != view->rdclass ||
- strcmp(view->name, viewtxt) != 0))
+ if (classtxt != NULL && rdclass != view->rdclass)
+ continue;
+
+ if (viewtxt != NULL && strcmp(view->name, viewtxt) != 0)
continue;
if (!wantstatus) {