]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Make possible not printing written path
authorPetr Menšík <pemensik@redhat.com>
Fri, 22 May 2020 18:40:06 +0000 (20:40 +0200)
committerOndřej Surý <ondrej@isc.org>
Fri, 29 May 2020 13:22:13 +0000 (13:22 +0000)
Changes written path from stderr to stdout if enabled.
Adds -q parameter to hide written path.

bin/confgen/keygen.c
bin/confgen/rndc-confgen.c
bin/confgen/rndc-confgen.rst

index 35d850fae0022b4287eb7f64c7142f5261a6218d..d300e8bffbeb933dcd3051e2517afd1577514474 100644 (file)
@@ -198,5 +198,4 @@ write_key_file(const char *keyfile, const char *user, const char *keyname,
        if (fclose(fd)) {
                fatal("fclose(%s) failed\n", keyfile);
        }
-       fprintf(stderr, "wrote key file \"%s\"\n", keyfile);
 }
index 2d7959955086e4677d179f320d144009d1966f8f..c309bb970a8fcc864a17aed27f3c85edd468850d 100644 (file)
@@ -76,6 +76,7 @@ Usage:\n\
   -c keyfile:   specify an alternate key file (requires -a)\n\
   -k keyname:   the name as it will be used  in named.conf and rndc.conf\n\
   -p port:      the port named will listen on and rndc will connect to\n\
+  -q:           suppress printing written key path\n\
   -s addr:      the address to which rndc should connect\n\
   -t chrootdir:         write a keyfile in chrootdir as well (requires -a)\n\
   -u user:      set the keyfile owner to \"user\" (requires -a)\n",
@@ -104,6 +105,7 @@ main(int argc, char **argv) {
        char *chrootdir = NULL;
        char *user = NULL;
        bool keyonly = false;
+       bool quiet = false;
        int len;
 
        keydef = keyfile = RNDC_KEYFILE;
@@ -164,6 +166,9 @@ main(int argc, char **argv) {
                                      isc_commandline_argument);
                        }
                        break;
+               case 'q':
+                       quiet = true;
+                       break;
                case 'r':
                        fatal("The -r option has been deprecated.");
                        break;
@@ -227,6 +232,9 @@ main(int argc, char **argv) {
        if (keyonly) {
                write_key_file(keyfile, chrootdir == NULL ? user : NULL,
                               keyname, &key_txtbuffer, alg);
+               if (!quiet) {
+                       printf("wrote key file \"%s\"\n", keyfile);
+               }
 
                if (chrootdir != NULL) {
                        char *buf;
@@ -236,6 +244,9 @@ main(int argc, char **argv) {
                                 (*keyfile != '/') ? "/" : "", keyfile);
 
                        write_key_file(buf, user, keyname, &key_txtbuffer, alg);
+                       if (!quiet) {
+                               printf("wrote key file \"%s\"\n", buf);
+                       }
                        isc_mem_put(mctx, buf, len);
                }
        } else {
index 35900d05b021638ab5b746d90c0fa8a2d7e8c6f1..c1c53b551992e67cef9903a8894003fccfe47e36 100644 (file)
@@ -86,6 +86,9 @@ Arguments
    Specifies the command channel port where ``named`` listens for
    connections from ``rndc``. The default is 953.
 
+**-q**
+   Omits printing written path in automatic configuration mode.
+
 **-s** address
    Specifies the IP address where ``named`` listens for command channel
    connections from ``rndc``. The default is the loopback address