2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-28 13:08:06 +00:00

construct the rndc.conf path from rndc.key

This commit is contained in:
Evan Hunt 2019-02-05 16:08:26 -08:00 committed by Mark Andrews
parent 43ae6c623d
commit 2e7ec85497

View File

@ -447,6 +447,8 @@ set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) {
static void
printversion(bool verbose) {
char rndcconf[PATH_MAX], *dot = NULL;
printf("%s %s%s%s <id:%s>\n",
named_g_product, named_g_version,
(*named_g_description != '\0') ? " " : "",
@ -507,12 +509,27 @@ OPENSSL_VERSION_NUMBER >= 0x10100000L /* 1.1.0 or higher */
#endif
printf("threads support is enabled\n\n");
/*
* The default rndc.conf and rndc.key paths are in the same
* directory, but named only has rndc.key defined internally.
* We construct the rndc.conf path from it. (We could use
* NAMED_SYSCONFDIR here but the result would look wrong on
* Windows.)
*/
strlcpy(rndcconf, named_g_keyfile, sizeof(rndcconf));
dot = strrchr(rndcconf, '.');
if (dot != NULL) {
size_t len = dot - rndcconf + 1;
snprintf(dot + 1, PATH_MAX - len, "conf");
}
/*
* Print default configuration paths.
*/
printf("default paths:\n");
printf(" named configuration: %s\n", named_g_conffile);
printf(" rndc configuration: %s/rndc.conf\n", NAMED_SYSCONFDIR);
printf(" rndc configuration: %s\n", rndcconf);
printf(" DNSSEC root key: %s\n", named_g_defaultbindkeys);
printf(" nsupdate session key: %s\n", named_g_defaultsessionkeyfile);
printf(" named PID file: %s\n", named_g_defaultpidfile);