From 0ca1cfe3b32c58d66b985946021cd5234c365ef5 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 23 Oct 2008 09:41:41 +0000 Subject: Try to start the agent before invoking the protect-tool. --- sm/export.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'sm/export.c') 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; -- cgit v1.2.3