diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-07 15:36:43 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-09 20:38:11 +0100 |
commit | 141a279fb55bc9b11aaa765ca3ad54689003e291 (patch) | |
tree | 2519ee820288fae481ae972963dea24fd86ffb59 /src/reclaim/gnunet-reclaim.c | |
parent | d06446f143610790d9a0530d524d8e9db2a03b8c (diff) | |
download | gnunet-141a279fb55bc9b11aaa765ca3ad54689003e291.tar.gz gnunet-141a279fb55bc9b11aaa765ca3ad54689003e291.zip |
bugfixes; CLI improvements
Diffstat (limited to 'src/reclaim/gnunet-reclaim.c')
-rw-r--r-- | src/reclaim/gnunet-reclaim.c | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c index 121f2b963..cb9a87e37 100644 --- a/src/reclaim/gnunet-reclaim.c +++ b/src/reclaim/gnunet-reclaim.c | |||
@@ -277,19 +277,43 @@ process_attrs (void *cls, | |||
277 | ret = 1; | 277 | ret = 1; |
278 | return; | 278 | return; |
279 | } | 279 | } |
280 | value_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type, | ||
281 | attr->data, | ||
282 | attr->data_size); | ||
283 | attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type); | 280 | attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type); |
284 | id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id)); | 281 | id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id)); |
282 | value_str = NULL; | ||
283 | if (NULL == attest) | ||
284 | { | ||
285 | value_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type, | ||
286 | attr->data, | ||
287 | attr->data_size); | ||
288 | } | ||
289 | else | ||
290 | { | ||
291 | struct GNUNET_RECLAIM_AttributeListEntry *ale; | ||
292 | struct GNUNET_RECLAIM_AttributeList *al | ||
293 | = GNUNET_RECLAIM_attestation_get_attributes (attest); | ||
294 | |||
295 | for (ale = al->list_head; NULL != ale; ale = ale->next) | ||
296 | { | ||
297 | if (0 != strncmp (attr->data, ale->attribute->name, attr->data_size)) | ||
298 | continue; | ||
299 | value_str | ||
300 | = GNUNET_RECLAIM_attribute_value_to_string (ale->attribute->type, | ||
301 | ale->attribute-> | ||
302 | data, | ||
303 | ale->attribute-> | ||
304 | data_size); | ||
305 | break; | ||
306 | } | ||
307 | } | ||
285 | fprintf (stdout, | 308 | fprintf (stdout, |
286 | "Name: %s; Value: %s (%s); Flag %u; ID: %s %s\n", | 309 | "Name: %s; Value: %s (%s); Flag %u; ID: %s %s\n", |
287 | attr->name, | 310 | attr->name, |
288 | value_str, | 311 | (NULL != value_str) ? value_str : "???", |
289 | attr_type, | 312 | attr_type, |
290 | attr->flag, | 313 | attr->flag, |
291 | id, | 314 | id, |
292 | (NULL == attest) ? "" : "ATTESTED"); | 315 | (NULL == attest) ? "" : "(ATTESTED)"); |
316 | GNUNET_free_non_null (value_str); | ||
293 | GNUNET_free (id); | 317 | GNUNET_free (id); |
294 | } | 318 | } |
295 | 319 | ||
@@ -556,22 +580,25 @@ iter_cb (void *cls, | |||
556 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attr->attestation)) | 580 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attr->attestation)) |
557 | { | 581 | { |
558 | fprintf (stdout, | 582 | fprintf (stdout, |
559 | "Name: %s; Value: %s (%s); Flag %u; ID: %s\n", | 583 | "%s: ``%s'' (%s); ID: %s\n", |
560 | attr->name, | 584 | attr->name, |
561 | attr_str, | 585 | attr_str, |
562 | attr_type, | 586 | attr_type, |
563 | attr->flag, | ||
564 | id); | 587 | id); |
565 | } | 588 | } |
566 | else | 589 | else |
567 | { | 590 | { |
591 | char *attest_id = | ||
592 | GNUNET_STRINGS_data_to_string_alloc (&attr->attestation, | ||
593 | sizeof(attr->attestation)); | ||
568 | fprintf (stdout, | 594 | fprintf (stdout, |
569 | "Name: %s; Value: %s (%s); Flag %u; ID: %s\n", | 595 | "%s: <``%s'' in attestation %s> (%s); ID: %s\n", |
570 | attr->name, | 596 | attr->name, |
571 | attr_str, | 597 | attr_str, |
598 | attest_id, | ||
572 | attr_type, | 599 | attr_type, |
573 | attr->flag, | ||
574 | id); | 600 | id); |
601 | GNUNET_free (attest_id); | ||
575 | 602 | ||
576 | } | 603 | } |
577 | GNUNET_free (id); | 604 | GNUNET_free (id); |
@@ -643,11 +670,10 @@ attest_iter_cb (void *cls, | |||
643 | attest_type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type); | 670 | attest_type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type); |
644 | id = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id)); | 671 | id = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id)); |
645 | fprintf (stdout, | 672 | fprintf (stdout, |
646 | "Name: %s; Value: %s (%s); Flag %u; ID: %s\n", | 673 | "%s: ``%s'' (%s); ID: %s\n", |
647 | attest->name, | 674 | attest->name, |
648 | attest_str, | 675 | attest_str, |
649 | attest_type, | 676 | attest_type, |
650 | attest->flag, | ||
651 | id); | 677 | id); |
652 | if (NULL != attrs) | 678 | if (NULL != attrs) |
653 | { | 679 | { |
@@ -655,9 +681,12 @@ attest_iter_cb (void *cls, | |||
655 | "\t Attributes:\n"); | 681 | "\t Attributes:\n"); |
656 | for (ale = attrs->list_head; NULL != ale; ale = ale->next) | 682 | for (ale = attrs->list_head; NULL != ale; ale = ale->next) |
657 | { | 683 | { |
658 | attr_str = GNUNET_RECLAIM_attribute_value_to_string (ale->attribute->type, | 684 | attr_str = GNUNET_RECLAIM_attribute_value_to_string ( |
659 | ale->attribute->data, | 685 | ale->attribute->type, |
660 | ale->attribute->data_size); | 686 | ale->attribute-> |
687 | data, | ||
688 | ale->attribute-> | ||
689 | data_size); | ||
661 | 690 | ||
662 | fprintf (stdout, | 691 | fprintf (stdout, |
663 | "\t %s: %s\n", ale->attribute->name, attr_str); | 692 | "\t %s: %s\n", ale->attribute->name, attr_str); |