mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Try to start the agent before invoking the protect-tool.
This commit is contained in:
parent
12366d1e81
commit
0ca1cfe3b3
3 changed files with 23 additions and 4 deletions
11
sm/export.c
11
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue