gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 05/30: bugfixes


From: gnunet
Subject: [gnunet] 05/30: bugfixes
Date: Thu, 13 Feb 2020 22:31:05 +0100

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 68ddf5330364fb7727209d3249e7d676c54bec83
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Tue Feb 4 22:50:32 2020 +0100

    bugfixes
---
 src/include/Makefile.am              |  2 +-
 src/include/gnunet_protocols.h       |  6 +--
 src/reclaim/gnunet-reclaim.c         | 59 +++++++++++++++--------------
 src/reclaim/gnunet-service-reclaim.c | 73 ++++++++++++++++--------------------
 src/reclaim/reclaim_api.c            |  2 +-
 5 files changed, 67 insertions(+), 75 deletions(-)

diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index b53f2420d..69a493f1e 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -57,7 +57,7 @@ gnunetinclude_HEADERS = \
   gnunet_identity_service.h \
   gnunet_abe_lib.h \
   gnunet_reclaim_attribute_lib.h \
-  gnunet_reclaim_attribute_plugin.h \
+  gnunet_reclaim_plugin.h \
   gnunet_reclaim_service.h \
   gnunet_json_lib.h \
   gnunet_load_lib.h \
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index d92015787..e67e35f38 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2720,11 +2720,11 @@ extern "C" {
 
 #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979
 
-#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START 963
+#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START 980
 
-#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP 964
+#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP 981
 
-#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT 965
+#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT 982
 
 
 /**************************************************
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
index 35c1258f5..3e31fef4c 100644
--- a/src/reclaim/gnunet-reclaim.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -208,6 +208,8 @@ do_cleanup (void *cls)
     GNUNET_RECLAIM_cancel (reclaim_op);
   if (NULL != attr_iterator)
     GNUNET_RECLAIM_get_attributes_stop (attr_iterator);
+  if (NULL != attest_iterator)
+    GNUNET_RECLAIM_get_attestations_stop (attest_iterator);
   if (NULL != ticket_iterator)
     GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator);
   if (NULL != reclaim_handle)
@@ -467,7 +469,6 @@ iter_finished (void *cls)
     {
       claim->attestation = attestation;
     }
-    else
     reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle,
                                                  pkey,
                                                  claim,
@@ -569,13 +570,14 @@ static void
 attest_iter_finished (void *cls)
 {
   attest_iterator = NULL;
-  //Add new attestation
+
+  // Add new attestation
   if ((NULL != attestation_name) &&
       (NULL != attr_value))
   {
     struct GNUNET_RECLAIM_Attestation *attestation =
       GNUNET_RECLAIM_attestation_new (attestation_name,
-                                      GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, 
//FIXME hardcoded
+                                      GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, // 
FIXME hardcoded
                                       attr_value,
                                       strlen (attr_value));
     reclaim_op = GNUNET_RECLAIM_attestation_store (reclaim_handle,
@@ -587,19 +589,20 @@ attest_iter_finished (void *cls)
     return;
 
   }
-  if (! list_attestations)
+  if (list_attestations)
   {
-    attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
-                                                         pkey,
-                                                         &iter_error,
-                                                         NULL,
-                                                         &iter_cb,
-                                                         NULL,
-                                                         &iter_finished,
-                                                         NULL);
-
+    cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
+    return;
   }
-  cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
+  attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
+                                                       pkey,
+                                                       &iter_error,
+                                                       NULL,
+                                                       &iter_cb,
+                                                       NULL,
+                                                       &iter_finished,
+                                                       NULL);
+
 }
 
 
@@ -620,7 +623,7 @@ attest_iter_cb (void *cls,
     attest_str = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
                                                              attest->data,
                                                              
attest->data_size);
-    attest_type = GNUNET_RECLAIM_attribute_number_to_typename (attest->type);
+    attest_type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type);
     id = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id));
     fprintf (stdout,
              "Name: %s; Value: %s (%s); Flag %u; ID: %s\n",
@@ -662,19 +665,6 @@ start_process ()
                                                              NULL);
     return;
   }
-  if (list_attestations)
-  {
-    attest_iterator = GNUNET_RECLAIM_get_attestations_start (reclaim_handle,
-                                                             pkey,
-                                                             &iter_error,
-                                                             NULL,
-                                                             &attest_iter_cb,
-                                                             NULL,
-                                                             &
-                                                             
attest_iter_finished,
-                                                             NULL);
-    return;
-  }
 
   if ((NULL != rp) &&
       (GNUNET_OK !=
@@ -697,6 +687,16 @@ start_process ()
 
   attr_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
   claim = NULL;
+  attest_iterator = GNUNET_RECLAIM_get_attestations_start (reclaim_handle,
+                                                           pkey,
+                                                           &iter_error,
+                                                           NULL,
+                                                           &attest_iter_cb,
+                                                           NULL,
+                                                           &
+                                                           
attest_iter_finished,
+                                                           NULL);
+
 }
 
 
@@ -799,7 +799,8 @@ main (int argc, char *const argv[])
     GNUNET_GETOPT_option_string ('I',
                                  "Attestation ID",
                                  "ATTESTATION_ID",
-                                 gettext_noop ("Attestation to use for 
attribute"),
+                                 gettext_noop (
+                                   "Attestation to use for attribute"),
                                  &attestation_id),
     GNUNET_GETOPT_option_string ('N',
                                  "attestation-name",
diff --git a/src/reclaim/gnunet-service-reclaim.c 
b/src/reclaim/gnunet-service-reclaim.c
index f6fd04eeb..61d029665 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -1718,31 +1718,26 @@ attr_iter_cb (void *cls,
   struct GNUNET_MQ_Envelope *env;
   char *data_tmp;
 
-  if (rd_count == 0)
+  if ((rd_count != 1) ||
+      (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd->record_type))
   {
     GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
     return;
   }
-
-  for (int i = 0; i<rd_count; i++)
-  {
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd[i].record_type)
-      continue;
-    struct AttributeResultMessage *arm;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
-                label);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Sending ATTRIBUTE_RESULT message\n");
-    env = GNUNET_MQ_msg_extra (arm,
-                               rd[i].data_size,
-                               GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
-    arm->id = htonl (ai->request_id);
-    arm->attr_len = htons (rd[i].data_size);
-    GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
-    data_tmp = (char *) &arm[1];
-    GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
-    GNUNET_MQ_send (ai->client->mq, env);
-  }
+  struct AttributeResultMessage *arm;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
+              label);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Sending ATTRIBUTE_RESULT message\n");
+  env = GNUNET_MQ_msg_extra (arm,
+                             rd->data_size,
+                             GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
+  arm->id = htonl (ai->request_id);
+  arm->attr_len = htons (rd->data_size);
+  GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
+  data_tmp = (char *) &arm[1];
+  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
+  GNUNET_MQ_send (ai->client->mq, env);
 }
 
 
@@ -1907,31 +1902,27 @@ attest_iter_cb (void *cls,
   struct GNUNET_MQ_Envelope *env;
   char *data_tmp;
 
-  if (rd_count == 0)
+  if ((rd_count != 1) ||
+      (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION != rd->record_type))
   {
     GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
     return;
   }
 
-  for (int i = 0; i<rd_count; i++)
-  {
-    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION != rd[i].record_type)
-      continue;
-    struct AttestationResultMessage *arm;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
-                label);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Sending ATTESTATION_RESULT message\n");
-    env = GNUNET_MQ_msg_extra (arm,
-                               rd[i].data_size,
-                               GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
-    arm->id = htonl (ai->request_id);
-    arm->attestation_len = htons (rd[i].data_size);
-    GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
-    data_tmp = (char *) &arm[1];
-    GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
-    GNUNET_MQ_send (ai->client->mq, env);
-  }
+  struct AttestationResultMessage *arm;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
+              label);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Sending ATTESTATION_RESULT message\n");
+  env = GNUNET_MQ_msg_extra (arm,
+                             rd->data_size,
+                             GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
+  arm->id = htonl (ai->request_id);
+  arm->attestation_len = htons (rd->data_size);
+  GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
+  data_tmp = (char *) &arm[1];
+  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
+  GNUNET_MQ_send (ai->client->mq, env);
 }
 
 
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index 89b9ea0f7..3820550c9 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -1423,7 +1423,7 @@ GNUNET_RECLAIM_get_attestations_start (
   ait->identity = *identity;
   GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait);
   env =
-    GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START);
+    GNUNET_MQ_msg (msg, 
GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START);
   msg->id = htonl (rid);
   msg->identity = *identity;
   if (NULL == h->mq)

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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