diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h index c86f7e1eab..b8e356b055 100644 --- a/bin/named/include/named/globals.h +++ b/bin/named/include/named/globals.h @@ -90,7 +90,7 @@ EXTERN cfg_obj_t * named_g_config INIT(NULL); EXTERN const cfg_obj_t * named_g_defaults INIT(NULL); EXTERN const char * named_g_conffile INIT(NAMED_SYSCONFDIR "/named.conf"); -EXTERN cfg_obj_t * named_g_defaultbindkeys INIT(NAMED_SYSCONFDIR +EXTERN const char * named_g_defaultbindkeys INIT(NAMED_SYSCONFDIR "/bind.keys"); EXTERN const char * named_g_keyfile INIT(NAMED_SYSCONFDIR "/rndc.key"); diff --git a/bin/named/main.c b/bin/named/main.c index 7c1d1fa6f1..0c8b82e6a5 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -445,6 +445,81 @@ set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) { *ret = 0; } +static void +printversion(bool verbose) { + printf("%s %s%s%s \n", + named_g_product, named_g_version, + (*named_g_description != '\0') ? " " : "", + named_g_description, named_g_srcid); + + if (!verbose) { + return; + } + + printf("running on %s\n", named_os_uname()); + printf("built by %s with %s\n", + named_g_builder, named_g_configargs); +#ifdef __clang__ + printf("compiled by CLANG %s\n", __VERSION__); +#else +#if defined(__ICC) || defined(__INTEL_COMPILER) + printf("compiled by ICC %s\n", __VERSION__); +#else +#ifdef __GNUC__ + printf("compiled by GCC %s\n", __VERSION__); +#endif +#endif +#endif +#ifdef _MSC_VER + printf("compiled by MSVC %d\n", _MSC_VER); +#endif +#ifdef __SUNPRO_C + printf("compiled by Solaris Studio %x\n", __SUNPRO_C); +#endif + printf("compiled with OpenSSL version: %s\n", + OPENSSL_VERSION_TEXT); +#if !defined(LIBRESSL_VERSION_NUMBER) && \ +OPENSSL_VERSION_NUMBER >= 0x10100000L /* 1.1.0 or higher */ + printf("linked to OpenSSL version: %s\n", + OpenSSL_version(OPENSSL_VERSION)); + +#else + printf("linked to OpenSSL version: %s\n", + SSLeay_version(SSLEAY_VERSION)); +#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000L */ +#ifdef HAVE_LIBXML2 + printf("compiled with libxml2 version: %s\n", + LIBXML_DOTTED_VERSION); + printf("linked to libxml2 version: %s\n", + xmlParserVersion); +#endif +#if defined(HAVE_JSON) && defined(JSON_C_VERSION) + printf("compiled with libjson-c version: %s\n", + JSON_C_VERSION); + printf("linked to libjson-c version: %s\n", + json_c_version()); +#endif +#if defined(HAVE_ZLIB) && defined(ZLIB_VERSION) + printf("compiled with zlib version: %s\n", + ZLIB_VERSION); + printf("linked to zlib version: %s\n", + zlibVersion()); +#endif + printf("threads support is enabled\n\n"); + + /* + * 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(" 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); + printf(" named lock file: %s\n", named_g_defaultlockfile); + +} + static void parse_fuzz_arg(void) { if (!strncmp(isc_commandline_argument, "client:", 7)) { @@ -670,66 +745,10 @@ parse_command_line(int argc, char *argv[]) { named_g_username = isc_commandline_argument; break; case 'v': - printf("%s %s%s%s \n", - named_g_product, named_g_version, - (*named_g_description != '\0') ? " " : "", - named_g_description, named_g_srcid); + printversion(false); exit(0); case 'V': - printf("%s %s%s%s \n", - named_g_product, named_g_version, - (*named_g_description != '\0') ? " " : "", - named_g_description, named_g_srcid); - printf("running on %s\n", named_os_uname()); - printf("built by %s with %s\n", - named_g_builder, named_g_configargs); -#ifdef __clang__ - printf("compiled by CLANG %s\n", __VERSION__); -#else -#if defined(__ICC) || defined(__INTEL_COMPILER) - printf("compiled by ICC %s\n", __VERSION__); -#else -#ifdef __GNUC__ - printf("compiled by GCC %s\n", __VERSION__); -#endif -#endif -#endif -#ifdef _MSC_VER - printf("compiled by MSVC %d\n", _MSC_VER); -#endif -#ifdef __SUNPRO_C - printf("compiled by Solaris Studio %x\n", __SUNPRO_C); -#endif - printf("compiled with OpenSSL version: %s\n", - OPENSSL_VERSION_TEXT); -#if !defined(LIBRESSL_VERSION_NUMBER) && \ - OPENSSL_VERSION_NUMBER >= 0x10100000L /* 1.1.0 or higher */ - printf("linked to OpenSSL version: %s\n", - OpenSSL_version(OPENSSL_VERSION)); - -#else - printf("linked to OpenSSL version: %s\n", - SSLeay_version(SSLEAY_VERSION)); -#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000L */ -#ifdef HAVE_LIBXML2 - printf("compiled with libxml2 version: %s\n", - LIBXML_DOTTED_VERSION); - printf("linked to libxml2 version: %s\n", - xmlParserVersion); -#endif -#if defined(HAVE_JSON) && defined(JSON_C_VERSION) - printf("compiled with libjson-c version: %s\n", - JSON_C_VERSION); - printf("linked to libjson-c version: %s\n", - json_c_version()); -#endif -#if defined(HAVE_ZLIB) && defined(ZLIB_VERSION) - printf("compiled with zlib version: %s\n", - ZLIB_VERSION); - printf("linked to zlib version: %s\n", - zlibVersion()); -#endif - printf("threads support is enabled\n"); + printversion(true); exit(0); case 'x': /* Obsolete. No longer in use. Ignore. */