diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-12-14 19:45:35 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-12-14 19:45:35 +0100 |
commit | 644b53a34dfde4c8693458cacea4b2f7015d8fc3 (patch) | |
tree | b46ad8bc18bc4fde41cc27e226107ac16c2ef16c | |
parent | 36c2bb7d41b95564652a66b0de40527f78022582 (diff) | |
download | anastasis-644b53a34dfde4c8693458cacea4b2f7015d8fc3.tar.gz anastasis-644b53a34dfde4c8693458cacea4b2f7015d8fc3.zip |
-fix FTBFS for Taler protocol v11
-rw-r--r-- | src/backend/anastasis-httpd_policy_upload.c | 2 | ||||
-rw-r--r-- | src/backend/anastasis-httpd_truth.c | 10 | ||||
-rw-r--r-- | src/backend/anastasis-httpd_truth_upload.c | 31 | ||||
-rw-r--r-- | src/include/anastasis.h | 2 | ||||
-rw-r--r-- | src/include/anastasis_service.h | 2 | ||||
-rw-r--r-- | src/lib/anastasis_backup.c | 2 | ||||
-rw-r--r-- | src/reducer/anastasis_api_backup_redux.c | 47 | ||||
-rw-r--r-- | src/restclient/anastasis_api_policy_store.c | 3 |
8 files changed, 50 insertions, 49 deletions
diff --git a/src/backend/anastasis-httpd_policy_upload.c b/src/backend/anastasis-httpd_policy_upload.c index b9ab266..4c86241 100644 --- a/src/backend/anastasis-httpd_policy_upload.c +++ b/src/backend/anastasis-httpd_policy_upload.c | |||
@@ -974,7 +974,7 @@ AH_handler_policy_post ( | |||
974 | &version); | 974 | &version); |
975 | now = GNUNET_TIME_timestamp_get (); | 975 | now = GNUNET_TIME_timestamp_get (); |
976 | if (GNUNET_TIME_timestamp_cmp (puc->paid_until, | 976 | if (GNUNET_TIME_timestamp_cmp (puc->paid_until, |
977 | (<), | 977 | <, |
978 | now)) | 978 | now)) |
979 | puc->paid_until = now; | 979 | puc->paid_until = now; |
980 | rem = GNUNET_TIME_absolute_get_difference (puc->paid_until.abs_time, | 980 | rem = GNUNET_TIME_absolute_get_difference (puc->paid_until.abs_time, |
diff --git a/src/backend/anastasis-httpd_truth.c b/src/backend/anastasis-httpd_truth.c index cbf13be..6c05ef8 100644 --- a/src/backend/anastasis-httpd_truth.c +++ b/src/backend/anastasis-httpd_truth.c | |||
@@ -1651,11 +1651,11 @@ AH_handler_truth_get ( | |||
1651 | break; | 1651 | break; |
1652 | } | 1652 | } |
1653 | 1653 | ||
1654 | if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_duration ( | 1654 | if (GNUNET_TIME_relative_cmp ( |
1655 | transmission_date.abs_time), | 1655 | GNUNET_TIME_absolute_get_duration ( |
1656 | (<), | 1656 | transmission_date.abs_time), |
1657 | gc->authorization-> | 1657 | <, |
1658 | code_retransmission_frequency) ) | 1658 | gc->authorization->code_retransmission_frequency) ) |
1659 | { | 1659 | { |
1660 | /* Too early for a retransmission! */ | 1660 | /* Too early for a retransmission! */ |
1661 | GNUNET_free (decrypted_truth); | 1661 | GNUNET_free (decrypted_truth); |
diff --git a/src/backend/anastasis-httpd_truth_upload.c b/src/backend/anastasis-httpd_truth_upload.c index e4bce9c..ddf645c 100644 --- a/src/backend/anastasis-httpd_truth_upload.c +++ b/src/backend/anastasis-httpd_truth_upload.c | |||
@@ -526,7 +526,7 @@ AH_handler_truth_post ( | |||
526 | const char *type; | 526 | const char *type; |
527 | enum GNUNET_DB_QueryStatus qs; | 527 | enum GNUNET_DB_QueryStatus qs; |
528 | uint32_t storage_years; | 528 | uint32_t storage_years; |
529 | struct GNUNET_TIME_Absolute paid_until; | 529 | struct GNUNET_TIME_Timestamp paid_until; |
530 | struct GNUNET_JSON_Specification spec[] = { | 530 | struct GNUNET_JSON_Specification spec[] = { |
531 | GNUNET_JSON_spec_fixed_auto ("key_share_data", | 531 | GNUNET_JSON_spec_fixed_auto ("key_share_data", |
532 | &key_share_data), | 532 | &key_share_data), |
@@ -703,11 +703,11 @@ AH_handler_truth_post ( | |||
703 | if (0 != TALER_amount_cmp (&AH_truth_upload_fee, | 703 | if (0 != TALER_amount_cmp (&AH_truth_upload_fee, |
704 | &zero_amount)) | 704 | &zero_amount)) |
705 | { | 705 | { |
706 | struct GNUNET_TIME_Absolute desired_until; | 706 | struct GNUNET_TIME_Timestamp desired_until; |
707 | enum GNUNET_DB_QueryStatus qs; | 707 | enum GNUNET_DB_QueryStatus qs; |
708 | 708 | ||
709 | desired_until | 709 | desired_until |
710 | = GNUNET_TIME_relative_to_absolute ( | 710 | = GNUNET_TIME_relative_to_timestamp ( |
711 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, | 711 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, |
712 | storage_years)); | 712 | storage_years)); |
713 | qs = db->check_truth_upload_paid (db->cls, | 713 | qs = db->check_truth_upload_paid (db->cls, |
@@ -719,16 +719,16 @@ AH_handler_truth_post ( | |||
719 | TALER_EC_GENERIC_DB_FETCH_FAILED, | 719 | TALER_EC_GENERIC_DB_FETCH_FAILED, |
720 | NULL); | 720 | NULL); |
721 | if ( (0 == qs) || | 721 | if ( (0 == qs) || |
722 | (paid_until.abs_value_us < desired_until.abs_value_us) ) | 722 | (GNUNET_TIME_timestamp_cmp (paid_until, |
723 | <, | ||
724 | desired_until) ) ) | ||
723 | { | 725 | { |
724 | struct GNUNET_TIME_Absolute now; | ||
725 | struct GNUNET_TIME_Relative rem; | 726 | struct GNUNET_TIME_Relative rem; |
726 | 727 | ||
727 | now = GNUNET_TIME_absolute_get (); | 728 | if (GNUNET_TIME_absolute_is_past (paid_until.abs_time)) |
728 | if (paid_until.abs_value_us < now.abs_value_us) | 729 | paid_until = GNUNET_TIME_timestamp_get (); |
729 | paid_until = now; | 730 | rem = GNUNET_TIME_absolute_get_difference (paid_until.abs_time, |
730 | rem = GNUNET_TIME_absolute_get_difference (paid_until, | 731 | desired_until.abs_time); |
731 | desired_until); | ||
732 | tuc->years_to_pay = rem.rel_value_us | 732 | tuc->years_to_pay = rem.rel_value_us |
733 | / GNUNET_TIME_UNIT_YEARS.rel_value_us; | 733 | / GNUNET_TIME_UNIT_YEARS.rel_value_us; |
734 | if (0 != (rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us)) | 734 | if (0 != (rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us)) |
@@ -755,16 +755,16 @@ AH_handler_truth_post ( | |||
755 | } | 755 | } |
756 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 756 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
757 | "TRUTH paid until %s (%d)!\n", | 757 | "TRUTH paid until %s (%d)!\n", |
758 | GNUNET_STRINGS_relative_time_to_string ( | 758 | GNUNET_TIME_relative2s ( |
759 | GNUNET_TIME_absolute_get_remaining ( | 759 | GNUNET_TIME_absolute_get_remaining ( |
760 | paid_until), | 760 | paid_until.abs_time), |
761 | GNUNET_YES), | 761 | GNUNET_YES), |
762 | qs); | 762 | qs); |
763 | } | 763 | } |
764 | else | 764 | else |
765 | { | 765 | { |
766 | paid_until | 766 | paid_until |
767 | = GNUNET_TIME_relative_to_absolute ( | 767 | = GNUNET_TIME_relative_to_timestamp ( |
768 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, | 768 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, |
769 | ANASTASIS_MAX_YEARS_STORAGE)); | 769 | ANASTASIS_MAX_YEARS_STORAGE)); |
770 | } | 770 | } |
@@ -773,7 +773,7 @@ AH_handler_truth_post ( | |||
773 | 773 | ||
774 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 774 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
775 | "Storing truth until %s!\n", | 775 | "Storing truth until %s!\n", |
776 | GNUNET_STRINGS_absolute_time_to_string (paid_until)); | 776 | GNUNET_TIME_timestamp2s (paid_until)); |
777 | qs = db->store_truth (db->cls, | 777 | qs = db->store_truth (db->cls, |
778 | truth_uuid, | 778 | truth_uuid, |
779 | &key_share_data, | 779 | &key_share_data, |
@@ -783,7 +783,8 @@ AH_handler_truth_post ( | |||
783 | encrypted_truth, | 783 | encrypted_truth, |
784 | encrypted_truth_size, | 784 | encrypted_truth_size, |
785 | type, | 785 | type, |
786 | GNUNET_TIME_absolute_get_remaining (paid_until)); | 786 | GNUNET_TIME_absolute_get_remaining ( |
787 | paid_until.abs_time)); | ||
787 | switch (qs) | 788 | switch (qs) |
788 | { | 789 | { |
789 | case GNUNET_DB_STATUS_HARD_ERROR: | 790 | case GNUNET_DB_STATUS_HARD_ERROR: |
diff --git a/src/include/anastasis.h b/src/include/anastasis.h index c7ab630..fd7ed40 100644 --- a/src/include/anastasis.h +++ b/src/include/anastasis.h | |||
@@ -845,7 +845,7 @@ struct ANASTASIS_ProviderSuccessStatus | |||
845 | /** | 845 | /** |
846 | * When will the policy expire? | 846 | * When will the policy expire? |
847 | */ | 847 | */ |
848 | struct GNUNET_TIME_Absolute policy_expiration; | 848 | struct GNUNET_TIME_Timestamp policy_expiration; |
849 | 849 | ||
850 | /** | 850 | /** |
851 | * Version number of the policy at the provider. | 851 | * Version number of the policy at the provider. |
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h index d6d7d4c..b6b3d76 100644 --- a/src/include/anastasis_service.h +++ b/src/include/anastasis_service.h | |||
@@ -337,7 +337,7 @@ struct ANASTASIS_UploadDetails | |||
337 | * At what time is the provider set to forget this | 337 | * At what time is the provider set to forget this |
338 | * policy (because the account expires)? | 338 | * policy (because the account expires)? |
339 | */ | 339 | */ |
340 | struct GNUNET_TIME_Absolute policy_expiration; | 340 | struct GNUNET_TIME_Timestamp policy_expiration; |
341 | 341 | ||
342 | /** | 342 | /** |
343 | * Version number of the resulting policy. | 343 | * Version number of the resulting policy. |
diff --git a/src/lib/anastasis_backup.c b/src/lib/anastasis_backup.c index c9273d0..711fcd4 100644 --- a/src/lib/anastasis_backup.c +++ b/src/lib/anastasis_backup.c | |||
@@ -571,7 +571,7 @@ struct PolicyStoreState | |||
571 | /** | 571 | /** |
572 | * When will the policy expire at the provider. | 572 | * When will the policy expire at the provider. |
573 | */ | 573 | */ |
574 | struct GNUNET_TIME_Absolute policy_expiration; | 574 | struct GNUNET_TIME_Timestamp policy_expiration; |
575 | 575 | ||
576 | }; | 576 | }; |
577 | 577 | ||
diff --git a/src/reducer/anastasis_api_backup_redux.c b/src/reducer/anastasis_api_backup_redux.c index fab5230..e300081 100644 --- a/src/reducer/anastasis_api_backup_redux.c +++ b/src/reducer/anastasis_api_backup_redux.c | |||
@@ -2455,12 +2455,12 @@ del_challenge (json_t *state, | |||
2455 | * @return number of years of service to pay for | 2455 | * @return number of years of service to pay for |
2456 | */ | 2456 | */ |
2457 | static unsigned int | 2457 | static unsigned int |
2458 | expiration_to_years (struct GNUNET_TIME_Absolute expiration) | 2458 | expiration_to_years (struct GNUNET_TIME_Timestamp expiration) |
2459 | { | 2459 | { |
2460 | struct GNUNET_TIME_Relative rem; | 2460 | struct GNUNET_TIME_Relative rem; |
2461 | unsigned int years; | 2461 | unsigned int years; |
2462 | 2462 | ||
2463 | rem = GNUNET_TIME_absolute_get_remaining (expiration); | 2463 | rem = GNUNET_TIME_absolute_get_remaining (expiration.abs_time); |
2464 | years = rem.rel_value_us / GNUNET_TIME_UNIT_YEARS.rel_value_us; | 2464 | years = rem.rel_value_us / GNUNET_TIME_UNIT_YEARS.rel_value_us; |
2465 | if (0 != rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us) | 2465 | if (0 != rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us) |
2466 | years++; | 2466 | years++; |
@@ -2480,7 +2480,7 @@ expiration_to_years (struct GNUNET_TIME_Absolute expiration) | |||
2480 | */ | 2480 | */ |
2481 | static enum GNUNET_GenericReturnValue | 2481 | static enum GNUNET_GenericReturnValue |
2482 | update_expiration_cost (json_t *state, | 2482 | update_expiration_cost (json_t *state, |
2483 | struct GNUNET_TIME_Absolute expiration) | 2483 | struct GNUNET_TIME_Timestamp expiration) |
2484 | { | 2484 | { |
2485 | struct Costs *costs = NULL; | 2485 | struct Costs *costs = NULL; |
2486 | unsigned int years; | 2486 | unsigned int years; |
@@ -2695,13 +2695,12 @@ update_expiration_cost (json_t *state, | |||
2695 | } | 2695 | } |
2696 | 2696 | ||
2697 | if (is_free) | 2697 | if (is_free) |
2698 | expiration = GNUNET_TIME_relative_to_absolute (ANASTASIS_FREE_STORAGE); | 2698 | expiration = GNUNET_TIME_relative_to_timestamp (ANASTASIS_FREE_STORAGE); |
2699 | /* update 'expiration' in state */ | 2699 | /* update 'expiration' in state */ |
2700 | { | 2700 | { |
2701 | json_t *eo; | 2701 | json_t *eo; |
2702 | 2702 | ||
2703 | (void) GNUNET_TIME_round_abs (&expiration); | 2703 | eo = GNUNET_JSON_from_timestamp (expiration); |
2704 | eo = GNUNET_JSON_from_time_abs (expiration); | ||
2705 | GNUNET_assert (0 == | 2704 | GNUNET_assert (0 == |
2706 | json_object_set_new (state, | 2705 | json_object_set_new (state, |
2707 | "expiration", | 2706 | "expiration", |
@@ -2742,11 +2741,12 @@ done_policy_review (json_t *state, | |||
2742 | return NULL; | 2741 | return NULL; |
2743 | } | 2742 | } |
2744 | { | 2743 | { |
2745 | struct GNUNET_TIME_Absolute exp = {0}; | 2744 | struct GNUNET_TIME_Timestamp exp |
2745 | = GNUNET_TIME_UNIT_ZERO_TS; | ||
2746 | struct GNUNET_JSON_Specification spec[] = { | 2746 | struct GNUNET_JSON_Specification spec[] = { |
2747 | GNUNET_JSON_spec_mark_optional ( | 2747 | GNUNET_JSON_spec_mark_optional ( |
2748 | GNUNET_JSON_spec_absolute_time ("expiration", | 2748 | GNUNET_JSON_spec_timestamp ("expiration", |
2749 | &exp)), | 2749 | &exp)), |
2750 | GNUNET_JSON_spec_end () | 2750 | GNUNET_JSON_spec_end () |
2751 | }; | 2751 | }; |
2752 | 2752 | ||
@@ -2761,8 +2761,8 @@ done_policy_review (json_t *state, | |||
2761 | "invalid expiration specified"); | 2761 | "invalid expiration specified"); |
2762 | return NULL; | 2762 | return NULL; |
2763 | } | 2763 | } |
2764 | if (0 == exp.abs_value_us) | 2764 | if (GNUNET_TIME_absolute_is_zero (exp.abs_time)) |
2765 | exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS); | 2765 | exp = GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_YEARS); |
2766 | if (GNUNET_OK != | 2766 | if (GNUNET_OK != |
2767 | update_expiration_cost (state, | 2767 | update_expiration_cost (state, |
2768 | exp)) | 2768 | exp)) |
@@ -3054,8 +3054,8 @@ secret_share_result_cb (void *cls, | |||
3054 | d = GNUNET_JSON_PACK ( | 3054 | d = GNUNET_JSON_PACK ( |
3055 | GNUNET_JSON_pack_uint64 ("policy_version", | 3055 | GNUNET_JSON_pack_uint64 ("policy_version", |
3056 | pssi->policy_version), | 3056 | pssi->policy_version), |
3057 | GNUNET_JSON_pack_time_abs ("policy_expiration", | 3057 | GNUNET_JSON_pack_timestamp ("policy_expiration", |
3058 | pssi->policy_expiration)); | 3058 | pssi->policy_expiration)); |
3059 | GNUNET_assert (NULL != d); | 3059 | GNUNET_assert (NULL != d); |
3060 | GNUNET_assert (0 == | 3060 | GNUNET_assert (0 == |
3061 | json_object_set_new (sa, | 3061 | json_object_set_new (sa, |
@@ -3992,10 +3992,10 @@ upload (json_t *state, | |||
3992 | struct UploadContext *uc; | 3992 | struct UploadContext *uc; |
3993 | json_t *auth_methods; | 3993 | json_t *auth_methods; |
3994 | json_t *policies; | 3994 | json_t *policies; |
3995 | struct GNUNET_TIME_Absolute expiration; | 3995 | struct GNUNET_TIME_Timestamp expiration; |
3996 | struct GNUNET_JSON_Specification spec[] = { | 3996 | struct GNUNET_JSON_Specification spec[] = { |
3997 | GNUNET_JSON_spec_absolute_time ("expiration", | 3997 | GNUNET_JSON_spec_timestamp ("expiration", |
3998 | &expiration), | 3998 | &expiration), |
3999 | GNUNET_JSON_spec_end () | 3999 | GNUNET_JSON_spec_end () |
4000 | }; | 4000 | }; |
4001 | 4001 | ||
@@ -4320,13 +4320,14 @@ enter_secret (json_t *state, | |||
4320 | void *cb_cls) | 4320 | void *cb_cls) |
4321 | { | 4321 | { |
4322 | json_t *jsecret; | 4322 | json_t *jsecret; |
4323 | struct GNUNET_TIME_Absolute expiration = {0}; | 4323 | struct GNUNET_TIME_Timestamp expiration |
4324 | = GNUNET_TIME_UNIT_ZERO_TS; | ||
4324 | struct GNUNET_JSON_Specification spec[] = { | 4325 | struct GNUNET_JSON_Specification spec[] = { |
4325 | GNUNET_JSON_spec_json ("secret", | 4326 | GNUNET_JSON_spec_json ("secret", |
4326 | &jsecret), | 4327 | &jsecret), |
4327 | GNUNET_JSON_spec_mark_optional ( | 4328 | GNUNET_JSON_spec_mark_optional ( |
4328 | GNUNET_JSON_spec_absolute_time ("expiration", | 4329 | GNUNET_JSON_spec_timestamp ("expiration", |
4329 | &expiration)), | 4330 | &expiration)), |
4330 | GNUNET_JSON_spec_end () | 4331 | GNUNET_JSON_spec_end () |
4331 | }; | 4332 | }; |
4332 | 4333 | ||
@@ -4374,7 +4375,7 @@ enter_secret (json_t *state, | |||
4374 | break; | 4375 | break; |
4375 | } | 4376 | } |
4376 | } | 4377 | } |
4377 | if (0 != expiration.abs_value_us) | 4378 | if (! GNUNET_TIME_absolute_is_zero (expiration.abs_time)) |
4378 | { | 4379 | { |
4379 | if (GNUNET_OK != | 4380 | if (GNUNET_OK != |
4380 | update_expiration_cost (state, | 4381 | update_expiration_cost (state, |
@@ -4505,10 +4506,10 @@ update_expiration (json_t *state, | |||
4505 | ANASTASIS_ActionCallback cb, | 4506 | ANASTASIS_ActionCallback cb, |
4506 | void *cb_cls) | 4507 | void *cb_cls) |
4507 | { | 4508 | { |
4508 | struct GNUNET_TIME_Absolute expiration; | 4509 | struct GNUNET_TIME_Timestamp expiration; |
4509 | struct GNUNET_JSON_Specification spec[] = { | 4510 | struct GNUNET_JSON_Specification spec[] = { |
4510 | GNUNET_JSON_spec_absolute_time ("expiration", | 4511 | GNUNET_JSON_spec_timestamp ("expiration", |
4511 | &expiration), | 4512 | &expiration), |
4512 | GNUNET_JSON_spec_end () | 4513 | GNUNET_JSON_spec_end () |
4513 | }; | 4514 | }; |
4514 | 4515 | ||
diff --git a/src/restclient/anastasis_api_policy_store.c b/src/restclient/anastasis_api_policy_store.c index 22d6330..8e3c546 100644 --- a/src/restclient/anastasis_api_policy_store.c +++ b/src/restclient/anastasis_api_policy_store.c | |||
@@ -165,8 +165,7 @@ handle_policy_store_finished (void *cls, | |||
165 | ud.us = ANASTASIS_US_SUCCESS; | 165 | ud.us = ANASTASIS_US_SUCCESS; |
166 | ud.details.success.curr_backup_hash = &pso->new_upload_hash; | 166 | ud.details.success.curr_backup_hash = &pso->new_upload_hash; |
167 | ud.details.success.policy_expiration | 167 | ud.details.success.policy_expiration |
168 | = GNUNET_TIME_absolute_add ( | 168 | = GNUNET_TIME_relative_to_timestamp ( |
169 | GNUNET_TIME_UNIT_ZERO_ABS, | ||
170 | GNUNET_TIME_relative_multiply ( | 169 | GNUNET_TIME_relative_multiply ( |
171 | GNUNET_TIME_UNIT_SECONDS, | 170 | GNUNET_TIME_UNIT_SECONDS, |
172 | expiration)); | 171 | expiration)); |