]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
print default file paths in 'named -V' output
authorEvan Hunt <each@isc.org>
Tue, 5 Feb 2019 22:27:03 +0000 (14:27 -0800)
committerMark Andrews <marka@isc.org>
Wed, 6 Feb 2019 02:18:00 +0000 (13:18 +1100)
bin/named/include/named/globals.h
bin/named/main.c

index c86f7e1eab3b7faef610861d46e27407f6fed6cf..b8e356b0559f1cc22955108f9549d555b3897442 100644 (file)
@@ -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");
index 7c1d1fa6f1d0d7b7c7924f0cf06b719972268a15..0c8b82e6a5c5cca1d774c0e1eeda8d949c9b65c4 100644 (file)
@@ -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 <id:%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 <id:%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 <id:%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. */