diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-03 21:51:57 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-09 20:38:10 +0100 |
commit | 5b6bb2ce4d60635b2af950d72b45f12686fd5218 (patch) | |
tree | ef3b5786591f6a8473a4a2174dd95a439f22af68 /src/reclaim | |
parent | 99d70615e37294d4f964992c6be0495e95777a27 (diff) | |
download | gnunet-5b6bb2ce4d60635b2af950d72b45f12686fd5218.tar.gz gnunet-5b6bb2ce4d60635b2af950d72b45f12686fd5218.zip |
move to 256-bit identifier; some cleanups
Diffstat (limited to 'src/reclaim')
-rw-r--r-- | src/reclaim/gnunet-reclaim.c | 14 | ||||
-rw-r--r-- | src/reclaim/gnunet-service-reclaim.c | 91 | ||||
-rw-r--r-- | src/reclaim/gnunet-service-reclaim_tickets.c | 133 | ||||
-rw-r--r-- | src/reclaim/json_reclaim.c | 19 | ||||
-rw-r--r-- | src/reclaim/oidc_helper.c | 8 | ||||
-rw-r--r-- | src/reclaim/plugin_rest_reclaim.c | 34 | ||||
-rw-r--r-- | src/reclaim/reclaim_api.c | 19 |
7 files changed, 178 insertions, 140 deletions
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c index 5f9170f05..c3d305eb5 100644 --- a/src/reclaim/gnunet-reclaim.c +++ b/src/reclaim/gnunet-reclaim.c | |||
@@ -227,7 +227,7 @@ 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 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference) |
232 | { | 232 | { |
233 | char *value_str; | 233 | char *value_str; |
@@ -249,9 +249,9 @@ process_attrs (void *cls, | |||
249 | attr->data, | 249 | attr->data, |
250 | attr->data_size); | 250 | attr->data_size); |
251 | attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); | 251 | attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); |
252 | id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t)); | 252 | id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id)); |
253 | fprintf (stdout, | 253 | fprintf (stdout, |
254 | "Name: %s; Value: %s (%s); Version %u; ID: %s\n", | 254 | "Name: %s; Value: %s (%s); Flag %u; ID: %s\n", |
255 | attr->name, | 255 | attr->name, |
256 | value_str, | 256 | value_str, |
257 | attr_type, | 257 | attr_type, |
@@ -289,7 +289,7 @@ ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) | |||
289 | GNUNET_STRINGS_data_to_string_alloc (&ticket->audience, | 289 | GNUNET_STRINGS_data_to_string_alloc (&ticket->audience, |
290 | sizeof(struct | 290 | sizeof(struct |
291 | GNUNET_CRYPTO_EcdsaPublicKey)); | 291 | GNUNET_CRYPTO_EcdsaPublicKey)); |
292 | ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t)); | 292 | ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd)); |
293 | tkt = | 293 | tkt = |
294 | GNUNET_STRINGS_data_to_string_alloc (ticket, | 294 | GNUNET_STRINGS_data_to_string_alloc (ticket, |
295 | sizeof(struct GNUNET_RECLAIM_Ticket)); | 295 | sizeof(struct GNUNET_RECLAIM_Ticket)); |
@@ -495,7 +495,7 @@ iter_cb (void *cls, | |||
495 | } | 495 | } |
496 | else if (attr_delete && (NULL == attr_to_delete)) | 496 | else if (attr_delete && (NULL == attr_to_delete)) |
497 | { | 497 | { |
498 | label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t)); | 498 | label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id)); |
499 | if (0 == strcasecmp (attr_delete, label)) | 499 | if (0 == strcasecmp (attr_delete, label)) |
500 | { | 500 | { |
501 | attr_to_delete = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name, | 501 | attr_to_delete = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name, |
@@ -512,9 +512,9 @@ iter_cb (void *cls, | |||
512 | attr->data, | 512 | attr->data, |
513 | attr->data_size); | 513 | attr->data_size); |
514 | attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); | 514 | attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); |
515 | id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t)); | 515 | id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id)); |
516 | fprintf (stdout, | 516 | fprintf (stdout, |
517 | "Name: %s; Value: %s (%s); Version %u; ID: %s\n", | 517 | "Name: %s; Value: %s (%s); Flag %u; ID: %s\n", |
518 | attr->name, | 518 | attr->name, |
519 | attr_str, | 519 | attr_str, |
520 | attr_type, | 520 | attr_type, |
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index 556006af0..a00bc5730 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -968,12 +968,12 @@ attr_store_task (void *cls) | |||
968 | buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (ash->claim); | 968 | buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (ash->claim); |
969 | buf = GNUNET_malloc (buf_size); | 969 | buf = GNUNET_malloc (buf_size); |
970 | // Give the ash a new id if unset | 970 | // Give the ash a new id if unset |
971 | if (0 == ash->claim->id) | 971 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->claim->id)) |
972 | ash->claim->id | 972 | GNUNET_RECLAIM_id_generate (&ash->claim->id); |
973 | = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | ||
974 | GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim, buf); | 973 | GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim, buf); |
975 | label | 974 | label |
976 | = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id, sizeof(uint64_t)); | 975 | = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id, |
976 | sizeof (ash->reference->id)); | ||
977 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label); | 977 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label); |
978 | 978 | ||
979 | rd[0].data_size = buf_size; | 979 | rd[0].data_size = buf_size; |
@@ -1086,6 +1086,7 @@ attest_store_cont (void *cls, int32_t success, const char *emsg) | |||
1086 | cleanup_as_handle (ash); | 1086 | cleanup_as_handle (ash); |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | |||
1089 | /** | 1090 | /** |
1090 | * Send a reference error response | 1091 | * Send a reference error response |
1091 | * | 1092 | * |
@@ -1111,6 +1112,7 @@ send_ref_error (struct AttributeStoreHandle *ash) | |||
1111 | cleanup_as_handle (ash); | 1112 | cleanup_as_handle (ash); |
1112 | } | 1113 | } |
1113 | 1114 | ||
1115 | |||
1114 | /** | 1116 | /** |
1115 | * Error looking up potential attestation. Abort. | 1117 | * Error looking up potential attestation. Abort. |
1116 | * | 1118 | * |
@@ -1127,6 +1129,7 @@ attest_error (void *cls) | |||
1127 | return; | 1129 | return; |
1128 | } | 1130 | } |
1129 | 1131 | ||
1132 | |||
1130 | /** | 1133 | /** |
1131 | * Check for existing record before storing reference | 1134 | * Check for existing record before storing reference |
1132 | * | 1135 | * |
@@ -1149,7 +1152,7 @@ attest_add_cb (void *cls, | |||
1149 | buf_size = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (ash->attest); | 1152 | buf_size = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (ash->attest); |
1150 | buf = GNUNET_malloc (buf_size); | 1153 | buf = GNUNET_malloc (buf_size); |
1151 | GNUNET_RECLAIM_ATTESTATION_serialize (ash->attest, buf); | 1154 | GNUNET_RECLAIM_ATTESTATION_serialize (ash->attest, buf); |
1152 | if (0 == rd_count ) | 1155 | if (0 == rd_count) |
1153 | { | 1156 | { |
1154 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1157 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1155 | "Storing new Attestation\n"); | 1158 | "Storing new Attestation\n"); |
@@ -1198,6 +1201,7 @@ attest_add_cb (void *cls, | |||
1198 | GNUNET_free (buf); | 1201 | GNUNET_free (buf); |
1199 | } | 1202 | } |
1200 | 1203 | ||
1204 | |||
1201 | /** | 1205 | /** |
1202 | * Add a new attestation | 1206 | * Add a new attestation |
1203 | * | 1207 | * |
@@ -1210,11 +1214,10 @@ attest_store_task (void *cls) | |||
1210 | char *label; | 1214 | char *label; |
1211 | 1215 | ||
1212 | // Give the ash a new id if unset | 1216 | // Give the ash a new id if unset |
1213 | if (0 == ash->attest->id) | 1217 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->attest->id)) |
1214 | ash->attest->id | 1218 | GNUNET_RECLAIM_id_generate (&ash->attest->id); |
1215 | = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | ||
1216 | label = GNUNET_STRINGS_data_to_string_alloc (&ash->attest->id, | 1219 | label = GNUNET_STRINGS_data_to_string_alloc (&ash->attest->id, |
1217 | sizeof(uint64_t)); | 1220 | sizeof (ash->attest->id)); |
1218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1221 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1219 | "Looking up existing data under label %s\n", label); | 1222 | "Looking up existing data under label %s\n", label); |
1220 | // Test for the content of the existing ID | 1223 | // Test for the content of the existing ID |
@@ -1228,6 +1231,7 @@ attest_store_task (void *cls) | |||
1228 | GNUNET_free (label); | 1231 | GNUNET_free (label); |
1229 | } | 1232 | } |
1230 | 1233 | ||
1234 | |||
1231 | /** | 1235 | /** |
1232 | * Check an attestation store message | 1236 | * Check an attestation store message |
1233 | * | 1237 | * |
@@ -1249,6 +1253,7 @@ check_attestation_store_message (void *cls, | |||
1249 | return GNUNET_OK; | 1253 | return GNUNET_OK; |
1250 | } | 1254 | } |
1251 | 1255 | ||
1256 | |||
1252 | /** | 1257 | /** |
1253 | * Handle an attestation store message | 1258 | * Handle an attestation store message |
1254 | * | 1259 | * |
@@ -1282,6 +1287,7 @@ handle_attestation_store_message (void *cls, | |||
1282 | GNUNET_SCHEDULER_add_now (&attest_store_task, ash); | 1287 | GNUNET_SCHEDULER_add_now (&attest_store_task, ash); |
1283 | } | 1288 | } |
1284 | 1289 | ||
1290 | |||
1285 | /** | 1291 | /** |
1286 | * Error looking up potential reference value. Abort. | 1292 | * Error looking up potential reference value. Abort. |
1287 | * | 1293 | * |
@@ -1298,6 +1304,7 @@ ref_error (void *cls) | |||
1298 | return; | 1304 | return; |
1299 | } | 1305 | } |
1300 | 1306 | ||
1307 | |||
1301 | /** | 1308 | /** |
1302 | * Error looking up potential reference value. Abort. | 1309 | * Error looking up potential reference value. Abort. |
1303 | * | 1310 | * |
@@ -1313,6 +1320,8 @@ ref_del_error (void *cls) | |||
1313 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 1320 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
1314 | return; | 1321 | return; |
1315 | } | 1322 | } |
1323 | |||
1324 | |||
1316 | /** | 1325 | /** |
1317 | * Reference store result handler | 1326 | * Reference store result handler |
1318 | * | 1327 | * |
@@ -1375,7 +1384,7 @@ ref_add_cb (void *cls, | |||
1375 | GNUNET_RECLAIM_ATTESTATION_REF_serialize (ash->reference, buf); | 1384 | GNUNET_RECLAIM_ATTESTATION_REF_serialize (ash->reference, buf); |
1376 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref; | 1385 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref; |
1377 | char *data_tmp; | 1386 | char *data_tmp; |
1378 | if (0 == rd_count ) | 1387 | if (0 == rd_count) |
1379 | { | 1388 | { |
1380 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1389 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1381 | "Failed to find Attestation entry for Attestation reference\n"); | 1390 | "Failed to find Attestation entry for Attestation reference\n"); |
@@ -1398,7 +1407,7 @@ ref_add_cb (void *cls, | |||
1398 | ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize (data_tmp, htons ( | 1407 | ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize (data_tmp, htons ( |
1399 | rd[i].data_size)); | 1408 | rd[i].data_size)); |
1400 | rd_new[i] = rd[i]; | 1409 | rd_new[i] = rd[i]; |
1401 | if ((strcmp (ash->reference->name,ref->name) == 0)&& | 1410 | if ((strcmp (ash->reference->name,ref->name) == 0) && |
1402 | (strcmp (ash->reference->reference_value,ref->reference_value)==0) ) | 1411 | (strcmp (ash->reference->reference_value,ref->reference_value)==0) ) |
1403 | { | 1412 | { |
1404 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1413 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1423,6 +1432,7 @@ ref_add_cb (void *cls, | |||
1423 | GNUNET_free (buf); | 1432 | GNUNET_free (buf); |
1424 | } | 1433 | } |
1425 | 1434 | ||
1435 | |||
1426 | /** | 1436 | /** |
1427 | * Add a new reference | 1437 | * Add a new reference |
1428 | * | 1438 | * |
@@ -1437,13 +1447,11 @@ reference_store_task (void *cls) | |||
1437 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing reference\n"); | 1447 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing reference\n"); |
1438 | 1448 | ||
1439 | // Give the ash a new id if unset | 1449 | // Give the ash a new id if unset |
1440 | if (0 == ash->reference->id) | 1450 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->reference->id)) |
1441 | { | 1451 | { |
1442 | if (0 == ash->reference->id_attest) | 1452 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->reference->id_attest)) |
1443 | { | 1453 | { |
1444 | ash->reference->id = GNUNET_CRYPTO_random_u64 ( | 1454 | GNUNET_RECLAIM_id_generate (&ash->reference->id); |
1445 | GNUNET_CRYPTO_QUALITY_STRONG, | ||
1446 | UINT64_MAX); | ||
1447 | } | 1455 | } |
1448 | else | 1456 | else |
1449 | { | 1457 | { |
@@ -1452,7 +1460,7 @@ reference_store_task (void *cls) | |||
1452 | } | 1460 | } |
1453 | 1461 | ||
1454 | label = GNUNET_STRINGS_data_to_string_alloc (&ash->reference->id, | 1462 | label = GNUNET_STRINGS_data_to_string_alloc (&ash->reference->id, |
1455 | sizeof(uint64_t)); | 1463 | sizeof (ash->reference->id)); |
1456 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1464 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1457 | "Looking up existing data under label %s\n", label); | 1465 | "Looking up existing data under label %s\n", label); |
1458 | // Test for the content of the existing ID | 1466 | // Test for the content of the existing ID |
@@ -1467,6 +1475,7 @@ reference_store_task (void *cls) | |||
1467 | GNUNET_free (label); | 1475 | GNUNET_free (label); |
1468 | } | 1476 | } |
1469 | 1477 | ||
1478 | |||
1470 | /** | 1479 | /** |
1471 | * Check an attestation reference store message | 1480 | * Check an attestation reference store message |
1472 | * | 1481 | * |
@@ -1521,6 +1530,8 @@ handle_reference_store_message (void *cls, | |||
1521 | GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash); | 1530 | GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash); |
1522 | GNUNET_SCHEDULER_add_now (&reference_store_task, ash); | 1531 | GNUNET_SCHEDULER_add_now (&reference_store_task, ash); |
1523 | } | 1532 | } |
1533 | |||
1534 | |||
1524 | /** | 1535 | /** |
1525 | * Send a deletion success response | 1536 | * Send a deletion success response |
1526 | * | 1537 | * |
@@ -1570,13 +1581,16 @@ ticket_iter (void *cls, | |||
1570 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) | 1581 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) |
1571 | continue; | 1582 | continue; |
1572 | if (adh->claim != NULL) | 1583 | if (adh->claim != NULL) |
1573 | if (0 != memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t))) | 1584 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1585 | &adh->claim->id)) | ||
1574 | continue; | 1586 | continue; |
1575 | if (adh->attest != NULL) | 1587 | if (adh->attest != NULL) |
1576 | if (0 != memcmp (rd[i].data, &adh->attest->id, sizeof(uint64_t))) | 1588 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1589 | &adh->attest->id)) | ||
1577 | continue; | 1590 | continue; |
1578 | if (adh->reference != NULL) | 1591 | if (adh->reference != NULL) |
1579 | if (0 != memcmp (rd[i].data, &adh->reference->id, sizeof(uint64_t))) | 1592 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1593 | &adh->reference->id)) | ||
1580 | continue; | 1594 | continue; |
1581 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1595 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1582 | "Attribute or Attestation/Reference to delete found (%s)\n", | 1596 | "Attribute or Attestation/Reference to delete found (%s)\n", |
@@ -1671,15 +1685,18 @@ update_tickets (void *cls) | |||
1671 | { | 1685 | { |
1672 | if (adh->claim != NULL) | 1686 | if (adh->claim != NULL) |
1673 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) | 1687 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) |
1674 | && (0 == memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t)))) | 1688 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1689 | &adh->claim->id))) | ||
1675 | continue; | 1690 | continue; |
1676 | if (adh->attest != NULL) | 1691 | if (adh->attest != NULL) |
1677 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) | 1692 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) |
1678 | && (0 == memcmp (rd[i].data, &adh->attest->id, sizeof(uint64_t)))) | 1693 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1694 | &adh->attest->id))) | ||
1679 | continue; | 1695 | continue; |
1680 | if (adh->reference != NULL) | 1696 | if (adh->reference != NULL) |
1681 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) | 1697 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) |
1682 | && (0 == memcmp (rd[i].data, &adh->reference->id, sizeof(uint64_t)))) | 1698 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1699 | &adh->reference->id))) | ||
1683 | continue; | 1700 | continue; |
1684 | rd_new[j] = rd[i]; | 1701 | rd_new[j] = rd[i]; |
1685 | j++; | 1702 | j++; |
@@ -1828,7 +1845,8 @@ handle_attribute_delete_message (void *cls, | |||
1828 | adh->r_id = ntohl (dam->id); | 1845 | adh->r_id = ntohl (dam->id); |
1829 | adh->identity = dam->identity; | 1846 | adh->identity = dam->identity; |
1830 | adh->label | 1847 | adh->label |
1831 | = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id, sizeof(uint64_t)); | 1848 | = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id, |
1849 | sizeof(adh->claim->id)); | ||
1832 | GNUNET_SERVICE_client_continue (idp->client); | 1850 | GNUNET_SERVICE_client_continue (idp->client); |
1833 | adh->client = idp; | 1851 | adh->client = idp; |
1834 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); | 1852 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); |
@@ -1841,6 +1859,7 @@ handle_attribute_delete_message (void *cls, | |||
1841 | adh); | 1859 | adh); |
1842 | } | 1860 | } |
1843 | 1861 | ||
1862 | |||
1844 | /** | 1863 | /** |
1845 | * Attestation deleted callback | 1864 | * Attestation deleted callback |
1846 | * | 1865 | * |
@@ -1867,6 +1886,7 @@ attest_delete_cont (void *cls, int32_t success, const char *emsg) | |||
1867 | GNUNET_SCHEDULER_add_now (&start_ticket_update, adh); | 1886 | GNUNET_SCHEDULER_add_now (&start_ticket_update, adh); |
1868 | } | 1887 | } |
1869 | 1888 | ||
1889 | |||
1870 | /** | 1890 | /** |
1871 | * Check attestation delete message format | 1891 | * Check attestation delete message format |
1872 | * | 1892 | * |
@@ -1916,7 +1936,8 @@ handle_attestation_delete_message (void *cls, | |||
1916 | adh->r_id = ntohl (dam->id); | 1936 | adh->r_id = ntohl (dam->id); |
1917 | adh->identity = dam->identity; | 1937 | adh->identity = dam->identity; |
1918 | adh->label | 1938 | adh->label |
1919 | = GNUNET_STRINGS_data_to_string_alloc (&adh->attest->id, sizeof(uint64_t)); | 1939 | = GNUNET_STRINGS_data_to_string_alloc (&adh->attest->id, |
1940 | sizeof(adh->attest->id)); | ||
1920 | GNUNET_SERVICE_client_continue (idp->client); | 1941 | GNUNET_SERVICE_client_continue (idp->client); |
1921 | adh->client = idp; | 1942 | adh->client = idp; |
1922 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); | 1943 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); |
@@ -1930,7 +1951,6 @@ handle_attestation_delete_message (void *cls, | |||
1930 | } | 1951 | } |
1931 | 1952 | ||
1932 | 1953 | ||
1933 | |||
1934 | /** | 1954 | /** |
1935 | * Reference deleted callback | 1955 | * Reference deleted callback |
1936 | * | 1956 | * |
@@ -1954,12 +1974,13 @@ reference_delete_cont (void *cls, int32_t success, const char *emsg) | |||
1954 | return; | 1974 | return; |
1955 | } | 1975 | } |
1956 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n"); | 1976 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n"); |
1957 | //GNUNET_SCHEDULER_add_now (&start_ticket_update, adh); | 1977 | // GNUNET_SCHEDULER_add_now (&start_ticket_update, adh); |
1958 | send_delete_response (adh, GNUNET_OK); | 1978 | send_delete_response (adh, GNUNET_OK); |
1959 | cleanup_adh (adh); | 1979 | cleanup_adh (adh); |
1960 | return; | 1980 | return; |
1961 | } | 1981 | } |
1962 | 1982 | ||
1983 | |||
1963 | static void | 1984 | static void |
1964 | ref_del_cb (void *cls, | 1985 | ref_del_cb (void *cls, |
1965 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 1986 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
@@ -1974,7 +1995,7 @@ ref_del_cb (void *cls, | |||
1974 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref; | 1995 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref; |
1975 | size_t attr_len; | 1996 | size_t attr_len; |
1976 | 1997 | ||
1977 | if (0 == rd_count ) | 1998 | if (0 == rd_count) |
1978 | { | 1999 | { |
1979 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 2000 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1980 | "Failed to find Attestation entry for Attestation reference\n"); | 2001 | "Failed to find Attestation entry for Attestation reference\n"); |
@@ -1999,7 +2020,7 @@ ref_del_cb (void *cls, | |||
1999 | GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size); | 2020 | GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size); |
2000 | attr_len = htons (rd[i].data_size); | 2021 | attr_len = htons (rd[i].data_size); |
2001 | ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize (data_tmp, attr_len); | 2022 | ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize (data_tmp, attr_len); |
2002 | if (NULL == ref ) | 2023 | if (NULL == ref) |
2003 | { | 2024 | { |
2004 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 2025 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2005 | "Unable to parse attestation reference from %s\n", | 2026 | "Unable to parse attestation reference from %s\n", |
@@ -2008,7 +2029,7 @@ ref_del_cb (void *cls, | |||
2008 | j += 1; | 2029 | j += 1; |
2009 | continue; | 2030 | continue; |
2010 | } | 2031 | } |
2011 | if ((strcmp (adh->reference->name,ref->name) == 0)&& | 2032 | if ((strcmp (adh->reference->name,ref->name) == 0) && |
2012 | (strcmp (adh->reference->reference_value,ref->reference_value)==0) ) | 2033 | (strcmp (adh->reference->reference_value,ref->reference_value)==0) ) |
2013 | { | 2034 | { |
2014 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2035 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2030,6 +2051,7 @@ ref_del_cb (void *cls, | |||
2030 | adh); | 2051 | adh); |
2031 | } | 2052 | } |
2032 | 2053 | ||
2054 | |||
2033 | /** | 2055 | /** |
2034 | * Check an attestation reference delete message | 2056 | * Check an attestation reference delete message |
2035 | * | 2057 | * |
@@ -2051,6 +2073,7 @@ check_reference_delete_message (void *cls, | |||
2051 | return GNUNET_OK; | 2073 | return GNUNET_OK; |
2052 | } | 2074 | } |
2053 | 2075 | ||
2076 | |||
2054 | /** | 2077 | /** |
2055 | * Handle reference deletion | 2078 | * Handle reference deletion |
2056 | * | 2079 | * |
@@ -2077,7 +2100,7 @@ handle_reference_delete_message (void *cls, | |||
2077 | adh->identity = dam->identity; | 2100 | adh->identity = dam->identity; |
2078 | adh->label | 2101 | adh->label |
2079 | = GNUNET_STRINGS_data_to_string_alloc (&adh->reference->id, | 2102 | = GNUNET_STRINGS_data_to_string_alloc (&adh->reference->id, |
2080 | sizeof(uint64_t)); | 2103 | sizeof(adh->reference->id)); |
2081 | GNUNET_SERVICE_client_continue (idp->client); | 2104 | GNUNET_SERVICE_client_continue (idp->client); |
2082 | adh->client = idp; | 2105 | adh->client = idp; |
2083 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); | 2106 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); |
@@ -2091,7 +2114,6 @@ handle_reference_delete_message (void *cls, | |||
2091 | } | 2114 | } |
2092 | 2115 | ||
2093 | 2116 | ||
2094 | |||
2095 | /************************************************* | 2117 | /************************************************* |
2096 | * Attrubute iteration | 2118 | * Attrubute iteration |
2097 | *************************************************/ | 2119 | *************************************************/ |
@@ -2190,7 +2212,7 @@ attr_iter_cb (void *cls, | |||
2190 | return; | 2212 | return; |
2191 | } | 2213 | } |
2192 | 2214 | ||
2193 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type ) | 2215 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type) |
2194 | { | 2216 | { |
2195 | struct AttributeResultMessage *arm; | 2217 | struct AttributeResultMessage *arm; |
2196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", | 2218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", |
@@ -2209,7 +2231,7 @@ attr_iter_cb (void *cls, | |||
2209 | } | 2231 | } |
2210 | else | 2232 | else |
2211 | { | 2233 | { |
2212 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type ) | 2234 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type) |
2213 | { | 2235 | { |
2214 | struct AttributeResultMessage *arm; | 2236 | struct AttributeResultMessage *arm; |
2215 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n", | 2237 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n", |
@@ -2250,6 +2272,7 @@ attr_iter_cb (void *cls, | |||
2250 | } | 2272 | } |
2251 | } | 2273 | } |
2252 | 2274 | ||
2275 | |||
2253 | /** | 2276 | /** |
2254 | * Iterate over zone to get attributes | 2277 | * Iterate over zone to get attributes |
2255 | * | 2278 | * |
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c index b022225b8..bdb9e6dd9 100644 --- a/src/reclaim/gnunet-service-reclaim_tickets.c +++ b/src/reclaim/gnunet-service-reclaim_tickets.c | |||
@@ -236,12 +236,12 @@ struct RevokedAttributeEntry | |||
236 | /** | 236 | /** |
237 | * Old ID of the attribute | 237 | * Old ID of the attribute |
238 | */ | 238 | */ |
239 | uint64_t old_id; | 239 | struct GNUNET_RECLAIM_Identifier old_id; |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * New ID of the attribute | 242 | * New ID of the attribute |
243 | */ | 243 | */ |
244 | uint64_t new_id; | 244 | struct GNUNET_RECLAIM_Identifier new_id; |
245 | }; | 245 | }; |
246 | 246 | ||
247 | 247 | ||
@@ -435,7 +435,7 @@ process_tickets (void *cls) | |||
435 | continue; | 435 | continue; |
436 | for (ae = rvk->attrs_head; NULL != ae; ae = ae->next) | 436 | for (ae = rvk->attrs_head; NULL != ae; ae = ae->next) |
437 | { | 437 | { |
438 | if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(uint64_t))) | 438 | if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id))) |
439 | continue; | 439 | continue; |
440 | rd[i].data = &ae->new_id; | 440 | rd[i].data = &ae->new_id; |
441 | } | 441 | } |
@@ -497,7 +497,7 @@ rvk_ticket_update (void *cls, | |||
497 | continue; | 497 | continue; |
498 | for (ae = rvk->attrs_head; NULL != ae; ae = ae->next) | 498 | for (ae = rvk->attrs_head; NULL != ae; ae = ae->next) |
499 | { | 499 | { |
500 | if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(uint64_t))) | 500 | if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id))) |
501 | continue; | 501 | continue; |
502 | has_changed = GNUNET_YES; | 502 | has_changed = GNUNET_YES; |
503 | break; | 503 | break; |
@@ -532,9 +532,6 @@ rvk_ns_iter_err (void *cls) | |||
532 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; | 532 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; |
533 | 533 | ||
534 | rvk->ns_it = NULL; | 534 | rvk->ns_it = NULL; |
535 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
536 | "Namestore error on revocation (id=%" PRIu64 "\n", | ||
537 | rvk->move_attr->old_id); | ||
538 | rvk->cb (rvk->cb_cls, GNUNET_SYSERR); | 535 | rvk->cb (rvk->cb_cls, GNUNET_SYSERR); |
539 | cleanup_rvk (rvk); | 536 | cleanup_rvk (rvk); |
540 | } | 537 | } |
@@ -551,9 +548,6 @@ rvk_ns_err (void *cls) | |||
551 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; | 548 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; |
552 | 549 | ||
553 | rvk->ns_qe = NULL; | 550 | rvk->ns_qe = NULL; |
554 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
555 | "Namestore error on revocation (id=%" PRIu64 "\n", | ||
556 | rvk->move_attr->old_id); | ||
557 | rvk->cb (rvk->cb_cls, GNUNET_SYSERR); | 551 | rvk->cb (rvk->cb_cls, GNUNET_SYSERR); |
558 | cleanup_rvk (rvk); | 552 | cleanup_rvk (rvk); |
559 | } | 553 | } |
@@ -636,7 +630,7 @@ move_attr_finished (void *cls, int32_t success, const char *emsg) | |||
636 | return; | 630 | return; |
637 | } | 631 | } |
638 | label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id, | 632 | label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id, |
639 | sizeof(uint64_t)); | 633 | sizeof(rvk->move_attr->old_id)); |
640 | GNUNET_assert (NULL != label); | 634 | GNUNET_assert (NULL != label); |
641 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label); | 635 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label); |
642 | rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, | 636 | rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, |
@@ -685,67 +679,80 @@ rvk_move_attr_cb (void *cls, | |||
685 | GNUNET_SCHEDULER_add_now (&move_attrs_cont, rvk); | 679 | GNUNET_SCHEDULER_add_now (&move_attrs_cont, rvk); |
686 | return; | 680 | return; |
687 | } | 681 | } |
688 | rvk->move_attr->new_id =GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | 682 | GNUNET_RECLAIM_id_generate (&rvk->move_attr->new_id); |
689 | new_label=NULL; | 683 | new_label = NULL; |
690 | attr_data=NULL; | 684 | attr_data = NULL; |
691 | //new_rd = *rd; | 685 | // new_rd = *rd; |
692 | for (int i = 0; i < rd_count; i++) | 686 | for (int i = 0; i < rd_count; i++) |
693 | { | 687 | { |
694 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type) | 688 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type) |
695 | { | 689 | { |
696 | /** find a new place for this attribute **/ | 690 | /** find a new place for this attribute **/ |
697 | struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim; | 691 | struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim; |
698 | claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd[i].data, rd[i].data_size); | 692 | claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd[i].data, |
693 | rd[i].data_size); | ||
699 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 694 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
700 | "Attribute to update: Name=%s, ID=%" PRIu64 "\n", | 695 | "Attribute to update: Name=%s\n", |
701 | claim->name, | 696 | claim->name); |
702 | claim->id); | ||
703 | claim->id = rvk->move_attr->new_id; | 697 | claim->id = rvk->move_attr->new_id; |
704 | new_rd[i].data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (claim); | 698 | new_rd[i].data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (claim); |
705 | attr_data = GNUNET_malloc (rd[i].data_size); | 699 | attr_data = GNUNET_malloc (rd[i].data_size); |
706 | new_rd[i].data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize (claim, attr_data); | 700 | new_rd[i].data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize (claim, |
701 | attr_data); | ||
707 | new_rd[i].data = attr_data; | 702 | new_rd[i].data = attr_data; |
708 | new_rd[i].record_type = rd[i].record_type; | 703 | new_rd[i].record_type = rd[i].record_type; |
709 | new_rd[i].flags = rd[i].flags; | 704 | new_rd[i].flags = rd[i].flags; |
710 | new_rd[i].expiration_time = rd[i].expiration_time; | 705 | new_rd[i].expiration_time = rd[i].expiration_time; |
711 | new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, | 706 | new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, |
712 | sizeof(uint64_t)); | 707 | sizeof (rvk->move_attr-> |
708 | new_id)); | ||
713 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label); | 709 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label); |
714 | GNUNET_free (claim); | 710 | GNUNET_free (claim); |
715 | } else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type) | 711 | } |
712 | else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type) | ||
716 | { | 713 | { |
717 | struct GNUNET_RECLAIM_ATTESTATION_Claim *attest; | 714 | struct GNUNET_RECLAIM_ATTESTATION_Claim *attest; |
718 | attest=GNUNET_RECLAIM_ATTESTATION_deserialize(rd[i].data, rd[i].data_size); | 715 | attest = GNUNET_RECLAIM_ATTESTATION_deserialize (rd[i].data, |
716 | rd[i].data_size); | ||
719 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 717 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
720 | "Attestation to update: Name=%s, ID=%" PRIu64 "\n", | 718 | "Attestation to update: Name=%s\n", |
721 | attest->name, | 719 | attest->name); |
722 | attest->id); | ||
723 | attest->id = rvk->move_attr->new_id; | 720 | attest->id = rvk->move_attr->new_id; |
724 | new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (attest); | 721 | new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_serialize_get_size ( |
722 | attest); | ||
725 | attr_data = GNUNET_malloc (rd[i].data_size); | 723 | attr_data = GNUNET_malloc (rd[i].data_size); |
726 | new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_serialize (attest, attr_data); | 724 | new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_serialize (attest, |
725 | attr_data); | ||
727 | new_rd[i].data = attr_data; | 726 | new_rd[i].data = attr_data; |
728 | new_rd[i].record_type = rd[i].record_type; | 727 | new_rd[i].record_type = rd[i].record_type; |
729 | new_rd[i].flags = rd[i].flags; | 728 | new_rd[i].flags = rd[i].flags; |
730 | new_rd[i].expiration_time = rd[i].expiration_time; | 729 | new_rd[i].expiration_time = rd[i].expiration_time; |
731 | new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, sizeof(uint64_t)); | 730 | new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, |
732 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation %s\n", new_label); | 731 | sizeof (rvk->move_attr-> |
732 | new_id)); | ||
733 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation %s\n", | ||
734 | new_label); | ||
733 | GNUNET_free (attest); | 735 | GNUNET_free (attest); |
734 | } else if (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE == rd[i].record_type) | 736 | } |
737 | else if (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE == rd[i].record_type) | ||
735 | { | 738 | { |
736 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference; | 739 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference; |
737 | reference=GNUNET_RECLAIM_ATTESTATION_REF_deserialize(rd[i].data, rd[i].data_size); | 740 | reference = GNUNET_RECLAIM_ATTESTATION_REF_deserialize (rd[i].data, |
741 | rd[i].data_size); | ||
738 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 742 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
739 | "Reference to update: Name=%s, ID=%" PRIu64 "\n", | 743 | "Reference to update: Name=%s\n", |
740 | reference->name, | 744 | reference->name); |
741 | reference->id); | ||
742 | reference->id = rvk->move_attr->new_id; | 745 | reference->id = rvk->move_attr->new_id; |
743 | reference->id_attest = rvk->move_attr->new_id; | 746 | reference->id_attest = rvk->move_attr->new_id; |
744 | new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (reference); | 747 | new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size ( |
748 | reference); | ||
745 | attr_data = GNUNET_malloc (rd[i].data_size); | 749 | attr_data = GNUNET_malloc (rd[i].data_size); |
746 | new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_REF_serialize (reference, attr_data); | 750 | new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_REF_serialize (reference, |
751 | attr_data); | ||
747 | new_rd[i].data = attr_data; | 752 | new_rd[i].data = attr_data; |
748 | new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, sizeof(uint64_t)); | 753 | new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, |
754 | sizeof (rvk->move_attr-> | ||
755 | new_id)); | ||
749 | new_rd[i].record_type = rd[i].record_type; | 756 | new_rd[i].record_type = rd[i].record_type; |
750 | new_rd[i].flags = rd[i].flags; | 757 | new_rd[i].flags = rd[i].flags; |
751 | new_rd[i].expiration_time = rd[i].expiration_time; | 758 | new_rd[i].expiration_time = rd[i].expiration_time; |
@@ -754,12 +761,12 @@ rvk_move_attr_cb (void *cls, | |||
754 | } | 761 | } |
755 | } | 762 | } |
756 | rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, | 763 | rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, |
757 | &rvk->identity, | 764 | &rvk->identity, |
758 | new_label, | 765 | new_label, |
759 | rd_count, | 766 | rd_count, |
760 | new_rd, | 767 | new_rd, |
761 | &move_attr_finished, | 768 | &move_attr_finished, |
762 | rvk); | 769 | rvk); |
763 | GNUNET_free (new_label); | 770 | GNUNET_free (new_label); |
764 | GNUNET_free (attr_data); | 771 | GNUNET_free (attr_data); |
765 | } | 772 | } |
@@ -793,7 +800,7 @@ move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rvk) | |||
793 | return; | 800 | return; |
794 | } | 801 | } |
795 | label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id, | 802 | label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id, |
796 | sizeof(uint64_t)); | 803 | sizeof (rvk->move_attr->old_id)); |
797 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving claim %s\n", label); | 804 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving claim %s\n", label); |
798 | 805 | ||
799 | rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, | 806 | rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, |
@@ -876,7 +883,7 @@ revoke_attrs_cb (void *cls, | |||
876 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) | 883 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) |
877 | continue; | 884 | continue; |
878 | le = GNUNET_new (struct RevokedAttributeEntry); | 885 | le = GNUNET_new (struct RevokedAttributeEntry); |
879 | le->old_id = *((uint64_t *) rd[i].data); | 886 | le->old_id = *((struct GNUNET_RECLAIM_Identifier *) rd[i].data); |
880 | GNUNET_CONTAINER_DLL_insert (rvk->attrs_head, rvk->attrs_tail, le); | 887 | GNUNET_CONTAINER_DLL_insert (rvk->attrs_head, rvk->attrs_tail, le); |
881 | rvk->ticket_attrs++; | 888 | rvk->ticket_attrs++; |
882 | } | 889 | } |
@@ -934,7 +941,8 @@ RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket, | |||
934 | rvk->ticket = *ticket; | 941 | rvk->ticket = *ticket; |
935 | GNUNET_CRYPTO_ecdsa_key_get_public (&rvk->identity, &rvk->ticket.identity); | 942 | GNUNET_CRYPTO_ecdsa_key_get_public (&rvk->identity, &rvk->ticket.identity); |
936 | /** Get shared attributes **/ | 943 | /** Get shared attributes **/ |
937 | label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t)); | 944 | label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, |
945 | sizeof(ticket->rnd)); | ||
938 | GNUNET_assert (NULL != label); | 946 | GNUNET_assert (NULL != label); |
939 | rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, | 947 | rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, |
940 | identity, | 948 | identity, |
@@ -1231,7 +1239,8 @@ RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id, | |||
1231 | cth->cb = cb; | 1239 | cth->cb = cb; |
1232 | cth->cb_cls = cb_cls; | 1240 | cth->cb_cls = cb_cls; |
1233 | label = | 1241 | label = |
1234 | GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, sizeof(uint64_t)); | 1242 | GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, |
1243 | sizeof(cth->ticket.rnd)); | ||
1235 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1244 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1236 | "Looking for AuthZ info under %s\n", | 1245 | "Looking for AuthZ info under %s\n", |
1237 | label); | 1246 | label); |
@@ -1393,7 +1402,8 @@ issue_ticket (struct TicketIssueHandle *ih) | |||
1393 | GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE; | 1402 | GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE; |
1394 | 1403 | ||
1395 | label = | 1404 | label = |
1396 | GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof(uint64_t)); | 1405 | GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, |
1406 | sizeof(ih->ticket.rnd)); | ||
1397 | // Publish record | 1407 | // Publish record |
1398 | ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh, | 1408 | ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh, |
1399 | &ih->identity, | 1409 | &ih->identity, |
@@ -1488,29 +1498,21 @@ filter_tickets_cb (void *cls, | |||
1488 | // cmp attr_ref id with requested attr id | 1498 | // cmp attr_ref id with requested attr id |
1489 | if (NULL !=le->claim) | 1499 | if (NULL !=le->claim) |
1490 | { | 1500 | { |
1491 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1501 | if (0 == memcmp (rd[i].data, &le->claim->id, sizeof(le->claim->id))) |
1492 | " %" PRIu64 "\n %" PRIu64 "\n", | ||
1493 | *((uint64_t *) rd[i].data), | ||
1494 | le->claim->id); | ||
1495 | if (0 == memcmp (rd[i].data, &le->claim->id, sizeof(uint64_t))) | ||
1496 | found_attrs_cnt++; | 1502 | found_attrs_cnt++; |
1497 | } | 1503 | } |
1498 | else if (NULL !=le->attest) | 1504 | else if (NULL !=le->attest) |
1499 | { | 1505 | { |
1500 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1506 | if (0 == memcmp (rd[i].data, |
1501 | " %" PRIu64 "\n %" PRIu64 "\n", | 1507 | &le->attest->id, |
1502 | *((uint64_t *) rd[i].data), | 1508 | sizeof(le->attest->id))) |
1503 | le->attest->id); | ||
1504 | if (0 == memcmp (rd[i].data, &le->attest->id, sizeof(uint64_t))) | ||
1505 | found_attrs_cnt++; | 1509 | found_attrs_cnt++; |
1506 | } | 1510 | } |
1507 | else if (NULL != le->reference) | 1511 | else if (NULL != le->reference) |
1508 | { | 1512 | { |
1509 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1513 | if (0 == memcmp (rd[i].data, |
1510 | " %" PRIu64 "\n %" PRIu64 "\n", | 1514 | &le->reference->id, |
1511 | *((uint64_t *) rd[i].data), | 1515 | sizeof(le->reference->id))) |
1512 | le->reference->id); | ||
1513 | if (0 == memcmp (rd[i].data, &le->reference->id, sizeof(uint64_t))) | ||
1514 | found_attrs_cnt++; | 1516 | found_attrs_cnt++; |
1515 | } | 1517 | } |
1516 | 1518 | ||
@@ -1547,8 +1549,7 @@ filter_tickets_finished_cb (void *cls) | |||
1547 | struct TicketIssueHandle *tih = cls; | 1549 | struct TicketIssueHandle *tih = cls; |
1548 | 1550 | ||
1549 | GNUNET_CRYPTO_ecdsa_key_get_public (&tih->identity, &tih->ticket.identity); | 1551 | GNUNET_CRYPTO_ecdsa_key_get_public (&tih->identity, &tih->ticket.identity); |
1550 | tih->ticket.rnd = | 1552 | GNUNET_RECLAIM_id_generate (&tih->ticket.rnd); |
1551 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | ||
1552 | issue_ticket (tih); | 1553 | issue_ticket (tih); |
1553 | } | 1554 | } |
1554 | 1555 | ||
diff --git a/src/reclaim/json_reclaim.c b/src/reclaim/json_reclaim.c index a464a9088..6ac60a704 100644 --- a/src/reclaim/json_reclaim.c +++ b/src/reclaim/json_reclaim.c | |||
@@ -94,12 +94,12 @@ parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
94 | } | 94 | } |
95 | attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (name_str, type, data, data_size); | 95 | attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (name_str, type, data, data_size); |
96 | if ((NULL == id_str) || (0 == strlen (id_str))) | 96 | if ((NULL == id_str) || (0 == strlen (id_str))) |
97 | attr->id = 0; | 97 | memset (&attr->id, 0, sizeof (attr->id)); |
98 | else | 98 | else |
99 | GNUNET_STRINGS_string_to_data (id_str, | 99 | GNUNET_STRINGS_string_to_data (id_str, |
100 | strlen (id_str), | 100 | strlen (id_str), |
101 | &attr->id, | 101 | &attr->id, |
102 | sizeof(uint64_t)); | 102 | sizeof(attr->id)); |
103 | 103 | ||
104 | *(struct GNUNET_RECLAIM_ATTRIBUTE_Claim **) spec->ptr = attr; | 104 | *(struct GNUNET_RECLAIM_ATTRIBUTE_Claim **) spec->ptr = attr; |
105 | return GNUNET_OK; | 105 | return GNUNET_OK; |
@@ -192,7 +192,7 @@ parse_ticket (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
192 | if (GNUNET_OK != GNUNET_STRINGS_string_to_data (rnd_str, | 192 | if (GNUNET_OK != GNUNET_STRINGS_string_to_data (rnd_str, |
193 | strlen (rnd_str), | 193 | strlen (rnd_str), |
194 | &ticket->rnd, | 194 | &ticket->rnd, |
195 | sizeof(uint64_t))) | 195 | sizeof(ticket->rnd))) |
196 | { | 196 | { |
197 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Rnd invalid\n"); | 197 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Rnd invalid\n"); |
198 | GNUNET_free (ticket); | 198 | GNUNET_free (ticket); |
@@ -327,12 +327,12 @@ parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
327 | } | 327 | } |
328 | attr = GNUNET_RECLAIM_ATTESTATION_claim_new (name_str, type, data, data_size); | 328 | attr = GNUNET_RECLAIM_ATTESTATION_claim_new (name_str, type, data, data_size); |
329 | if ((NULL == id_str) || (0 == strlen (id_str))) | 329 | if ((NULL == id_str) || (0 == strlen (id_str))) |
330 | attr->id = 0; | 330 | memset (&attr->id, 0, sizeof (attr->id)); |
331 | else | 331 | else |
332 | GNUNET_STRINGS_string_to_data (id_str, | 332 | GNUNET_STRINGS_string_to_data (id_str, |
333 | strlen (id_str), | 333 | strlen (id_str), |
334 | &attr->id, | 334 | &attr->id, |
335 | sizeof(uint64_t)); | 335 | sizeof(attr->id)); |
336 | 336 | ||
337 | *(struct GNUNET_RECLAIM_ATTESTATION_Claim **) spec->ptr = attr; | 337 | *(struct GNUNET_RECLAIM_ATTESTATION_Claim **) spec->ptr = attr; |
338 | return GNUNET_OK; | 338 | return GNUNET_OK; |
@@ -425,16 +425,15 @@ parse_attest_ref (void *cls, json_t *root, struct | |||
425 | } | 425 | } |
426 | 426 | ||
427 | attr = GNUNET_RECLAIM_ATTESTATION_reference_new (name_str, ref_val_str); | 427 | attr = GNUNET_RECLAIM_ATTESTATION_reference_new (name_str, ref_val_str); |
428 | 428 | memset (&attr->id, 0, sizeof (attr->id)); | |
429 | attr->id = 0; | ||
430 | 429 | ||
431 | if ((NULL == ref_id_str) || (0 == strlen (ref_id_str))) | 430 | if ((NULL == ref_id_str) || (0 == strlen (ref_id_str))) |
432 | attr->id_attest = 0; | 431 | memset (&attr->id_attest, 0, sizeof (attr->id_attest)); |
433 | else | 432 | else |
434 | GNUNET_STRINGS_string_to_data (ref_id_str, | 433 | GNUNET_STRINGS_string_to_data (ref_id_str, |
435 | strlen (ref_id_str), | 434 | strlen (ref_id_str), |
436 | &attr->id_attest, | 435 | &attr->id_attest, |
437 | sizeof(uint64_t)); | 436 | sizeof(attr->id_attest)); |
438 | 437 | ||
439 | *(struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **) spec->ptr = attr; | 438 | *(struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **) spec->ptr = attr; |
440 | return GNUNET_OK; | 439 | return GNUNET_OK; |
@@ -480,4 +479,4 @@ GNUNET_RECLAIM_JSON_spec_claim_attest_ref (struct | |||
480 | 479 | ||
481 | *attr = NULL; | 480 | *attr = NULL; |
482 | return ret; | 481 | return ret; |
483 | } \ No newline at end of file | 482 | } |
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c index 2ce462854..1d23003ab 100644 --- a/src/reclaim/oidc_helper.c +++ b/src/reclaim/oidc_helper.c | |||
@@ -146,7 +146,7 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | |||
146 | json_t *aggr_names; | 146 | json_t *aggr_names; |
147 | json_t *aggr_sources; | 147 | json_t *aggr_sources; |
148 | json_t *aggr_sources_jwt; | 148 | json_t *aggr_sources_jwt; |
149 | uint64_t attest_arr[GNUNET_RECLAIM_ATTRIBUTE_list_count_attest (attrs)]; | 149 | struct GNUNET_RECLAIM_Identifier attest_arr[GNUNET_RECLAIM_ATTRIBUTE_list_count_attest (attrs)]; |
150 | 150 | ||
151 | // iat REQUIRED time now | 151 | // iat REQUIRED time now |
152 | time_now = GNUNET_TIME_absolute_get (); | 152 | time_now = GNUNET_TIME_absolute_get (); |
@@ -216,7 +216,8 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | |||
216 | int j = 0; | 216 | int j = 0; |
217 | while (j<i) | 217 | while (j<i) |
218 | { | 218 | { |
219 | if (attest_arr[j] == le->reference->id_attest) | 219 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&attest_arr[j], |
220 | &le->reference->id_attest)) | ||
220 | break; | 221 | break; |
221 | j++; | 222 | j++; |
222 | } | 223 | } |
@@ -245,7 +246,8 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | |||
245 | int j = 0; | 246 | int j = 0; |
246 | while (j<i) | 247 | while (j<i) |
247 | { | 248 | { |
248 | if (attest_arr[j] == le->attest->id) | 249 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&attest_arr[j], |
250 | &le->attest->id)) | ||
249 | break; | 251 | break; |
250 | j++; | 252 | j++; |
251 | } | 253 | } |
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c index dcda75b65..9a6af6bcf 100644 --- a/src/reclaim/plugin_rest_reclaim.c +++ b/src/reclaim/plugin_rest_reclaim.c | |||
@@ -428,7 +428,7 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) | |||
428 | char *tmp; | 428 | char *tmp; |
429 | 429 | ||
430 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n"); | 430 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n"); |
431 | tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t)); | 431 | tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd)); |
432 | json_resource = json_object (); | 432 | json_resource = json_object (); |
433 | GNUNET_free (tmp); | 433 | GNUNET_free (tmp); |
434 | json_array_append (handle->resp_object, json_resource); | 434 | json_array_append (handle->resp_object, json_resource); |
@@ -447,7 +447,7 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) | |||
447 | value = json_string (tmp); | 447 | value = json_string (tmp); |
448 | json_object_set_new (json_resource, "audience", value); | 448 | json_object_set_new (json_resource, "audience", value); |
449 | GNUNET_free (tmp); | 449 | GNUNET_free (tmp); |
450 | tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t)); | 450 | tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd)); |
451 | value = json_string (tmp); | 451 | value = json_string (tmp); |
452 | json_object_set_new (json_resource, "rnd", value); | 452 | json_object_set_new (json_resource, "rnd", value); |
453 | GNUNET_free (tmp); | 453 | GNUNET_free (tmp); |
@@ -521,7 +521,7 @@ add_attestation_ref_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
521 | /** | 521 | /** |
522 | * New ID for attribute | 522 | * New ID for attribute |
523 | */ | 523 | */ |
524 | if (0 == attribute->id) | 524 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id)) |
525 | attribute->id = attribute->id_attest; | 525 | attribute->id = attribute->id_attest; |
526 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 526 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
527 | exp = GNUNET_TIME_UNIT_HOURS; | 527 | exp = GNUNET_TIME_UNIT_HOURS; |
@@ -692,9 +692,8 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
692 | /** | 692 | /** |
693 | * New ID for attribute | 693 | * New ID for attribute |
694 | */ | 694 | */ |
695 | if (0 == attribute->id) | 695 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id)) |
696 | attribute->id = | 696 | GNUNET_RECLAIM_id_generate (&attribute->id); |
697 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | ||
698 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 697 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
699 | exp = GNUNET_TIME_UNIT_HOURS; | 698 | exp = GNUNET_TIME_UNIT_HOURS; |
700 | handle->idp_op = GNUNET_RECLAIM_attestation_store (handle->idp, | 699 | handle->idp_op = GNUNET_RECLAIM_attestation_store (handle->idp, |
@@ -740,9 +739,9 @@ ref_collect (void *cls, | |||
740 | json_object_set_new (attr_obj, "ref_value", json_string ( | 739 | json_object_set_new (attr_obj, "ref_value", json_string ( |
741 | reference->reference_value)); | 740 | reference->reference_value)); |
742 | id_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id, | 741 | id_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id, |
743 | sizeof(uint64_t)); | 742 | sizeof(reference->id)); |
744 | id_attest_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id_attest, | 743 | id_attest_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id_attest, |
745 | sizeof(uint64_t)); | 744 | sizeof(reference->id_attest)); |
746 | json_object_set_new (attr_obj, "id", json_string (id_str)); | 745 | json_object_set_new (attr_obj, "id", json_string (id_str)); |
747 | json_object_set_new (attr_obj, "ref_id", json_string (id_attest_str)); | 746 | json_object_set_new (attr_obj, "ref_id", json_string (id_attest_str)); |
748 | json_array_append (handle->resp_object, attr_obj); | 747 | json_array_append (handle->resp_object, attr_obj); |
@@ -856,7 +855,7 @@ attest_collect (void *cls, | |||
856 | json_object_set_new (attr_obj, "name", json_string (attest->name)); | 855 | json_object_set_new (attr_obj, "name", json_string (attest->name)); |
857 | type = GNUNET_RECLAIM_ATTESTATION_number_to_typename (attest->type); | 856 | type = GNUNET_RECLAIM_ATTESTATION_number_to_typename (attest->type); |
858 | json_object_set_new (attr_obj, "type", json_string (type)); | 857 | json_object_set_new (attr_obj, "type", json_string (type)); |
859 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(uint64_t)); | 858 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id)); |
860 | json_object_set_new (attr_obj, "id", json_string (id_str)); | 859 | json_object_set_new (attr_obj, "id", json_string (id_str)); |
861 | json_array_append (handle->resp_object, attr_obj); | 860 | json_array_append (handle->resp_object, attr_obj); |
862 | json_decref (attr_obj); | 861 | json_decref (attr_obj); |
@@ -1017,7 +1016,7 @@ delete_attestation_ref_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1017 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 1016 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
1018 | return; | 1017 | return; |
1019 | } | 1018 | } |
1020 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr->id, sizeof(uint64_t)); | 1019 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr->id, sizeof(attr->id)); |
1021 | 1020 | ||
1022 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 1021 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
1023 | handle->idp_op = GNUNET_RECLAIM_attestation_reference_delete (handle->idp, | 1022 | handle->idp_op = GNUNET_RECLAIM_attestation_reference_delete (handle->idp, |
@@ -1100,7 +1099,7 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1100 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); | 1099 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); |
1101 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 1100 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
1102 | memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim)); | 1101 | memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim)); |
1103 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(uint64_t)); | 1102 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id)); |
1104 | attr.name = ""; | 1103 | attr.name = ""; |
1105 | handle->idp_op = GNUNET_RECLAIM_attestation_delete (handle->idp, | 1104 | handle->idp_op = GNUNET_RECLAIM_attestation_delete (handle->idp, |
1106 | priv_key, | 1105 | priv_key, |
@@ -1230,9 +1229,8 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1230 | /** | 1229 | /** |
1231 | * New ID for attribute | 1230 | * New ID for attribute |
1232 | */ | 1231 | */ |
1233 | if (0 == attribute->id) | 1232 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id)) |
1234 | attribute->id = | 1233 | GNUNET_RECLAIM_id_generate (&attribute->id); |
1235 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | ||
1236 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 1234 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
1237 | exp = GNUNET_TIME_UNIT_HOURS; | 1235 | exp = GNUNET_TIME_UNIT_HOURS; |
1238 | handle->idp_op = GNUNET_RECLAIM_attribute_store (handle->idp, | 1236 | handle->idp_op = GNUNET_RECLAIM_attribute_store (handle->idp, |
@@ -1366,7 +1364,8 @@ attr_collect (void *cls, | |||
1366 | json_object_set_new (attr_obj, "flag", json_string ("1")); | 1364 | json_object_set_new (attr_obj, "flag", json_string ("1")); |
1367 | type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr2->type); | 1365 | type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr2->type); |
1368 | json_object_set_new (attr_obj, "type", json_string (type)); | 1366 | json_object_set_new (attr_obj, "type", json_string (type)); |
1369 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attr2->id, sizeof(uint64_t)); | 1367 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attr2->id, |
1368 | sizeof(attr2->id)); | ||
1370 | json_object_set_new (attr_obj, "id", json_string (id_str)); | 1369 | json_object_set_new (attr_obj, "id", json_string (id_str)); |
1371 | json_array_append (handle->resp_object, attr_obj); | 1370 | json_array_append (handle->resp_object, attr_obj); |
1372 | json_decref (attr_obj); | 1371 | json_decref (attr_obj); |
@@ -1396,7 +1395,8 @@ attr_collect (void *cls, | |||
1396 | json_object_set_new (attr_obj, "flag", json_string (flag_str)); | 1395 | json_object_set_new (attr_obj, "flag", json_string (flag_str)); |
1397 | type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); | 1396 | type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); |
1398 | json_object_set_new (attr_obj, "type", json_string (type)); | 1397 | json_object_set_new (attr_obj, "type", json_string (type)); |
1399 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t)); | 1398 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, |
1399 | sizeof(attr->id)); | ||
1400 | json_object_set_new (attr_obj, "id", json_string (id_str)); | 1400 | json_object_set_new (attr_obj, "id", json_string (id_str)); |
1401 | json_array_append (handle->resp_object, attr_obj); | 1401 | json_array_append (handle->resp_object, attr_obj); |
1402 | json_decref (attr_obj); | 1402 | json_decref (attr_obj); |
@@ -1515,7 +1515,7 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1515 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); | 1515 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); |
1516 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 1516 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
1517 | memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)); | 1517 | memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)); |
1518 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(uint64_t)); | 1518 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id)); |
1519 | attr.name = ""; | 1519 | attr.name = ""; |
1520 | handle->idp_op = GNUNET_RECLAIM_attribute_delete (handle->idp, | 1520 | handle->idp_op = GNUNET_RECLAIM_attribute_delete (handle->idp, |
1521 | priv_key, | 1521 | priv_key, |
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index 847abb58a..5a3bee218 100644 --- a/src/reclaim/reclaim_api.c +++ b/src/reclaim/reclaim_api.c | |||
@@ -511,13 +511,17 @@ handle_consume_ticket_result (void *cls, | |||
511 | { | 511 | { |
512 | for (le = attrs->list_head; NULL != le; le = le->next) | 512 | for (le = attrs->list_head; NULL != le; le = le->next) |
513 | { | 513 | { |
514 | if (le->reference != NULL && le->attest == NULL) | 514 | if ((le->reference != NULL) && (le->attest == NULL)) |
515 | { | 515 | { |
516 | for (le2 = attrs->list_head; NULL != le2; le2 = le2->next) | 516 | for (le2 = attrs->list_head; NULL != le2; le2 = le2->next) |
517 | { | 517 | { |
518 | if (le2->attest != NULL && le2->attest->id == le->reference->id_attest) | 518 | if ((le2->attest != NULL) && |
519 | (0 == memcmp (&le2->attest->id, | ||
520 | &le->reference->id_attest, | ||
521 | sizeof (le2->attest->id)))) | ||
519 | { | 522 | { |
520 | op->ar_cb (op->cls, &msg->identity, le->claim, le2->attest, le->reference); | 523 | op->ar_cb (op->cls, &msg->identity, le->claim, le2->attest, |
524 | le->reference); | ||
521 | break; | 525 | break; |
522 | } | 526 | } |
523 | 527 | ||
@@ -637,6 +641,7 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
637 | GNUNET_assert (0); | 641 | GNUNET_assert (0); |
638 | } | 642 | } |
639 | 643 | ||
644 | |||
640 | /** | 645 | /** |
641 | * Handle an incoming message of type | 646 | * Handle an incoming message of type |
642 | * #GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT | 647 | * #GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT |
@@ -736,6 +741,7 @@ handle_attestation_result (void *cls, const struct AttributeResultMessage *msg) | |||
736 | GNUNET_assert (0); | 741 | GNUNET_assert (0); |
737 | } | 742 | } |
738 | 743 | ||
744 | |||
739 | /** | 745 | /** |
740 | * Handle an incoming message of type | 746 | * Handle an incoming message of type |
741 | * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT | 747 | * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT |
@@ -762,6 +768,7 @@ check_reference_result (void *cls, const struct ReferenceResultMessage *msg) | |||
762 | return GNUNET_OK; | 768 | return GNUNET_OK; |
763 | } | 769 | } |
764 | 770 | ||
771 | |||
765 | /** | 772 | /** |
766 | * Handle an incoming message of type | 773 | * Handle an incoming message of type |
767 | * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT | 774 | * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT |
@@ -841,6 +848,7 @@ handle_reference_result (void *cls, const struct ReferenceResultMessage *msg) | |||
841 | GNUNET_assert (0); | 848 | GNUNET_assert (0); |
842 | } | 849 | } |
843 | 850 | ||
851 | |||
844 | /** | 852 | /** |
845 | * Handle an incoming message of type | 853 | * Handle an incoming message of type |
846 | * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT | 854 | * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT |
@@ -1150,6 +1158,7 @@ GNUNET_RECLAIM_attribute_delete ( | |||
1150 | return op; | 1158 | return op; |
1151 | } | 1159 | } |
1152 | 1160 | ||
1161 | |||
1153 | /** | 1162 | /** |
1154 | * Store an attestation. If the attestation is already present, | 1163 | * Store an attestation. If the attestation is already present, |
1155 | * it is replaced with the new attestation. | 1164 | * it is replaced with the new attestation. |
@@ -1197,6 +1206,7 @@ GNUNET_RECLAIM_attestation_store ( | |||
1197 | return op; | 1206 | return op; |
1198 | } | 1207 | } |
1199 | 1208 | ||
1209 | |||
1200 | /** | 1210 | /** |
1201 | * Delete an attestation. Tickets used to share this attestation are updated | 1211 | * Delete an attestation. Tickets used to share this attestation are updated |
1202 | * accordingly. | 1212 | * accordingly. |
@@ -1240,6 +1250,7 @@ GNUNET_RECLAIM_attestation_delete ( | |||
1240 | return op; | 1250 | return op; |
1241 | } | 1251 | } |
1242 | 1252 | ||
1253 | |||
1243 | /** | 1254 | /** |
1244 | * Store an attestation reference. If the reference is already present, | 1255 | * Store an attestation reference. If the reference is already present, |
1245 | * it is replaced with the new reference. | 1256 | * it is replaced with the new reference. |
@@ -1286,6 +1297,7 @@ GNUNET_RECLAIM_attestation_reference_store ( | |||
1286 | return op; | 1297 | return op; |
1287 | } | 1298 | } |
1288 | 1299 | ||
1300 | |||
1289 | /** | 1301 | /** |
1290 | * Delete an attestation reference. Tickets used to share this reference are updated | 1302 | * Delete an attestation reference. Tickets used to share this reference are updated |
1291 | * accordingly. | 1303 | * accordingly. |
@@ -1330,6 +1342,7 @@ GNUNET_RECLAIM_attestation_reference_delete ( | |||
1330 | return op; | 1342 | return op; |
1331 | } | 1343 | } |
1332 | 1344 | ||
1345 | |||
1333 | /** | 1346 | /** |
1334 | * List all attributes for a local identity. | 1347 | * List all attributes for a local identity. |
1335 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` | 1348 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` |