diff options
author | Werner Koch <wk@gnupg.org> | 2008-10-23 11:41:41 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2008-10-23 11:41:41 +0200 |
commit | 0ca1cfe3b32c58d66b985946021cd5234c365ef5 (patch) | |
tree | 79ba78a67a739b9e6f9b8808231d091bef764440 /sm/export.c | |
parent | Help dirmngr to use supplied trust anchors. (diff) | |
download | gnupg2-0ca1cfe3b32c58d66b985946021cd5234c365ef5.tar.xz gnupg2-0ca1cfe3b32c58d66b985946021cd5234c365ef5.zip |
Try to start the agent before invoking the protect-tool.
Diffstat (limited to 'sm/export.c')
-rw-r--r-- | sm/export.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sm/export.c b/sm/export.c index c1b9eaaf0..fa2e9de1a 100644 --- a/sm/export.c +++ b/sm/export.c @@ -571,7 +571,7 @@ print_short_info (ksba_cert_t cert, FILE *fp, estream_t stream) static gpg_error_t -popen_protect_tool (const char *pgmname, +popen_protect_tool (ctrl_t ctrl, const char *pgmname, FILE *infile, FILE *outfile, FILE **statusfile, const char *prompt, const char *keygrip, pid_t *pid) @@ -579,6 +579,12 @@ popen_protect_tool (const char *pgmname, const char *argv[20]; int i=0; + /* Make sure that the agent is running so that the protect tool is + able to ask for a passphrase. This has only an effect under W32 + where the agent is started on demand; sending a NOP does not harm + on other platforms. */ + gpgsm_agent_send_nop (ctrl); + argv[i++] = "--homedir"; argv[i++] = opt.homedir; argv[i++] = "--p12-export"; @@ -645,7 +651,8 @@ export_p12 (ctrl_t ctrl, const unsigned char *certimg, size_t certimglen, goto cleanup; } - err = popen_protect_tool (pgmname, infp, outfp, &fp, prompt, keygrip, &pid); + err = popen_protect_tool (ctrl, + pgmname, infp, outfp, &fp, prompt, keygrip, &pid); if (err) { pid = -1; |