gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 123/171: -fix bugs


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 123/171: -fix bugs
Date: Thu, 04 Jan 2018 16:10:31 +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 407c000bf423dc07f1f12fba9b8a8bcd08886d6c
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Fri Oct 6 09:08:23 2017 +0200

    -fix bugs
---
 src/identity-provider/gnunet-idp.c                 |  4 +-
 .../gnunet-service-identity-provider.c             | 55 ++++++++++++++++------
 src/identity-provider/identity_attribute.c         |  2 +-
 src/identity-provider/identity_provider_api.c      |  4 +-
 src/identity-provider/test_idp_issue.sh            |  2 +-
 5 files changed, 46 insertions(+), 21 deletions(-)

diff --git a/src/identity-provider/gnunet-idp.c 
b/src/identity-provider/gnunet-idp.c
index a8739e6f6..fbe1d9613 100644
--- a/src/identity-provider/gnunet-idp.c
+++ b/src/identity-provider/gnunet-idp.c
@@ -151,7 +151,7 @@ store_attr_cont (void *cls,
                 "%s\n", emsg);
   } else {
     GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
-                "Sucessfully added identity attribute %s=%s\n",
+                "Successfully added identity attribute %s=%s\n",
                 attr_name, attr_value);
   }
   GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
@@ -251,7 +251,7 @@ iter_cb (void *cls,
       break;
     }
     GNUNET_free (attrs_tmp);
-  } else {
+  } else if (list) {
     GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
                 "%s: %s\n", attr->name, (char*)attr->data);
   }
diff --git a/src/identity-provider/gnunet-service-identity-provider.c 
b/src/identity-provider/gnunet-service-identity-provider.c
index 0b7f3389e..3b3af331e 100644
--- a/src/identity-provider/gnunet-service-identity-provider.c
+++ b/src/identity-provider/gnunet-service-identity-provider.c
@@ -1366,7 +1366,7 @@ static void
 process_parallel_lookup (void *cls, uint32_t rd_count,
                          const struct GNUNET_GNSRECORD_Data *rd)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Parallel lookup finished (count=%u)\n", rd_count);
   struct ParallelLookup *parallel_lookup = cls;
   struct ExchangeHandle *handle = parallel_lookup->handle;
@@ -1385,7 +1385,7 @@ process_parallel_lookup (void *cls, uint32_t rd_count,
                                    rd->data_size,
                                    handle->key,
                                    (void**)&data);
-      GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Adding value: %s\n", data);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding value: %s\n", data);
       token_add_attr (handle->token,
                       parallel_lookup->label,
                       data);
@@ -1400,7 +1400,7 @@ process_parallel_lookup (void *cls, uint32_t rd_count,
         data = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
                                                  rd[i].data,
                                                  rd[i].data_size);
-        GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Adding value: %s\n", data);
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding value: %s\n", data);
         token_add_attr (handle->token, parallel_lookup->label, data);
         GNUNET_free (data);
       }
@@ -1485,7 +1485,7 @@ process_lookup_result (void *cls, uint32_t rd_count,
               size, rd->data_size - sizeof (struct 
GNUNET_CRYPTO_EcdhePublicKey));
 
   scopes = GNUNET_strdup (buf);
-  GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Scopes %s\n", scopes);
   handle->key = GNUNET_CRYPTO_cpabe_deserialize_key ((void*)(buf + strlen 
(scopes) + 1),
                                          rd->data_size - sizeof (struct 
GNUNET_CRYPTO_EcdhePublicKey)
@@ -1496,7 +1496,7 @@ process_lookup_result (void *cls, uint32_t rd_count,
     GNUNET_asprintf (&lookup_query,
                      "%s.gnu",
                      scope);
-    GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Looking up %s\n", lookup_query);
     parallel_lookup = GNUNET_new (struct ParallelLookup);
     parallel_lookup->handle = handle;
@@ -1776,9 +1776,19 @@ send_ticket_result (struct IdpClient *client,
 
   attrs_size = attribute_list_serialize_get_size (attrs);
 
+  /* store ticket in DB */
+  if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls,
+                                               ticket,
+                                               attrs))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Unable to store ticket after issue\n");
+    GNUNET_break (0);
+  }
+
   env = GNUNET_MQ_msg_extra (irm,
                              sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket2) 
+ attrs_size,
-                       GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT);
+                             
GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT);
   ticket_buf = (struct GNUNET_IDENTITY_PROVIDER_Ticket2 *)&irm[1];
   *ticket_buf = *ticket;
   attrs_buf = (char*)&ticket_buf[1];
@@ -1792,8 +1802,8 @@ send_ticket_result (struct IdpClient *client,
 
 static void
 store_ticket_issue_cont (void *cls,
-                        int32_t success,
-                        const char *emsg)
+                         int32_t success,
+                         const char *emsg)
 {
   struct TicketIssueHandle *handle = cls;
 
@@ -1843,10 +1853,10 @@ serialize_abe_keyinfo2 (const struct TicketIssueHandle 
*handle,
   }
   buf = GNUNET_malloc (attrs_str_len + size);
   write_ptr = buf;
-  GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Writing attributes\n");
   for (le = handle->attrs->list_head; NULL != le; le = le->next) {
-    GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "%s\n", le->attribute->name);
 
 
@@ -1943,6 +1953,7 @@ issue_ticket_after_abe_bootstrap (void *cls,
                                               ih);
   GNUNET_free (ecdhe_privkey);
   GNUNET_free (label);
+  GNUNET_free (attrs);
   GNUNET_free (code_record_data);
 }
 
@@ -2041,7 +2052,7 @@ static void
 process_parallel_lookup2 (void *cls, uint32_t rd_count,
                           const struct GNUNET_GNSRECORD_Data *rd)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Parallel lookup finished (count=%u)\n", rd_count);
   struct ParallelLookup2 *parallel_lookup = cls;
   struct ConsumeTicketHandle *handle = parallel_lookup->handle;
@@ -2056,6 +2067,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
   GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head,
                                handle->parallel_lookups_tail,
                                parallel_lookup);
+  GNUNET_free (parallel_lookup->label);
   GNUNET_free (parallel_lookup);
   if (1 != rd_count)
     GNUNET_break(0);//TODO
@@ -2075,7 +2087,18 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
   }
   if (NULL != handle->parallel_lookups_head)
     return; //Wait for more
-  //Else we are done
+  /* Else we are done */
+
+  /* Store ticket in DB */
+  if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls,
+                                               &handle->ticket,
+                                               handle->attrs))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Unable to store ticket after consume\n");
+    GNUNET_break (0);
+  }
+  
   GNUNET_SCHEDULER_cancel (handle->kill_task);
   attrs_len = attribute_list_serialize_get_size (handle->attrs);
   env = GNUNET_MQ_msg_extra (crm,
@@ -2177,7 +2200,7 @@ process_consume_abe_key (void *cls, uint32_t rd_count,
               size, rd->data_size - sizeof (struct 
GNUNET_CRYPTO_EcdhePublicKey));
 
   scopes = GNUNET_strdup (buf);
-  GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Scopes %s\n", scopes);
   handle->key = GNUNET_CRYPTO_cpabe_deserialize_key ((void*)(buf + strlen 
(scopes) + 1),
                                                      rd->data_size - sizeof 
(struct GNUNET_CRYPTO_EcdhePublicKey)
@@ -2188,7 +2211,7 @@ process_consume_abe_key (void *cls, uint32_t rd_count,
     GNUNET_asprintf (&lookup_query,
                      "%s.gnu",
                      scope);
-    GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Looking up %s\n", lookup_query);
     parallel_lookup = GNUNET_new (struct ParallelLookup2);
     parallel_lookup->handle = handle;
@@ -2204,6 +2227,7 @@ process_consume_abe_key (void *cls, uint32_t rd_count,
     GNUNET_CONTAINER_DLL_insert (handle->parallel_lookups_head,
                                  handle->parallel_lookups_tail,
                                  parallel_lookup);
+    GNUNET_free (lookup_query);
   }
   handle->kill_task = GNUNET_SCHEDULER_add_delayed 
(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES,3),
                                                     &abort_parallel_lookups2,
@@ -2241,7 +2265,7 @@ handle_consume_ticket_message (void *cls,
   GNUNET_asprintf (&lookup_query,
                    "%s.gnu",
                    rnd_label);
-  GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Looking for ABE key under %s\n", lookup_query);
 
   ch->lookup_request
@@ -2252,6 +2276,7 @@ handle_consume_ticket_message (void *cls,
                          GNUNET_GNS_LO_LOCAL_MASTER,
                          &process_consume_abe_key,
                          ch);
+  GNUNET_free (rnd_label);
   GNUNET_free (lookup_query);
   GNUNET_SERVICE_client_continue (idp->client);
 }
diff --git a/src/identity-provider/identity_attribute.c 
b/src/identity-provider/identity_attribute.c
index 1c5654946..b90a08e3e 100644
--- a/src/identity-provider/identity_attribute.c
+++ b/src/identity-provider/identity_attribute.c
@@ -114,7 +114,7 @@ attribute_list_deserialize (const char* data,
     le = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry);
     le->attribute = attribute_deserialize (read_ptr,
                                            data_size - (read_ptr - data));
-    GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Deserialized attribute %s\n", le->attribute->name);
     GNUNET_CONTAINER_DLL_insert (attrs->list_head,
                                  attrs->list_tail,
diff --git a/src/identity-provider/identity_provider_api.c 
b/src/identity-provider/identity_provider_api.c
index 6e0ce7b42..371dce86d 100644
--- a/src/identity-provider/identity_provider_api.c
+++ b/src/identity-provider/identity_provider_api.c
@@ -560,7 +560,7 @@ handle_consume_ticket_result (void *cls,
   uint32_t r_id = ntohl (msg->id);
 
   attrs_len = ntohs (msg->attrs_len);
-  LOG (GNUNET_ERROR_TYPE_MESSAGE,
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Processing attribute result.\n");
 
 
@@ -641,7 +641,7 @@ handle_attribute_result (void *cls,
   uint32_t r_id = ntohl (msg->id);
 
   attr_len = ntohs (msg->attr_len);
-  LOG (GNUNET_ERROR_TYPE_MESSAGE,
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Processing attribute result.\n");
 
 
diff --git a/src/identity-provider/test_idp_issue.sh 
b/src/identity-provider/test_idp_issue.sh
index 38369a33e..f2f48057d 100755
--- a/src/identity-provider/test_idp_issue.sh
+++ b/src/identity-provider/test_idp_issue.sh
@@ -32,6 +32,6 @@ gnunet-idp -e testego -a email -V address@hidden -c 
test_idp.conf
 gnunet-idp -e testego -a name -V John -c test_idp.conf
 #gnunet-idp -e testego -D -c test_idp.conf
 TICKET=$(gnunet-idp -e testego -i "email,name" -r $SUBJECT_KEY -c 
test_idp.conf | awk '{print $1}')
-echo "Consuming $TICKET"
+#echo "Consuming $TICKET"
 gnunet-idp -e rpego -C $TICKET -c test_idp.conf
 gnunet-arm -e -c test_idp.conf

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



reply via email to

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