core: Fix passphrase cb for mixed sym encrypt
authorAndre Heinecke <aheinecke@intevation.de>
Tue, 6 Sep 2016 14:28:45 +0000 (16:28 +0200)
committerAndre Heinecke <aheinecke@intevation.de>
Tue, 6 Sep 2016 14:28:45 +0000 (16:28 +0200)
* src/encrypt.c (encrypt_start): Handle SYMMETRIC flag.
* src/encrypt-sign.c (encrypt_sign_start): Ditto.

--
This causes the passphrace command handler to be properly
registered which in turn will result in the passphrase
callback beeing called.

src/encrypt-sign.c
src/encrypt.c

index 4f484e9..af6de63 100644 (file)
@@ -72,7 +72,7 @@ encrypt_sign_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t recp[],
   if (err)
     return err;
 
-  symmetric = !recp;
+  symmetric = !recp || (flags & GPGME_ENCRYPT_SYMMETRIC);
 
   if (!plain)
     return gpg_error (GPG_ERR_NO_DATA);
index 307c862..4023654 100644 (file)
@@ -228,8 +228,7 @@ encrypt_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t recp[],
   if (err)
     return err;
 
-  if (!recp)
-    symmetric = 1;
+  symmetric = !recp || (flags & GPGME_ENCRYPT_SYMMETRIC);
 
   if (!plain)
     return gpg_error (GPG_ERR_NO_DATA);