diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/reclaim/gnunet-service-reclaim_tickets.c | 49 | ||||
-rw-r--r-- | src/rest/gnunet-rest-server.c | 4 |
2 files changed, 30 insertions, 23 deletions
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c index 65f3f450f..645f26baf 100644 --- a/src/reclaim/gnunet-service-reclaim_tickets.c +++ b/src/reclaim/gnunet-service-reclaim_tickets.c | |||
@@ -168,7 +168,7 @@ struct TicketIssueHandle | |||
168 | * QueueEntry | 168 | * QueueEntry |
169 | */ | 169 | */ |
170 | struct GNUNET_NAMESTORE_QueueEntry *ns_qe; | 170 | struct GNUNET_NAMESTORE_QueueEntry *ns_qe; |
171 | 171 | ||
172 | /** | 172 | /** |
173 | * Namestore Iterator | 173 | * Namestore Iterator |
174 | */ | 174 | */ |
@@ -1027,16 +1027,19 @@ filter_tickets_error_cb (void *cls) | |||
1027 | { | 1027 | { |
1028 | struct TicketIssueHandle *tih = cls; | 1028 | struct TicketIssueHandle *tih = cls; |
1029 | tih->ns_it = NULL; | 1029 | tih->ns_it = NULL; |
1030 | tih->cb (tih->cb_cls, &tih->ticket, GNUNET_SYSERR, "Error storing AuthZ ticket in GNS"); | 1030 | tih->cb (tih->cb_cls, |
1031 | &tih->ticket, | ||
1032 | GNUNET_SYSERR, | ||
1033 | "Error storing AuthZ ticket in GNS"); | ||
1031 | cleanup_issue_handle (tih); | 1034 | cleanup_issue_handle (tih); |
1032 | } | 1035 | } |
1033 | 1036 | ||
1034 | static void | 1037 | static void |
1035 | filter_tickets_cb (void *cls, | 1038 | filter_tickets_cb (void *cls, |
1036 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 1039 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
1037 | const char *label, | 1040 | const char *label, |
1038 | unsigned int rd_count, | 1041 | unsigned int rd_count, |
1039 | const struct GNUNET_GNSRECORD_Data *rd) | 1042 | const struct GNUNET_GNSRECORD_Data *rd) |
1040 | { | 1043 | { |
1041 | struct TicketIssueHandle *tih = cls; | 1044 | struct TicketIssueHandle *tih = cls; |
1042 | struct GNUNET_RECLAIM_Ticket *ticket = NULL; | 1045 | struct GNUNET_RECLAIM_Ticket *ticket = NULL; |
@@ -1057,8 +1060,8 @@ filter_tickets_cb (void *cls, | |||
1057 | { | 1060 | { |
1058 | ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data; | 1061 | ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data; |
1059 | // cmp audience | 1062 | // cmp audience |
1060 | if (0 == memcmp (&tih->ticket.audience, | 1063 | if (0 == memcmp (&tih->ticket.audience, |
1061 | &ticket->audience, | 1064 | &ticket->audience, |
1062 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) | 1065 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) |
1063 | { | 1066 | { |
1064 | tih->ticket = *ticket; | 1067 | tih->ticket = *ticket; |
@@ -1072,15 +1075,14 @@ filter_tickets_cb (void *cls, | |||
1072 | continue; | 1075 | continue; |
1073 | for (le = tih->attrs->list_head; NULL != le; le = le->next) | 1076 | for (le = tih->attrs->list_head; NULL != le; le = le->next) |
1074 | { | 1077 | { |
1075 | // cmp attr_ref id with requested attr id | 1078 | // cmp attr_ref id with requested attr id |
1076 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1079 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1077 | " %" PRIu64 "\n %" PRIu64 "\n", | 1080 | " %" PRIu64 "\n %" PRIu64 "\n", |
1078 | *((uint64_t *) rd[i].data), le->claim->id); | 1081 | *((uint64_t *) rd[i].data), |
1082 | le->claim->id); | ||
1079 | 1083 | ||
1080 | 1084 | ||
1081 | if (0 == memcmp (rd[i].data, | 1085 | if (0 == memcmp (rd[i].data, &le->claim->id, sizeof (uint64_t))) |
1082 | &le->claim->id, | ||
1083 | sizeof (uint64_t))) | ||
1084 | found_attrs_cnt++; | 1086 | found_attrs_cnt++; |
1085 | } | 1087 | } |
1086 | } | 1088 | } |
@@ -1092,7 +1094,7 @@ filter_tickets_cb (void *cls, | |||
1092 | cleanup_issue_handle (tih); | 1094 | cleanup_issue_handle (tih); |
1093 | return; | 1095 | return; |
1094 | } | 1096 | } |
1095 | 1097 | ||
1096 | // ticket not found in current record | 1098 | // ticket not found in current record |
1097 | GNUNET_NAMESTORE_zone_iterator_next (tih->ns_it, 1); | 1099 | GNUNET_NAMESTORE_zone_iterator_next (tih->ns_it, 1); |
1098 | } | 1100 | } |
@@ -1103,7 +1105,8 @@ filter_tickets_finished_cb (void *cls) | |||
1103 | { | 1105 | { |
1104 | struct TicketIssueHandle *tih = cls; | 1106 | struct TicketIssueHandle *tih = cls; |
1105 | GNUNET_CRYPTO_ecdsa_key_get_public (&tih->identity, &tih->ticket.identity); | 1107 | GNUNET_CRYPTO_ecdsa_key_get_public (&tih->identity, &tih->ticket.identity); |
1106 | tih->ticket.rnd = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | 1108 | tih->ticket.rnd = |
1109 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | ||
1107 | issue_ticket (tih); | 1110 | issue_ticket (tih); |
1108 | } | 1111 | } |
1109 | 1112 | ||
@@ -1124,14 +1127,14 @@ RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | |||
1124 | 1127 | ||
1125 | // check whether the ticket has already been issued | 1128 | // check whether the ticket has already been issued |
1126 | tih->ns_it = | 1129 | tih->ns_it = |
1127 | GNUNET_NAMESTORE_zone_iteration_start (nsh, | 1130 | GNUNET_NAMESTORE_zone_iteration_start (nsh, |
1128 | &tih->identity, | 1131 | &tih->identity, |
1129 | &filter_tickets_error_cb, | 1132 | &filter_tickets_error_cb, |
1130 | tih, | 1133 | tih, |
1131 | &filter_tickets_cb, | 1134 | &filter_tickets_cb, |
1132 | tih, | 1135 | tih, |
1133 | &filter_tickets_finished_cb, | 1136 | &filter_tickets_finished_cb, |
1134 | tih); | 1137 | tih); |
1135 | } | 1138 | } |
1136 | 1139 | ||
1137 | /************************************ | 1140 | /************************************ |
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c index 89a2db3d9..c0db5430c 100644 --- a/src/rest/gnunet-rest-server.c +++ b/src/rest/gnunet-rest-server.c | |||
@@ -441,12 +441,16 @@ create_response (void *cls, | |||
441 | //Handle Preflights | 441 | //Handle Preflights |
442 | if (GNUNET_YES == echo_origin) | 442 | if (GNUNET_YES == echo_origin) |
443 | { | 443 | { |
444 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
445 | "Echoing origin\n"); | ||
444 | GNUNET_CRYPTO_hash ("origin", | 446 | GNUNET_CRYPTO_hash ("origin", |
445 | strlen ("origin"), | 447 | strlen ("origin"), |
446 | &key); | 448 | &key); |
447 | origin = GNUNET_CONTAINER_multihashmap_get (con_handle->data_handle | 449 | origin = GNUNET_CONTAINER_multihashmap_get (con_handle->data_handle |
448 | ->header_param_map, | 450 | ->header_param_map, |
449 | &key); | 451 | &key); |
452 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
453 | "Origin: %s\n", origin); | ||
450 | if (NULL != origin) | 454 | if (NULL != origin) |
451 | MHD_add_response_header (con_handle->response, | 455 | MHD_add_response_header (con_handle->response, |
452 | MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, | 456 | MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, |