aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Kibbey <[email protected]>2015-04-14 22:48:57 +0000
committerBen Kibbey <[email protected]>2015-04-15 21:38:51 +0000
commit4b3433a0245e6923caa5fefb98f0e06d6bd8808a (patch)
tree2dc5c9b9210107074978dd4467bf487583043eac
parentagent: Send the new SETKEYINFO command to the Pinentry. (diff)
downloadgnupg-4b3433a0245e6923caa5fefb98f0e06d6bd8808a.tar.gz
gnupg-4b3433a0245e6923caa5fefb98f0e06d6bd8808a.zip
Allow --gen-key to inquire a passphrase.
* g10/gpg.c (main): test for --command-fd during --gen-key parse. When --command-fd is set then imply --batch to let gpg inquire a passphrase rather than requiring a pinentry.
-rw-r--r--g10/gpg.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/g10/gpg.c b/g10/gpg.c
index aec6e808e..a6e42c1c7 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -3904,9 +3904,18 @@ main (int argc, char **argv)
generate_keypair (ctrl, 0, argc? *argv : NULL, NULL, 0);
}
else {
- if( argc )
- wrong_args("--gen-key");
- generate_keypair (ctrl, 0, NULL, NULL, 0);
+ if (opt.command_fd != -1 && argc)
+ {
+ if( argc > 1 )
+ wrong_args("--gen-key [parameterfile]");
+
+ opt.batch = 1;
+ generate_keypair (ctrl, 0, argc? *argv : NULL, NULL, 0);
+ }
+ else if (argc)
+ wrong_args ("--gen-key");
+ else
+ generate_keypair (ctrl, 0, NULL, NULL, 0);
}
break;