gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: fix truth parsing logic


From: gnunet
Subject: [taler-anastasis] branch master updated: fix truth parsing logic
Date: Sun, 28 Feb 2021 21:17:51 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 3f4ecbd  fix truth parsing logic
3f4ecbd is described below

commit 3f4ecbd5483b8e70a2345e45849672adf8d761fc
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Feb 28 21:17:48 2021 +0100

    fix truth parsing logic
---
 src/reducer/anastasis_api_backup_redux.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/reducer/anastasis_api_backup_redux.c 
b/src/reducer/anastasis_api_backup_redux.c
index 92715ae..0721d8b 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -1413,7 +1413,6 @@ share_secret (struct UploadContext *uc)
     upload_cancel_cb (uc);
     return;
   }
-
   if ( (! json_is_object (user_id)) ||
        (! json_is_array (jpolicies)) ||
        (0 == json_array_size (jpolicies)) ||
@@ -1441,12 +1440,12 @@ share_secret (struct UploadContext *uc)
     {
       const json_t *policy = json_array_get (jpolicies,
                                              i);
-      const json_t *jtruths = json_object_get (policy,
-                                               "methods");
-      unsigned int truths_len;
+      const json_t *jmethods = json_object_get (policy,
+                                                "methods");
+      unsigned int methods_len;
 
-      if ( (! json_is_array (jtruths)) ||
-           (0 == json_array_size (jtruths)) )
+      if ( (! json_is_array (jmethods)) ||
+           (0 == json_array_size (jmethods)) )
       {
         GNUNET_break (0);
         ANASTASIS_redux_fail_ (uc->cb,
@@ -1457,16 +1456,18 @@ share_secret (struct UploadContext *uc)
         upload_cancel_cb (uc);
         return;
       }
-      truths_len = json_array_size (jtruths);
+      methods_len = json_array_size (jmethods);
       {
         struct ANASTASIS_Policy *p;
-        struct ANASTASIS_Truth *truths[truths_len];
-        const struct ANASTASIS_Truth *ctruths[truths_len];
+        struct ANASTASIS_Truth *truths[methods_len];
+        const struct ANASTASIS_Truth *ctruths[methods_len];
 
-        for (unsigned int j = 0; j<truths_len; j++)
+        for (unsigned int j = 0; j<methods_len; j++)
         {
-          json_t *jtruth = json_array_get (jtruths,
-                                           j);
+          const json_t *jmethod = json_array_get (jmethods,
+                                                  j);
+          const json_t *jtruth = json_object_get (jmethod,
+                                                  "truth");
 
           truths[j] = ANASTASIS_truth_from_json (jtruth);
           if (NULL == truths[j])
@@ -1485,10 +1486,10 @@ share_secret (struct UploadContext *uc)
           ctruths[j] = truths[j];
         }
         p = ANASTASIS_policy_create (ctruths,
-                                     truths_len);
+                                     methods_len);
         vpolicies[i] = p;
         policies[i] = p;
-        for (unsigned int k = 0; k<truths_len; k++)
+        for (unsigned int k = 0; k<methods_len; k++)
           ANASTASIS_truth_free (truths[k]);
       }
     }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]