summaryrefslogtreecommitdiffstats
path: root/sm/export.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2008-10-23 11:41:41 +0200
committerWerner Koch <wk@gnupg.org>2008-10-23 11:41:41 +0200
commit0ca1cfe3b32c58d66b985946021cd5234c365ef5 (patch)
tree79ba78a67a739b9e6f9b8808231d091bef764440 /sm/export.c
parentHelp dirmngr to use supplied trust anchors. (diff)
downloadgnupg2-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.c11
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;