diff options
author | Markus Voggenreiter <Markus.Voggenreiter@tum.de> | 2019-10-31 17:47:22 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-01-13 13:31:04 +0100 |
commit | 17af2a636fc8fd0c111c7550484b2582cb7eb64a (patch) | |
tree | 96996cb243cdd8d6d7c557d3d7498119d4687800 /src | |
parent | 6157f0cb7ae89094f91f19fe09b92445efc746e4 (diff) | |
download | gnunet-17af2a636fc8fd0c111c7550484b2582cb7eb64a.tar.gz gnunet-17af2a636fc8fd0c111c7550484b2582cb7eb64a.zip |
Prepared Listing of References
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_protocols.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_reclaim_attribute_lib.h | 4 | ||||
-rw-r--r-- | src/include/gnunet_reclaim_service.h | 3 | ||||
-rw-r--r-- | src/reclaim-attribute/reclaim_attribute.c | 8 | ||||
-rw-r--r-- | src/reclaim/gnunet-reclaim.c | 12 | ||||
-rw-r--r-- | src/reclaim/gnunet-service-reclaim.c | 113 | ||||
-rw-r--r-- | src/reclaim/plugin_rest_openid_connect.c | 8 | ||||
-rw-r--r-- | src/reclaim/plugin_rest_reclaim.c | 9 | ||||
-rw-r--r-- | src/reclaim/reclaim_api.c | 121 |
9 files changed, 210 insertions, 70 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 367f6fd80..8091fb367 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -3311,6 +3311,8 @@ extern "C" { | |||
3311 | */ | 3311 | */ |
3312 | #define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_DELETE 1500 | 3312 | #define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_DELETE 1500 |
3313 | 3313 | ||
3314 | #define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT 1501 | ||
3315 | |||
3314 | 3316 | ||
3315 | /** | 3317 | /** |
3316 | * Type used to match 'all' message types. | 3318 | * Type used to match 'all' message types. |
diff --git a/src/include/gnunet_reclaim_attribute_lib.h b/src/include/gnunet_reclaim_attribute_lib.h index cfdecae79..c761d20ed 100644 --- a/src/include/gnunet_reclaim_attribute_lib.h +++ b/src/include/gnunet_reclaim_attribute_lib.h | |||
@@ -76,9 +76,9 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim | |||
76 | uint32_t type; | 76 | uint32_t type; |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Version | 79 | * Flags |
80 | */ | 80 | */ |
81 | uint32_t version; | 81 | uint32_t flag; |
82 | /** | 82 | /** |
83 | * The name of the attribute. Note "name" must never be individually | 83 | * The name of the attribute. Note "name" must never be individually |
84 | * free'd | 84 | * free'd |
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h index f839123e5..214cdba69 100644 --- a/src/include/gnunet_reclaim_service.h +++ b/src/include/gnunet_reclaim_service.h | |||
@@ -118,7 +118,8 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls, | |||
118 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( | 118 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( |
119 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 119 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
120 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 120 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
121 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest); | 121 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, |
122 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference); | ||
122 | 123 | ||
123 | 124 | ||
124 | /** | 125 | /** |
diff --git a/src/reclaim-attribute/reclaim_attribute.c b/src/reclaim-attribute/reclaim_attribute.c index 0083ac53e..d958ba7f9 100644 --- a/src/reclaim-attribute/reclaim_attribute.c +++ b/src/reclaim-attribute/reclaim_attribute.c | |||
@@ -353,7 +353,7 @@ GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char *attr_name, | |||
353 | + strlen (attr_name_tmp) + 1 + data_size); | 353 | + strlen (attr_name_tmp) + 1 + data_size); |
354 | attr->type = type; | 354 | attr->type = type; |
355 | attr->data_size = data_size; | 355 | attr->data_size = data_size; |
356 | attr->version = 0; | 356 | attr->flag = 0; |
357 | write_ptr = (char *) &attr[1]; | 357 | write_ptr = (char *) &attr[1]; |
358 | GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1); | 358 | GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1); |
359 | attr->name = write_ptr; | 359 | attr->name = write_ptr; |
@@ -569,8 +569,8 @@ GNUNET_RECLAIM_ATTRIBUTE_list_dup ( | |||
569 | le->claim->type, | 569 | le->claim->type, |
570 | le->claim->data, | 570 | le->claim->data, |
571 | le->claim->data_size); | 571 | le->claim->data_size); |
572 | result_le->claim->version = le->claim->version; | ||
573 | result_le->claim->id = le->claim->id; | 572 | result_le->claim->id = le->claim->id; |
573 | result_le->claim->flag = le->claim->flag; | ||
574 | GNUNET_CONTAINER_DLL_insert (result->list_head, | 574 | GNUNET_CONTAINER_DLL_insert (result->list_head, |
575 | result->list_tail, | 575 | result->list_tail, |
576 | result_le); | 576 | result_le); |
@@ -635,7 +635,7 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize ( | |||
635 | 635 | ||
636 | attr_ser = (struct Attribute *) result; | 636 | attr_ser = (struct Attribute *) result; |
637 | attr_ser->attribute_type = htons (attr->type); | 637 | attr_ser->attribute_type = htons (attr->type); |
638 | attr_ser->attribute_version = htonl (attr->version); | 638 | attr_ser->attribute_version = htonl (attr->flag); |
639 | attr_ser->attribute_id = GNUNET_htonll (attr->id); | 639 | attr_ser->attribute_id = GNUNET_htonll (attr->id); |
640 | name_len = strlen (attr->name); | 640 | name_len = strlen (attr->name); |
641 | attr_ser->name_len = htons (name_len); | 641 | attr_ser->name_len = htons (name_len); |
@@ -685,7 +685,7 @@ GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char *data, size_t data_size) | |||
685 | attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim) | 685 | attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim) |
686 | + data_len + name_len + 1); | 686 | + data_len + name_len + 1); |
687 | attr->type = ntohs (attr_ser->attribute_type); | 687 | attr->type = ntohs (attr_ser->attribute_type); |
688 | attr->version = ntohl (attr_ser->attribute_version); | 688 | attr->flag = ntohl (attr_ser->attribute_version); |
689 | attr->id = GNUNET_ntohll (attr_ser->attribute_id); | 689 | attr->id = GNUNET_ntohll (attr_ser->attribute_id); |
690 | attr->data_size = data_len; | 690 | attr->data_size = data_len; |
691 | 691 | ||
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c index c8ce1d722..5f9170f05 100644 --- a/src/reclaim/gnunet-reclaim.c +++ b/src/reclaim/gnunet-reclaim.c | |||
@@ -227,7 +227,8 @@ static void | |||
227 | process_attrs (void *cls, | 227 | process_attrs (void *cls, |
228 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 228 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
229 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 229 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
230 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest) | 230 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, |
231 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference) | ||
231 | { | 232 | { |
232 | char *value_str; | 233 | char *value_str; |
233 | char *id; | 234 | char *id; |
@@ -254,7 +255,7 @@ process_attrs (void *cls, | |||
254 | attr->name, | 255 | attr->name, |
255 | value_str, | 256 | value_str, |
256 | attr_type, | 257 | attr_type, |
257 | attr->version, | 258 | attr->flag, |
258 | id); | 259 | id); |
259 | GNUNET_free (id); | 260 | GNUNET_free (id); |
260 | } | 261 | } |
@@ -447,7 +448,8 @@ static void | |||
447 | iter_cb (void *cls, | 448 | iter_cb (void *cls, |
448 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 449 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
449 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 450 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
450 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest) | 451 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, |
452 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference) | ||
451 | { | 453 | { |
452 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; | 454 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; |
453 | char *attrs_tmp; | 455 | char *attrs_tmp; |
@@ -482,7 +484,7 @@ iter_cb (void *cls, | |||
482 | attr->type, | 484 | attr->type, |
483 | attr->data, | 485 | attr->data, |
484 | attr->data_size); | 486 | attr->data_size); |
485 | le->claim->version = attr->version; | 487 | le->claim->flag = attr->flag; |
486 | le->claim->id = attr->id; | 488 | le->claim->id = attr->id; |
487 | GNUNET_CONTAINER_DLL_insert (attr_list->list_head, | 489 | GNUNET_CONTAINER_DLL_insert (attr_list->list_head, |
488 | attr_list->list_tail, | 490 | attr_list->list_tail, |
@@ -516,7 +518,7 @@ iter_cb (void *cls, | |||
516 | attr->name, | 518 | attr->name, |
517 | attr_str, | 519 | attr_str, |
518 | attr_type, | 520 | attr_type, |
519 | attr->version, | 521 | attr->flag, |
520 | id); | 522 | id); |
521 | GNUNET_free (id); | 523 | GNUNET_free (id); |
522 | } | 524 | } |
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index 0c27cdbef..11ff2cd2d 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -1452,26 +1452,19 @@ ticket_iter (void *cls, | |||
1452 | int has_changed = GNUNET_NO; | 1452 | int has_changed = GNUNET_NO; |
1453 | for (int i = 0; i < rd_count; i++) | 1453 | for (int i = 0; i < rd_count; i++) |
1454 | { | 1454 | { |
1455 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1456 | "Next Zone Iteration %u and record type is %u\n", rd_count, | ||
1457 | rd[i].record_type); | ||
1458 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) && | 1455 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) && |
1459 | (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE_REF != rd[i].record_type) && | 1456 | (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE_REF != rd[i].record_type) && |
1460 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_REF != rd[i].record_type)) | 1457 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_REF != rd[i].record_type)) |
1461 | continue; | 1458 | continue; |
1462 | if (&adh->claim != NULL) | 1459 | if (&adh->claim != NULL) |
1463 | { | ||
1464 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Claim is existend: %u \n", adh->claim->id); | ||
1465 | if (0 != memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t))) | 1460 | if (0 != memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t))) |
1466 | continue; | 1461 | continue; |
1467 | } | ||
1468 | if (&adh->attest != NULL) | 1462 | if (&adh->attest != NULL) |
1469 | if (0 != memcmp (rd[i].data, &adh->attest->id, sizeof(uint64_t))) | 1463 | if (0 != memcmp (rd[i].data, &adh->attest->id, sizeof(uint64_t))) |
1470 | continue; | 1464 | continue; |
1471 | if (&adh->reference != NULL) | 1465 | if (&adh->reference != NULL) |
1472 | if (0 != memcmp (rd[i].data, &adh->reference->id, sizeof(uint64_t))) | 1466 | if (0 != memcmp (rd[i].data, &adh->reference->id, sizeof(uint64_t))) |
1473 | continue; | 1467 | continue; |
1474 | |||
1475 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1468 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1476 | "Attribute or Attestation/Reference to delete found (%s)\n", | 1469 | "Attribute or Attestation/Reference to delete found (%s)\n", |
1477 | adh->label); | 1470 | adh->label); |
@@ -1490,7 +1483,6 @@ ticket_iter (void *cls, | |||
1490 | adh->tickets_to_update_tail, | 1483 | adh->tickets_to_update_tail, |
1491 | le); | 1484 | le); |
1492 | } | 1485 | } |
1493 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Next Zone Iteration \n"); | ||
1494 | GNUNET_NAMESTORE_zone_iterator_next (adh->ns_it, 1); | 1486 | GNUNET_NAMESTORE_zone_iterator_next (adh->ns_it, 1); |
1495 | } | 1487 | } |
1496 | 1488 | ||
@@ -2027,7 +2019,7 @@ attr_iter_error (void *cls) | |||
2027 | 2019 | ||
2028 | 2020 | ||
2029 | /** | 2021 | /** |
2030 | * Got record. Return if it is an attribute or attestation. | 2022 | * Got record. Return if it is an attribute or attestation/reference. |
2031 | * | 2023 | * |
2032 | * @param cls our attribute iterator | 2024 | * @param cls our attribute iterator |
2033 | * @param zone zone we are iterating | 2025 | * @param zone zone we are iterating |
@@ -2047,48 +2039,83 @@ attr_iter_cb (void *cls, | |||
2047 | struct GNUNET_MQ_Envelope *env; | 2039 | struct GNUNET_MQ_Envelope *env; |
2048 | char *data_tmp; | 2040 | char *data_tmp; |
2049 | 2041 | ||
2050 | if (rd_count != 1) | 2042 | if (rd_count == 0) |
2051 | { | 2043 | { |
2052 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); | 2044 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); |
2053 | return; | 2045 | return; |
2054 | } | 2046 | } |
2055 | 2047 | if (rd_count > 1) | |
2056 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd->record_type) && | ||
2057 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd->record_type) ) | ||
2058 | { | 2048 | { |
2059 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); | 2049 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[0].record_type) |
2060 | return; | 2050 | { |
2051 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
2052 | "Non-Attestation record with multiple entries found\n"); | ||
2053 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); | ||
2054 | return; | ||
2055 | } | ||
2061 | } | 2056 | } |
2062 | 2057 | ||
2063 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd->record_type ) | 2058 | for (int i = 0; i<rd_count; i++) |
2064 | { | 2059 | { |
2065 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n", | 2060 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd[i].record_type) && |
2066 | label); | 2061 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[i].record_type) && |
2067 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2062 | (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE != rd[i].record_type)) |
2068 | "Sending ATTESTATION_RESULT message\n"); | 2063 | { |
2069 | env = GNUNET_MQ_msg_extra (arm, | 2064 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); |
2070 | rd->data_size, | 2065 | return; |
2071 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT); | 2066 | } |
2072 | arm->id = htonl (ai->request_id); | 2067 | |
2073 | arm->attr_len = htons (rd->data_size); | 2068 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type ) |
2074 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); | 2069 | { |
2075 | data_tmp = (char *) &arm[1]; | 2070 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", |
2076 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); | 2071 | label); |
2077 | GNUNET_MQ_send (ai->client->mq, env); | 2072 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2078 | } | 2073 | "Sending ATTRIBUTE_RESULT message\n"); |
2079 | else | 2074 | env = GNUNET_MQ_msg_extra (arm, |
2080 | { | 2075 | rd[i].data_size, |
2081 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", label); | 2076 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); |
2082 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n"); | 2077 | arm->id = htonl (ai->request_id); |
2083 | env = GNUNET_MQ_msg_extra (arm, | 2078 | arm->attr_len = htons (rd[i].data_size); |
2084 | rd->data_size, | 2079 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); |
2085 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); | 2080 | data_tmp = (char *) &arm[1]; |
2086 | arm->id = htonl (ai->request_id); | 2081 | GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size); |
2087 | arm->attr_len = htons (rd->data_size); | 2082 | GNUNET_MQ_send (ai->client->mq, env); |
2088 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); | 2083 | } |
2089 | data_tmp = (char *) &arm[1]; | 2084 | else |
2090 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); | 2085 | { |
2091 | GNUNET_MQ_send (ai->client->mq, env); | 2086 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type ) |
2087 | { | ||
2088 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n", | ||
2089 | label); | ||
2090 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2091 | "Sending ATTESTATION_RESULT message\n"); | ||
2092 | env = GNUNET_MQ_msg_extra (arm, | ||
2093 | rd[i].data_size, | ||
2094 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT); | ||
2095 | arm->id = htonl (ai->request_id); | ||
2096 | arm->attr_len = htons (rd[i].data_size); | ||
2097 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); | ||
2098 | data_tmp = (char *) &arm[1]; | ||
2099 | GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size); | ||
2100 | GNUNET_MQ_send (ai->client->mq, env); | ||
2101 | } | ||
2102 | else | ||
2103 | { | ||
2104 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found reference under: %s\n", | ||
2105 | label); | ||
2106 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2107 | "Sending REFERENCE_RESULT message\n"); | ||
2108 | env = GNUNET_MQ_msg_extra (arm, | ||
2109 | rd[i].data_size, | ||
2110 | GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT); | ||
2111 | arm->id = htonl (ai->request_id); | ||
2112 | arm->attr_len = htons (rd[i].data_size); | ||
2113 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); | ||
2114 | data_tmp = (char *) &arm[1]; | ||
2115 | GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size); | ||
2116 | GNUNET_MQ_send (ai->client->mq, env); | ||
2117 | } | ||
2118 | } | ||
2092 | } | 2119 | } |
2093 | } | 2120 | } |
2094 | 2121 | ||
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c index 2dde89950..435cc3bf3 100644 --- a/src/reclaim/plugin_rest_openid_connect.c +++ b/src/reclaim/plugin_rest_openid_connect.c | |||
@@ -979,7 +979,8 @@ static void | |||
979 | oidc_attr_collect (void *cls, | 979 | oidc_attr_collect (void *cls, |
980 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 980 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
981 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 981 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
982 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest) | 982 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, |
983 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference) | ||
983 | { | 984 | { |
984 | struct RequestHandle *handle = cls; | 985 | struct RequestHandle *handle = cls; |
985 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; | 986 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; |
@@ -1015,7 +1016,7 @@ oidc_attr_collect (void *cls, | |||
1015 | attr->data, | 1016 | attr->data, |
1016 | attr->data_size); | 1017 | attr->data_size); |
1017 | le->claim->id = attr->id; | 1018 | le->claim->id = attr->id; |
1018 | le->claim->version = attr->version; | 1019 | le->claim->flag = attr->flag; |
1019 | GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head, | 1020 | GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head, |
1020 | handle->attr_list->list_tail, | 1021 | handle->attr_list->list_tail, |
1021 | le); | 1022 | le); |
@@ -1864,7 +1865,8 @@ static void | |||
1864 | consume_ticket (void *cls, | 1865 | consume_ticket (void *cls, |
1865 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 1866 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
1866 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 1867 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
1867 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest) | 1868 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, |
1869 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference) | ||
1868 | { | 1870 | { |
1869 | struct RequestHandle *handle = cls; | 1871 | struct RequestHandle *handle = cls; |
1870 | char *tmp_value; | 1872 | char *tmp_value; |
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c index 5066eef58..7dd658886 100644 --- a/src/reclaim/plugin_rest_reclaim.c +++ b/src/reclaim/plugin_rest_reclaim.c | |||
@@ -638,7 +638,8 @@ static void | |||
638 | attest_collect (void *cls, | 638 | attest_collect (void *cls, |
639 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 639 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
640 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 640 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
641 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest) | 641 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, |
642 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference) | ||
642 | { | 643 | { |
643 | struct RequestHandle *handle = cls; | 644 | struct RequestHandle *handle = cls; |
644 | json_t *attr_obj; | 645 | json_t *attr_obj; |
@@ -1053,7 +1054,8 @@ static void | |||
1053 | attr_collect (void *cls, | 1054 | attr_collect (void *cls, |
1054 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 1055 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
1055 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 1056 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
1056 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest) | 1057 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, |
1058 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference) | ||
1057 | { | 1059 | { |
1058 | struct RequestHandle *handle = cls; | 1060 | struct RequestHandle *handle = cls; |
1059 | json_t *attr_obj; | 1061 | json_t *attr_obj; |
@@ -1292,7 +1294,8 @@ static void | |||
1292 | consume_cont (void *cls, | 1294 | consume_cont (void *cls, |
1293 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 1295 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
1294 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 1296 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
1295 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest) | 1297 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, |
1298 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference) | ||
1296 | { | 1299 | { |
1297 | struct RequestHandle *handle = cls; | 1300 | struct RequestHandle *handle = cls; |
1298 | char *val_str; | 1301 | char *val_str; |
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index 7c7261522..ede2daf28 100644 --- a/src/reclaim/reclaim_api.c +++ b/src/reclaim/reclaim_api.c | |||
@@ -504,16 +504,16 @@ handle_consume_ticket_result (void *cls, | |||
504 | { | 504 | { |
505 | if (NULL == attrs) | 505 | if (NULL == attrs) |
506 | { | 506 | { |
507 | op->ar_cb (op->cls, &msg->identity, NULL, NULL); | 507 | op->ar_cb (op->cls, &msg->identity, NULL, NULL, NULL); |
508 | } | 508 | } |
509 | else | 509 | else |
510 | { | 510 | { |
511 | for (le = attrs->list_head; NULL != le; le = le->next) | 511 | for (le = attrs->list_head; NULL != le; le = le->next) |
512 | op->ar_cb (op->cls, &msg->identity, le->claim, NULL); | 512 | op->ar_cb (op->cls, &msg->identity, le->claim, NULL, NULL); |
513 | GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs); | 513 | GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs); |
514 | attrs = NULL; | 514 | attrs = NULL; |
515 | } | 515 | } |
516 | op->ar_cb (op->cls, NULL, NULL, NULL); | 516 | op->ar_cb (op->cls, NULL, NULL, NULL, NULL); |
517 | } | 517 | } |
518 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); | 518 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); |
519 | free_op (op); | 519 | free_op (op); |
@@ -597,7 +597,7 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
597 | if (NULL != op) | 597 | if (NULL != op) |
598 | { | 598 | { |
599 | if (NULL != op->ar_cb) | 599 | if (NULL != op->ar_cb) |
600 | op->ar_cb (op->cls, NULL, NULL, NULL); | 600 | op->ar_cb (op->cls, NULL, NULL, NULL, NULL); |
601 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); | 601 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); |
602 | free_op (op); | 602 | free_op (op); |
603 | } | 603 | } |
@@ -610,12 +610,12 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
610 | if (NULL != it) | 610 | if (NULL != it) |
611 | { | 611 | { |
612 | if (NULL != it->proc) | 612 | if (NULL != it->proc) |
613 | it->proc (it->proc_cls, &msg->identity, attr, NULL); | 613 | it->proc (it->proc_cls, &msg->identity, attr, NULL, NULL); |
614 | } | 614 | } |
615 | else if (NULL != op) | 615 | else if (NULL != op) |
616 | { | 616 | { |
617 | if (NULL != op->ar_cb) | 617 | if (NULL != op->ar_cb) |
618 | op->ar_cb (op->cls, &msg->identity, attr, NULL); | 618 | op->ar_cb (op->cls, &msg->identity, attr, NULL, NULL); |
619 | } | 619 | } |
620 | GNUNET_free (attr); | 620 | GNUNET_free (attr); |
621 | return; | 621 | return; |
@@ -696,7 +696,7 @@ handle_attestation_result (void *cls, const struct AttributeResultMessage *msg) | |||
696 | if (NULL != op) | 696 | if (NULL != op) |
697 | { | 697 | { |
698 | if (NULL != op->ar_cb) | 698 | if (NULL != op->ar_cb) |
699 | op->ar_cb (op->cls, NULL, NULL, NULL); | 699 | op->ar_cb (op->cls, NULL, NULL, NULL, NULL); |
700 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); | 700 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); |
701 | free_op (op); | 701 | free_op (op); |
702 | } | 702 | } |
@@ -709,12 +709,111 @@ handle_attestation_result (void *cls, const struct AttributeResultMessage *msg) | |||
709 | if (NULL != it) | 709 | if (NULL != it) |
710 | { | 710 | { |
711 | if (NULL != it->proc) | 711 | if (NULL != it->proc) |
712 | it->proc (it->proc_cls, &msg->identity, NULL, attr); | 712 | it->proc (it->proc_cls, &msg->identity, NULL, attr, NULL); |
713 | } | 713 | } |
714 | else if (NULL != op) | 714 | else if (NULL != op) |
715 | { | 715 | { |
716 | if (NULL != op->ar_cb) | 716 | if (NULL != op->ar_cb) |
717 | op->ar_cb (op->cls, &msg->identity, NULL, attr); | 717 | op->ar_cb (op->cls, &msg->identity, NULL, attr, NULL); |
718 | } | ||
719 | GNUNET_free (attr); | ||
720 | return; | ||
721 | } | ||
722 | GNUNET_assert (0); | ||
723 | } | ||
724 | |||
725 | /** | ||
726 | * Handle an incoming message of type | ||
727 | * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT | ||
728 | * | ||
729 | * @param cls | ||
730 | * @param msg the message we received | ||
731 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | ||
732 | */ | ||
733 | static int | ||
734 | check_reference_result (void *cls, const struct AttributeResultMessage *msg) | ||
735 | { | ||
736 | size_t msg_len; | ||
737 | size_t attr_len; | ||
738 | |||
739 | msg_len = ntohs (msg->header.size); | ||
740 | attr_len = ntohs (msg->attr_len); | ||
741 | if (msg_len != sizeof(struct AttributeResultMessage) + attr_len) | ||
742 | { | ||
743 | GNUNET_break (0); | ||
744 | return GNUNET_SYSERR; | ||
745 | } | ||
746 | return GNUNET_OK; | ||
747 | } | ||
748 | |||
749 | /** | ||
750 | * Handle an incoming message of type | ||
751 | * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT | ||
752 | * | ||
753 | * @param cls | ||
754 | * @param msg the message we received | ||
755 | */ | ||
756 | static void | ||
757 | handle_reference_result (void *cls, const struct AttributeResultMessage *msg) | ||
758 | { | ||
759 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; | ||
760 | struct GNUNET_RECLAIM_Handle *h = cls; | ||
761 | struct GNUNET_RECLAIM_AttributeIterator *it; | ||
762 | struct GNUNET_RECLAIM_Operation *op; | ||
763 | size_t attr_len; | ||
764 | uint32_t r_id = ntohl (msg->id); | ||
765 | |||
766 | attr_len = ntohs (msg->attr_len); | ||
767 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing reference result.\n"); | ||
768 | |||
769 | |||
770 | for (it = h->it_head; NULL != it; it = it->next) | ||
771 | if (it->r_id == r_id) | ||
772 | break; | ||
773 | for (op = h->op_head; NULL != op; op = op->next) | ||
774 | if (op->r_id == r_id) | ||
775 | break; | ||
776 | if ((NULL == it) && (NULL == op)) | ||
777 | return; | ||
778 | |||
779 | if ((0 == | ||
780 | (memcmp (&msg->identity, &identity_dummy, sizeof(identity_dummy))))) | ||
781 | { | ||
782 | if ((NULL == it) && (NULL == op)) | ||
783 | { | ||
784 | GNUNET_break (0); | ||
785 | force_reconnect (h); | ||
786 | return; | ||
787 | } | ||
788 | if (NULL != it) | ||
789 | { | ||
790 | if (NULL != it->finish_cb) | ||
791 | it->finish_cb (it->finish_cb_cls); | ||
792 | free_it (it); | ||
793 | } | ||
794 | if (NULL != op) | ||
795 | { | ||
796 | if (NULL != op->ar_cb) | ||
797 | op->ar_cb (op->cls, NULL, NULL, NULL, NULL); | ||
798 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); | ||
799 | free_op (op); | ||
800 | } | ||
801 | return; | ||
802 | } | ||
803 | |||
804 | { | ||
805 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr; | ||
806 | attr = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &msg[1], | ||
807 | attr_len); | ||
808 | if (NULL != it) | ||
809 | { | ||
810 | if (NULL != it->proc) | ||
811 | it->proc (it->proc_cls, &msg->identity, NULL, NULL, attr); | ||
812 | } | ||
813 | else if (NULL != op) | ||
814 | { | ||
815 | if (NULL != op->ar_cb) | ||
816 | op->ar_cb (op->cls, &msg->identity, NULL, NULL, attr); | ||
718 | } | 817 | } |
719 | GNUNET_free (attr); | 818 | GNUNET_free (attr); |
720 | return; | 819 | return; |
@@ -844,6 +943,10 @@ reconnect (struct GNUNET_RECLAIM_Handle *h) | |||
844 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT, | 943 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT, |
845 | struct AttributeResultMessage, | 944 | struct AttributeResultMessage, |
846 | h), | 945 | h), |
946 | GNUNET_MQ_hd_var_size (reference_result, | ||
947 | GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT, | ||
948 | struct AttributeResultMessage, | ||
949 | h), | ||
847 | GNUNET_MQ_hd_fixed_size (ticket_result, | 950 | GNUNET_MQ_hd_fixed_size (ticket_result, |
848 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, | 951 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, |
849 | struct TicketResultMessage, | 952 | struct TicketResultMessage, |