aboutsummaryrefslogtreecommitdiffstats
path: root/g10/mainproc.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2005-09-20 08:19:50 +0000
committerWerner Koch <[email protected]>2005-09-20 08:19:50 +0000
commitd0b9ff171da1abe085b4b8d17bd1ad140448b2ca (patch)
tree3a9beb521e378ae208929f540db5f9c577a710af /g10/mainproc.c
parent* keylist.c (reorder_keyblock, do_reorder_keyblock): Reorder attribute (diff)
downloadgnupg-d0b9ff171da1abe085b4b8d17bd1ad140448b2ca.tar.gz
gnupg-d0b9ff171da1abe085b4b8d17bd1ad140448b2ca.zip
* mainproc.c (proc_symkey_enc): Take care of a canceled passphrase
prompt.
Diffstat (limited to '')
-rw-r--r--g10/mainproc.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 438543df1..7c1392160 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -327,7 +327,22 @@ proc_symkey_enc( CTX c, PACKET *pkt )
}
else
{
- c->dek=passphrase_to_dek(NULL, 0, algo, &enc->s2k, 0, NULL, NULL);
+ int canceled;
+
+ c->dek = passphrase_to_dek (NULL, 0, algo, &enc->s2k, 0,
+ NULL, &canceled);
+ if (canceled)
+ {
+ /* For unknown reasons passphrase_to_dek does only
+ return NULL if a new passphrase has been requested
+ and has not been repeated correctly. Thus even
+ with a cancel requested (by means of the gpg-agent)
+ it won't return NULL but an empty passphrase. We
+ take the most conservative approach for now and
+ work around it right here. */
+ xfree (c->dek);
+ c->dek = NULL;
+ }
if(c->dek)
{