Fix bug#1003.

This commit is contained in:
Werner Koch 2009-03-02 10:26:37 +00:00
parent ec4a3eb3c5
commit 596a2237c7
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2009-03-02 Werner Koch <wk@g10code.com>
* protect-tool.c (import_p12_file): Take care of canceled
passphrase entry. Fixes bug#1003.
(export_p12_file): Ditto.
2008-12-17 Werner Koch <wk@g10code.com>
* gpg-agent.c (handle_connections): Set action of all pth event

View File

@ -754,7 +754,11 @@ import_p12_file (const char *fname)
gcry_sexp_release (s_key);
rc = agent_protect (key, (pw=get_new_passphrase (4)), &result, &resultlen);
pw = get_new_passphrase (4);
if (!pw)
rc = gpg_error (GPG_ERR_CANCELED);
else
rc = agent_protect (key, pw, &result, &resultlen);
release_passphrase (pw);
xfree (key);
if (rc)
@ -981,8 +985,11 @@ export_p12_file (const char *fname)
kparms[7] = sk.u;
kparms[8] = NULL;
key = p12_build (kparms, cert, certlen,
(pw=get_new_passphrase (3)), opt_p12_charset, &keylen);
pw = get_new_passphrase (3);
if (!pw)
key = NULL;
else
key = p12_build (kparms, cert, certlen, pw, opt_p12_charset, &keylen);
release_passphrase (pw);
xfree (cert);
for (i=0; i < 8; i++)