[git] GPGME - branch, master, updated. gpgme-1.10.0-167-g3345a17

by Werner Koch cvs at cvs.gnupg.org
Wed Mar 28 21:28:07 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  3345a17dda2222e3c1592235e8a1cd9493192777 (commit)
      from  4b2fa657d195382d14ac99be40b66327e0fc855c (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 3345a17dda2222e3c1592235e8a1cd9493192777
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Mar 28 21:21:10 2018 +0200

    json: Remove the "message" object thingy again.
    
    * src/gpgme-json.c (process_request): Remove 'nm_mode'.
    --
    
    This was an error in the javascript testing code.  Thus the Mozilla
    specs are correct that the request is send verbatim.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/gpgme-json.c b/src/gpgme-json.c
index e5c84bb..5f16daf 100644
--- a/src/gpgme-json.c
+++ b/src/gpgme-json.c
@@ -755,10 +755,9 @@ op_help (cjson_t request, cjson_t result)
 
 
 /* Process a request and return the response.  The response is a newly
- * allocated staring or NULL in case of an error.  With NM_MODE set
- * the actual request is taken from a "message" object.  */
+ * allocated string or NULL in case of an error.  */
 static char *
-process_request (const char *request, int nm_mode)
+process_request (const char *request)
 {
   static struct {
     const char *op;
@@ -772,7 +771,6 @@ process_request (const char *request, int nm_mode)
     { NULL }
   };
   size_t erroff;
-  cjson_t json_orig;
   cjson_t json;
   cjson_t j_tmp, j_op;
   cjson_t response;
@@ -783,7 +781,7 @@ process_request (const char *request, int nm_mode)
 
   response = xjson_CreateObject ();
 
-  json = json_orig = cJSON_Parse (request, &erroff);
+  json = cJSON_Parse (request, &erroff);
   if (!json)
     {
       log_string (GPGRT_LOGLVL_INFO, request);
@@ -791,16 +789,6 @@ process_request (const char *request, int nm_mode)
       error_object (response, "invalid JSON object at offset %zu\n", erroff);
       goto leave;
     }
-  if (nm_mode)
-    {
-      json = cJSON_GetObjectItem (json, "message");
-      if (!json)
-        {
-          log_info ("no \"message\" object in request\n");
-          error_object (response, "no \"message\" object in request\n");
-          goto leave;
-        }
-    }
 
   j_tmp = cJSON_GetObjectItem (json, "help");
   helpmode = (j_tmp && cjson_is_true (j_tmp));
@@ -857,7 +845,7 @@ process_request (const char *request, int nm_mode)
     }
 
  leave:
-  cJSON_Delete (json_orig);
+  cJSON_Delete (json);
   if (opt_interactive)
     res = cJSON_Print (response);
   else
@@ -942,7 +930,7 @@ process_meta_commands (const char *request)
                               "\"\\nMeta commands:\\n"
                               "  ,help       This help\\n"
                               "  ,quit       Terminate process\""
-                              "}", 0);
+                              "}");
   else if (!strncmp (request, "quit", 4) && (spacep (request+4) || !request[4]))
     exit (0);
   else
@@ -1041,7 +1029,7 @@ interactive_repl (void)
             }
           else if (request)
             {
-              response = process_request (request, 0);
+              response = process_request (request);
             }
           xfree (request);
           request = NULL;
@@ -1105,7 +1093,7 @@ read_and_process_single_request (void)
           if (request)
             {
               xfree (response);
-              response = process_request (request, 0);
+              response = process_request (request);
               if (response)
                 {
                   es_fputs (response, es_stdout);
@@ -1138,7 +1126,7 @@ native_messaging_repl (void)
    * binary mode.  */
   es_set_binary (es_stdin);
   es_set_binary (es_stdout);
-  es_setbuf (es_stdin, NULL);
+  es_setbuf (es_stdin, NULL);  /* stdin needs to be unbuffered! */
 
   for (;;)
     {
@@ -1197,7 +1185,7 @@ native_messaging_repl (void)
           if (opt_debug)
             log_debug ("request='%s'\n", request);
           xfree (response);
-          response = process_request (request, 1);
+          response = process_request (request);
           if (opt_debug)
             log_debug ("response='%s'\n", response);
         }

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

Summary of changes:
 src/gpgme-json.c | 30 +++++++++---------------------
 1 file changed, 9 insertions(+), 21 deletions(-)


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




More information about the Gnupg-commits mailing list