[git] GPGME - branch, master, updated. gpgme-1.11.1-254-g1420c3b

by Andre Heinecke cvs at cvs.gnupg.org
Wed Aug 29 14:33:51 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  1420c3bd681648b032d756536311621a3627bedb (commit)
      from  f7e5ae7f1618bd355b885c5c32dd028afad35453 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1420c3bd681648b032d756536311621a3627bedb
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Aug 29 14:32:36 2018 +0200

    json: Fix detached verify
    
    * src/gpgme-json.c (op_verify): Only create output and
    use it for clearsigned and opaque signed.
    
    --
    Just passing output to gpgme_op_verify changes the behavior to
    no longer do a verify of the signature.

diff --git a/src/gpgme-json.c b/src/gpgme-json.c
index 5c670eb..2a8f1d3 100644
--- a/src/gpgme-json.c
+++ b/src/gpgme-json.c
@@ -2173,24 +2173,24 @@ op_verify (cjson_t request, cjson_t result)
   if (err && err != gpg_error (GPG_ERR_NO_DATA))
     goto leave;
 
-  /* Create an output data object.  */
-  err = gpgme_data_new (&output);
-  if (err)
-    {
-      gpg_error_object (result, err, "Error creating output data object: %s",
-                        gpg_strerror (err));
-      goto leave;
-    }
-
-  /* Verify.  */
-  if (signature)
+  if (!signature)
     {
-      err = gpgme_op_verify (ctx, signature, input, output);
+      /* Verify opaque or clearsigned we need an output data object.  */
+      err = gpgme_data_new (&output);
+      if (err)
+        {
+          gpg_error_object (result, err,
+                            "Error creating output data object: %s",
+                            gpg_strerror (err));
+          goto leave;
+        }
+      err = gpgme_op_verify (ctx, input, 0, output);
     }
   else
     {
-      err = gpgme_op_verify (ctx, input, 0, output);
+      err = gpgme_op_verify (ctx, signature, input, NULL);
     }
+
   if (err)
     {
       gpg_error_object (result, err, "Verify failed: %s", gpg_strerror (err));
@@ -2208,14 +2208,17 @@ op_verify (cjson_t request, cjson_t result)
                              verify_result_to_json (verify_result));
     }
 
-  err = make_data_object (result, output, "plaintext", -1);
-  output = NULL;
-
-  if (err)
+  if (output)
     {
-      gpg_error_object (result, err, "Plaintext output failed: %s",
-                        gpg_strerror (err));
-      goto leave;
+      err = make_data_object (result, output, "plaintext", -1);
+      output = NULL;
+
+      if (err)
+        {
+          gpg_error_object (result, err, "Plaintext output failed: %s",
+                            gpg_strerror (err));
+          goto leave;
+        }
     }
 
  leave:

-----------------------------------------------------------------------

Summary of changes:
 src/gpgme-json.c | 43 +++++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list