mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-17 21:47:49 -04:00
Fix a few cosmetic issues with rndc managed-keys
The handling of class and view arguments was broken, because the code
didn't realise that next_token() would overwrite the class name when
it parsed the view name. The code was trying to implement a syntax
like `refresh [[class] view]`, but it was documented to have a syntax
like `refresh [class [view]]`. The latter is consistent with other rndc
commands, so that is how I have fixed it.
Before:
$ rndc managed-keys refresh in rec
rndc: 'managed-keys' failed: unknown class/type
unknown class 'rec'
After:
$ rndc managed-keys refresh in rec
refreshing managed keys for 'rec'
There were missing newlines in the output from `rndc managed-keys
refresh` and `rndc managed-keys destroy`.
Before:
$ rndc managed-keys refresh
refreshing managed keys for 'rec'refreshing managed keys for 'auth'
After:
$ rndc managed-keys refresh
refreshing managed keys for 'rec'
refreshing managed keys for 'auth'
(cherry picked from commit 6a3b851f72)
This commit is contained in:
parent
f21d6327dd
commit
bc984ace12
1 changed files with 12 additions and 18 deletions
|
|
@ -14930,29 +14930,17 @@ named_server_mkeys(named_server_t *server, isc_lex_t *lex,
|
|||
/* Look for the optional class name. */
|
||||
classtxt = next_token(lex, text);
|
||||
if (classtxt != NULL) {
|
||||
/* Look for the optional view name. */
|
||||
viewtxt = next_token(lex, text);
|
||||
}
|
||||
|
||||
if (classtxt == NULL) {
|
||||
rdclass = dns_rdataclass_in;
|
||||
} else {
|
||||
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;
|
||||
result = ISC_R_SUCCESS;
|
||||
} else {
|
||||
snprintf(msg, sizeof(msg),
|
||||
"unknown class '%s'", classtxt);
|
||||
(void) putstr(text, msg);
|
||||
goto cleanup;
|
||||
}
|
||||
snprintf(msg, sizeof(msg),
|
||||
"unknown class '%s'", classtxt);
|
||||
(void) putstr(text, msg);
|
||||
goto cleanup;
|
||||
}
|
||||
viewtxt = next_token(lex, text);
|
||||
}
|
||||
|
||||
for (view = ISC_LIST_HEAD(server->viewlist);
|
||||
|
|
@ -14981,6 +14969,9 @@ named_server_mkeys(named_server_t *server, isc_lex_t *lex,
|
|||
|
||||
switch (opt) {
|
||||
case REFRESH:
|
||||
if (!first) {
|
||||
CHECK(putstr(text, "\n"));
|
||||
}
|
||||
CHECK(mkey_refresh(view, text));
|
||||
break;
|
||||
case STATUS:
|
||||
|
|
@ -14988,12 +14979,14 @@ named_server_mkeys(named_server_t *server, isc_lex_t *lex,
|
|||
CHECK(putstr(text, "\n\n"));
|
||||
}
|
||||
CHECK(mkey_status(view, text));
|
||||
first = false;
|
||||
break;
|
||||
case SYNC:
|
||||
CHECK(dns_zone_flush(view->managed_keys));
|
||||
break;
|
||||
case DESTROY:
|
||||
if (!first) {
|
||||
CHECK(putstr(text, "\n"));
|
||||
}
|
||||
CHECK(mkey_destroy(server, view, text));
|
||||
break;
|
||||
default:
|
||||
|
|
@ -15004,6 +14997,7 @@ named_server_mkeys(named_server_t *server, isc_lex_t *lex,
|
|||
if (viewtxt != NULL) {
|
||||
break;
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue