diff options
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r-- | src/reclaim/gnunet-service-reclaim.c | 113 |
1 files changed, 70 insertions, 43 deletions
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 | ||