diff options
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; |