[git] GPGME - branch, master, updated. gpgme-1.11.1-7-ge54b110

by Werner Koch cvs at cvs.gnupg.org
Wed May 9 16:48:47 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  e54b110aec3165a32ff9551d0c5227b88aa3dd4f (commit)
       via  e2a8a87bf9cfae5d4e8a5953c2a5303b44feb398 (commit)
      from  46da79e3de99a7b65748994921d6aab73b9974e7 (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 e54b110aec3165a32ff9551d0c5227b88aa3dd4f
Author: Werner Koch <wk at gnupg.org>
Date:   Wed May 9 16:41:05 2018 +0200

    json: Improve auto-base64 encoding to not split UTF-8 chars.
    
    * src/gpgme-json.c (make_data_object): Switch to Base64 also for UTF-8
    characters.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/gpgme-json.c b/src/gpgme-json.c
index f1e9f25..fb5f149 100644
--- a/src/gpgme-json.c
+++ b/src/gpgme-json.c
@@ -610,7 +610,8 @@ make_data_object (cjson_t result, gpgme_data_t data, size_t chunksize,
 {
   gpg_error_t err;
   char *buffer;
-  size_t buflen;
+  const char *s;
+  size_t buflen, n;
   int c;
 
   if (!base64 || base64 == -1) /* Make sure that we really have a string.  */
@@ -629,13 +630,18 @@ make_data_object (cjson_t result, gpgme_data_t data, size_t chunksize,
       base64 = 0;
       if (!buflen)
         log_fatal ("Appended Nul byte got lost\n");
-      if (memchr (buffer, 0, buflen-1))
-        {
-          buflen--; /* Adjust for the extra nul byte.  */
-          base64 = 1;
-        }
-      /* Fixme: We might want to do more advanced heuristics than to
-       * only look for a Nul.  */
+      /* Figure out if there is any Nul octet in the buffer.  In that
+       * case we need to Base-64 the buffer.  Due to problems with the
+       * browser's Javascript we use Base-64 also in case an UTF-8
+       * character is in the buffer.  This is because the chunking may
+       * split an UTF-8 characters and JS can't handle this.  */
+      for (s=buffer, n=0; n < buflen -1; s++, n++)
+        if (!*s || (*s & 0x80))
+          {
+            buflen--; /* Adjust for the extra nul byte.  */
+            base64 = 1;
+            break;
+          }
     }
 
   /* Adjust the chunksize if we need to do base64 conversion.  */

commit e2a8a87bf9cfae5d4e8a5953c2a5303b44feb398
Author: Werner Koch <wk at gnupg.org>
Date:   Wed May 9 16:39:30 2018 +0200

    core: Make the status-fd monitor work for all gpgsm commands.
    
    * src/engine-gpgsm.c (status_handler): Call the status monitor also
    here.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c
index da7e524..7b22183 100644
--- a/src/engine-gpgsm.c
+++ b/src/engine-gpgsm.c
@@ -1013,8 +1013,17 @@ status_handler (void *opaque, int fd)
 	    *(rest++) = 0;
 
 	  r = _gpgme_parse_status (line + 2);
+          if (gpgsm->status.mon_cb && r != GPGME_STATUS_PROGRESS)
+            {
+              /* Note that we call the monitor even if we do
+               * not know the status code (r < 0).  */
+              err = gpgsm->status.mon_cb (gpgsm->status.mon_cb_value,
+                                          line + 2, rest);
+            }
+          else
+            err = 0;
 
-	  if (r >= 0)
+	  if (r >= 0 && !err)
 	    {
 	      if (gpgsm->status.fnc)
                 {

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

Summary of changes:
 src/engine-gpgsm.c | 11 ++++++++++-
 src/gpgme-json.c   | 22 ++++++++++++++--------
 2 files changed, 24 insertions(+), 9 deletions(-)


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




More information about the Gnupg-commits mailing list