]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Added --ask-pass certtool option to allow asking for passwords even when in batch...
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 5 Feb 2014 09:24:15 +0000 (10:24 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 5 Feb 2014 09:24:15 +0000 (10:24 +0100)
src/certtool-args.def
src/certtool-cfg.c
src/certtool.c
src/danetool.c
src/p11tool.c
src/tpmtool.c

index d1ad4aac631c072683127251bcadfe6764d4f71c..b9b29b87e1e8d14141d0fc98b2b3fa792cac344e 100644 (file)
@@ -364,6 +364,13 @@ flag = {
     doc   = "";
 };
 
+flag = {
+    name      = ask-pass;
+    disabled;
+    descrip   = "Enable interaction for entering password when in batch mode.";
+    doc   = "This option will enable interaction to enter password when in batch mode. That is useful when the template option has been specified.";
+};
+
 flag = {
     name      = pkcs-cipher;
     arg-type  = string;
index 81be6db89e1219fea1aca570f160f4d9d57fc032..54cd5211f729019738cf8a4ccc81632a5f76c004 100644 (file)
@@ -50,6 +50,7 @@
 #include "certtool-common.h"
 
 extern int batch;
+extern int ask_pass;
 
 #define MAX_ENTRIES 128
 #define MAX_POLICIES 8
@@ -462,7 +463,7 @@ int read_yesno(const char *input_str, int def)
  */
 const char *get_pass(void)
 {
-       if (batch)
+       if (batch && !ask_pass)
                return cfg.password;
        else
                return getpass("Enter password: ");
@@ -470,7 +471,7 @@ const char *get_pass(void)
 
 const char *get_confirmed_pass(bool empty_ok)
 {
-       if (batch)
+       if (batch && !ask_pass)
                return cfg.password;
        else {
                const char *pass = NULL;
@@ -498,7 +499,7 @@ const char *get_confirmed_pass(bool empty_ok)
 
 const char *get_challenge_pass(void)
 {
-       if (batch)
+       if (batch && !ask_pass)
                return cfg.challenge_password;
        else
                return getpass("Enter a challenge password: ");
index 6d90ac5f1b251f6a0b8fdd200ba5aa9416903c9f..da9d14cae3011b128c9b813378ca558d20205914 100644 (file)
@@ -81,6 +81,7 @@ gnutls_certificate_print_formats_t full_format = GNUTLS_CRT_PRINT_FULL;
 /* non interactive operation if set
  */
 int batch;
+int ask_pass;
 
 
 static void tls_log_func(int level, const char *str)
@@ -1058,6 +1059,8 @@ static void cmd_parser(int argc, char **argv)
                template_parse(OPT_ARG(TEMPLATE));
        }
 
+       ask_pass = ENABLED_OPT(ASK_PASS);
+
        gnutls_global_set_log_function(tls_log_func);
 
        if (HAVE_OPT(DEBUG)) {
index 1f2c8e27e4c5db3c80affdb959de7edecdab1891..8b7b1ead6279b0321389c8b615b0cc0e089880e7 100644 (file)
@@ -63,7 +63,8 @@ static gnutls_digest_algorithm_t default_dig;
 
 /* non interactive operation if set
  */
-int batch;
+int batch = 0;
+int ask_pass = 0;
 
 
 static void tls_log_func(int level, const char *str)
index e92dfc2601cca4004e8561bd1da2ab88677189d5..cf9ccb7d5840e584aa82d9cb5ace567de34721bd 100644 (file)
@@ -51,6 +51,7 @@ static void cmd_parser(int argc, char **argv);
 
 static FILE *outfile;
 int batch = 0;
+int ask_pass = 0;
 
 static void tls_log_func(int level, const char *str)
 {
index 0ce6bfb4b4391097a80c5189ce847817aa8df654..4deede0d05dc98bae6eb5c7bbb4d48676880c959 100644 (file)
@@ -59,6 +59,7 @@ static gnutls_tpmkey_fmt_t inkey_format, outkey_format;
 static FILE *outfile;
 static FILE *infile;
 int batch = 0;
+int ask_pass = 0;
 
 static void tls_log_func(int level, const char *str)
 {