diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-06-20 18:03:33 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-06-20 18:03:33 +0200 |
commit | b2c046a3f65f823ff6fbfef4f9c96e876aed56dc (patch) | |
tree | ab49fe78655d416004957f7b247a681758b1dafc | |
parent | 9e39308104794e7f1df4941db3d3e527b47ba15c (diff) | |
download | anastasis-b2c046a3f65f823ff6fbfef4f9c96e876aed56dc.tar.gz anastasis-b2c046a3f65f823ff6fbfef4f9c96e876aed56dc.zip |
-get rid of GNUNET_SPEC_spec_json calls
-rw-r--r-- | src/lib/anastasis_recovery.c | 80 | ||||
-rw-r--r-- | src/reducer/anastasis_api_backup_redux.c | 116 | ||||
-rw-r--r-- | src/reducer/anastasis_api_recovery_redux.c | 7 | ||||
-rw-r--r-- | src/restclient/anastasis_api_config.c | 18 | ||||
-rw-r--r-- | src/restclient/anastasis_api_truth_challenge.c | 8 | ||||
-rw-r--r-- | src/testing/test_anastasis.c | 12 | ||||
-rw-r--r-- | src/testing/test_anastasis_api.c | 12 | ||||
-rw-r--r-- | src/testing/test_anastasis_api.conf | 7 | ||||
-rw-r--r-- | src/testing/testing_cmd_recover_secret.c | 2 |
9 files changed, 106 insertions, 156 deletions
diff --git a/src/lib/anastasis_recovery.c b/src/lib/anastasis_recovery.c index c9f8c0e..e844737 100644 --- a/src/lib/anastasis_recovery.c +++ b/src/lib/anastasis_recovery.c | |||
@@ -624,8 +624,8 @@ policy_lookup_cb (void *cls, | |||
624 | void *plaintext; | 624 | void *plaintext; |
625 | size_t size_plaintext; | 625 | size_t size_plaintext; |
626 | json_error_t json_error; | 626 | json_error_t json_error; |
627 | json_t *dec_policies; | 627 | const json_t *dec_policies; |
628 | json_t *esc_methods; | 628 | const json_t *esc_methods; |
629 | 629 | ||
630 | r->plo = NULL; | 630 | r->plo = NULL; |
631 | switch (http_status) | 631 | switch (http_status) |
@@ -761,10 +761,10 @@ policy_lookup_cb (void *cls, | |||
761 | { | 761 | { |
762 | const char *secret_name = NULL; | 762 | const char *secret_name = NULL; |
763 | struct GNUNET_JSON_Specification spec[] = { | 763 | struct GNUNET_JSON_Specification spec[] = { |
764 | GNUNET_JSON_spec_json ("policies", | 764 | GNUNET_JSON_spec_array_const ("policies", |
765 | &dec_policies), | 765 | &dec_policies), |
766 | GNUNET_JSON_spec_json ("escrow_methods", | 766 | GNUNET_JSON_spec_array_const ("escrow_methods", |
767 | &esc_methods), | 767 | &esc_methods), |
768 | GNUNET_JSON_spec_mark_optional ( | 768 | GNUNET_JSON_spec_mark_optional ( |
769 | GNUNET_JSON_spec_string ("secret_name", | 769 | GNUNET_JSON_spec_string ("secret_name", |
770 | &secret_name), | 770 | &secret_name), |
@@ -848,8 +848,6 @@ policy_lookup_cb (void *cls, | |||
848 | NULL, NULL)) | 848 | NULL, NULL)) |
849 | { | 849 | { |
850 | GNUNET_break_op (0); | 850 | GNUNET_break_op (0); |
851 | json_decref (esc_methods); | ||
852 | json_decref (dec_policies); | ||
853 | r->csc (r->csc_cls, | 851 | r->csc (r->csc_cls, |
854 | ANASTASIS_RS_POLICY_MALFORMED_JSON, | 852 | ANASTASIS_RS_POLICY_MALFORMED_JSON, |
855 | NULL, | 853 | NULL, |
@@ -864,13 +862,11 @@ policy_lookup_cb (void *cls, | |||
864 | cs->instructions = GNUNET_strdup (instructions); | 862 | cs->instructions = GNUNET_strdup (instructions); |
865 | cs->ci.instructions = cs->instructions; | 863 | cs->ci.instructions = cs->instructions; |
866 | } | 864 | } |
867 | json_decref (esc_methods); | ||
868 | 865 | ||
869 | for (unsigned int j = 0; j < r->ri.dps_len; j++) | 866 | for (unsigned int j = 0; j < r->ri.dps_len; j++) |
870 | { | 867 | { |
871 | struct DecryptionPolicy *dp = &r->dps[j]; | 868 | struct DecryptionPolicy *dp = &r->dps[j]; |
872 | 869 | const json_t *uuids; | |
873 | json_t *uuids = NULL; | ||
874 | json_t *uuid; | 870 | json_t *uuid; |
875 | size_t n_index; | 871 | size_t n_index; |
876 | struct GNUNET_JSON_Specification spec[] = { | 872 | struct GNUNET_JSON_Specification spec[] = { |
@@ -879,22 +875,19 @@ policy_lookup_cb (void *cls, | |||
879 | &dp->emk_size), | 875 | &dp->emk_size), |
880 | GNUNET_JSON_spec_fixed_auto ("master_salt", | 876 | GNUNET_JSON_spec_fixed_auto ("master_salt", |
881 | &dp->master_salt), | 877 | &dp->master_salt), |
882 | GNUNET_JSON_spec_json ("uuids", | 878 | GNUNET_JSON_spec_array_const ("uuids", |
883 | &uuids), | 879 | &uuids), |
884 | GNUNET_JSON_spec_end () | 880 | GNUNET_JSON_spec_end () |
885 | }; | 881 | }; |
886 | 882 | ||
887 | r->ri.dps[j] = &r->dps[j].pub_details; | 883 | r->ri.dps[j] = &r->dps[j].pub_details; |
888 | if ( (GNUNET_OK != | 884 | if (GNUNET_OK != |
889 | GNUNET_JSON_parse (json_array_get (dec_policies, | 885 | GNUNET_JSON_parse (json_array_get (dec_policies, |
890 | j), | 886 | j), |
891 | spec, | 887 | spec, |
892 | NULL, NULL)) || | 888 | NULL, NULL)) |
893 | (! json_is_array (uuids)) ) | ||
894 | { | 889 | { |
895 | GNUNET_break_op (0); | 890 | GNUNET_break_op (0); |
896 | json_decref (uuids); | ||
897 | json_decref (dec_policies); | ||
898 | r->csc (r->csc_cls, | 891 | r->csc (r->csc_cls, |
899 | ANASTASIS_RS_POLICY_MALFORMED_JSON, | 892 | ANASTASIS_RS_POLICY_MALFORMED_JSON, |
900 | NULL, | 893 | NULL, |
@@ -925,8 +918,6 @@ policy_lookup_cb (void *cls, | |||
925 | sizeof (uuid))) ) | 918 | sizeof (uuid))) ) |
926 | { | 919 | { |
927 | GNUNET_break_op (0); | 920 | GNUNET_break_op (0); |
928 | json_decref (dec_policies); | ||
929 | json_decref (uuids); | ||
930 | r->csc (r->csc_cls, | 921 | r->csc (r->csc_cls, |
931 | ANASTASIS_RS_POLICY_MALFORMED_JSON, | 922 | ANASTASIS_RS_POLICY_MALFORMED_JSON, |
932 | NULL, | 923 | NULL, |
@@ -947,8 +938,6 @@ policy_lookup_cb (void *cls, | |||
947 | if (! found) | 938 | if (! found) |
948 | { | 939 | { |
949 | GNUNET_break_op (0); | 940 | GNUNET_break_op (0); |
950 | json_decref (dec_policies); | ||
951 | json_decref (uuids); | ||
952 | r->csc (r->csc_cls, | 941 | r->csc (r->csc_cls, |
953 | ANASTASIS_RS_POLICY_MALFORMED_JSON, | 942 | ANASTASIS_RS_POLICY_MALFORMED_JSON, |
954 | NULL, | 943 | NULL, |
@@ -957,9 +946,7 @@ policy_lookup_cb (void *cls, | |||
957 | return; | 946 | return; |
958 | } | 947 | } |
959 | } | 948 | } |
960 | json_decref (uuids); | ||
961 | } | 949 | } |
962 | json_decref (dec_policies); | ||
963 | r->pc (r->pc_cls, | 950 | r->pc (r->pc_cls, |
964 | &r->ri); | 951 | &r->ri); |
965 | } | 952 | } |
@@ -1134,7 +1121,7 @@ ANASTASIS_recovery_serialize (const struct ANASTASIS_Recovery *r) | |||
1134 | */ | 1121 | */ |
1135 | static enum GNUNET_GenericReturnValue | 1122 | static enum GNUNET_GenericReturnValue |
1136 | parse_cs_array (struct ANASTASIS_Recovery *r, | 1123 | parse_cs_array (struct ANASTASIS_Recovery *r, |
1137 | json_t *cs_arr) | 1124 | const json_t *cs_arr) |
1138 | { | 1125 | { |
1139 | json_t *cs; | 1126 | json_t *cs; |
1140 | unsigned int n_index; | 1127 | unsigned int n_index; |
@@ -1220,7 +1207,7 @@ parse_cs_array (struct ANASTASIS_Recovery *r, | |||
1220 | */ | 1207 | */ |
1221 | static enum GNUNET_GenericReturnValue | 1208 | static enum GNUNET_GenericReturnValue |
1222 | parse_dps_array (struct ANASTASIS_Recovery *r, | 1209 | parse_dps_array (struct ANASTASIS_Recovery *r, |
1223 | json_t *dps_arr) | 1210 | const json_t *dps_arr) |
1224 | { | 1211 | { |
1225 | json_t *dps; | 1212 | json_t *dps; |
1226 | unsigned int n_index; | 1213 | unsigned int n_index; |
@@ -1239,15 +1226,15 @@ parse_dps_array (struct ANASTASIS_Recovery *r, | |||
1239 | json_array_foreach (dps_arr, n_index, dps) | 1226 | json_array_foreach (dps_arr, n_index, dps) |
1240 | { | 1227 | { |
1241 | struct DecryptionPolicy *dp = &r->dps[n_index]; | 1228 | struct DecryptionPolicy *dp = &r->dps[n_index]; |
1242 | json_t *challenges; | 1229 | const json_t *challenges; |
1243 | struct GNUNET_JSON_Specification spec[] = { | 1230 | struct GNUNET_JSON_Specification spec[] = { |
1244 | GNUNET_JSON_spec_varsize ("encrypted_master_key", | 1231 | GNUNET_JSON_spec_varsize ("encrypted_master_key", |
1245 | &dp->emk, | 1232 | &dp->emk, |
1246 | &dp->emk_size), | 1233 | &dp->emk_size), |
1247 | GNUNET_JSON_spec_fixed_auto ("master_salt", | 1234 | GNUNET_JSON_spec_fixed_auto ("master_salt", |
1248 | &dp->master_salt), | 1235 | &dp->master_salt), |
1249 | GNUNET_JSON_spec_json ("challenges", | 1236 | GNUNET_JSON_spec_array_const ("challenges", |
1250 | &challenges), | 1237 | &challenges), |
1251 | GNUNET_JSON_spec_end () | 1238 | GNUNET_JSON_spec_end () |
1252 | }; | 1239 | }; |
1253 | const char *err_json_name; | 1240 | const char *err_json_name; |
@@ -1270,12 +1257,6 @@ parse_dps_array (struct ANASTASIS_Recovery *r, | |||
1270 | } | 1257 | } |
1271 | GNUNET_assert (NULL != dp->emk); | 1258 | GNUNET_assert (NULL != dp->emk); |
1272 | GNUNET_assert (dp->emk_size > 0); | 1259 | GNUNET_assert (dp->emk_size > 0); |
1273 | if (! json_is_array (challenges)) | ||
1274 | { | ||
1275 | GNUNET_break_op (0); | ||
1276 | GNUNET_JSON_parse_free (spec); | ||
1277 | return GNUNET_SYSERR; | ||
1278 | } | ||
1279 | dp->pub_details.challenges_length = json_array_size (challenges); | 1260 | dp->pub_details.challenges_length = json_array_size (challenges); |
1280 | dp->pub_details.challenges = GNUNET_new_array ( | 1261 | dp->pub_details.challenges = GNUNET_new_array ( |
1281 | dp->pub_details.challenges_length, | 1262 | dp->pub_details.challenges_length, |
@@ -1320,8 +1301,7 @@ parse_dps_array (struct ANASTASIS_Recovery *r, | |||
1320 | } | 1301 | } |
1321 | } | 1302 | } |
1322 | } | 1303 | } |
1323 | /* We don't free the spec, since we're still using dp->ems. */ | 1304 | /* Do NOT free the spec: we are still using dp->ems. */ |
1324 | json_decref (challenges); | ||
1325 | } | 1305 | } |
1326 | return GNUNET_OK; | 1306 | return GNUNET_OK; |
1327 | } | 1307 | } |
@@ -1363,9 +1343,9 @@ ANASTASIS_recovery_deserialize (struct GNUNET_CURL_Context *ctx, | |||
1363 | const char *err_json_name; | 1343 | const char *err_json_name; |
1364 | unsigned int err_line; | 1344 | unsigned int err_line; |
1365 | uint32_t version; | 1345 | uint32_t version; |
1366 | json_t *dps_arr; | 1346 | const json_t *dps_arr; |
1367 | json_t *cs_arr; | 1347 | const json_t *cs_arr; |
1368 | json_t *id_data; | 1348 | const json_t *id_data; |
1369 | const char *provider_url; | 1349 | const char *provider_url; |
1370 | const char *secret_name; | 1350 | const char *secret_name; |
1371 | void *ecs; | 1351 | void *ecs; |
@@ -1381,12 +1361,12 @@ ANASTASIS_recovery_deserialize (struct GNUNET_CURL_Context *ctx, | |||
1381 | NULL), | 1361 | NULL), |
1382 | GNUNET_JSON_spec_uint32 ("version", | 1362 | GNUNET_JSON_spec_uint32 ("version", |
1383 | &version), | 1363 | &version), |
1384 | GNUNET_JSON_spec_json ("decryption_policies", | 1364 | GNUNET_JSON_spec_array_const ("decryption_policies", |
1385 | &dps_arr), | 1365 | &dps_arr), |
1386 | GNUNET_JSON_spec_json ("challenges", | 1366 | GNUNET_JSON_spec_array_const ("challenges", |
1387 | &cs_arr), | 1367 | &cs_arr), |
1388 | GNUNET_JSON_spec_json ("id_data", | 1368 | GNUNET_JSON_spec_object_const ("id_data", |
1389 | &id_data), | 1369 | &id_data), |
1390 | GNUNET_JSON_spec_varsize ("encrypted_core_secret", | 1370 | GNUNET_JSON_spec_varsize ("encrypted_core_secret", |
1391 | &ecs, | 1371 | &ecs, |
1392 | &ecs_size), | 1372 | &ecs_size), |
@@ -1420,7 +1400,7 @@ ANASTASIS_recovery_deserialize (struct GNUNET_CURL_Context *ctx, | |||
1420 | GNUNET_JSON_parse_free (spec); | 1400 | GNUNET_JSON_parse_free (spec); |
1421 | return NULL; | 1401 | return NULL; |
1422 | } | 1402 | } |
1423 | r->id_data = json_incref (id_data); | 1403 | r->id_data = json_incref ((json_t *) id_data); |
1424 | r->provider_url = GNUNET_strdup (provider_url); | 1404 | r->provider_url = GNUNET_strdup (provider_url); |
1425 | if (NULL != secret_name) | 1405 | if (NULL != secret_name) |
1426 | r->secret_name = GNUNET_strdup (secret_name); | 1406 | r->secret_name = GNUNET_strdup (secret_name); |
diff --git a/src/reducer/anastasis_api_backup_redux.c b/src/reducer/anastasis_api_backup_redux.c index abd7c70..13b1dd6 100644 --- a/src/reducer/anastasis_api_backup_redux.c +++ b/src/reducer/anastasis_api_backup_redux.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of Anastasis | 2 | This file is part of Anastasis |
3 | Copyright (C) 2020, 2021 Anastasis SARL | 3 | Copyright (C) 2020-2023 Anastasis SARL |
4 | 4 | ||
5 | Anastasis is free software; you can redistribute it and/or modify it under the | 5 | Anastasis is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -353,7 +353,7 @@ add_authentication (json_t *state, | |||
353 | 353 | ||
354 | json_object_foreach (auth_providers, url, details) | 354 | json_object_foreach (auth_providers, url, details) |
355 | { | 355 | { |
356 | json_t *methods = NULL; | 356 | const json_t *methods = NULL; |
357 | json_t *method; | 357 | json_t *method; |
358 | size_t index; | 358 | size_t index; |
359 | uint32_t size_limit_in_mb = 0; | 359 | uint32_t size_limit_in_mb = 0; |
@@ -371,8 +371,8 @@ add_authentication (json_t *state, | |||
371 | &http_status), | 371 | &http_status), |
372 | NULL), | 372 | NULL), |
373 | GNUNET_JSON_spec_mark_optional ( | 373 | GNUNET_JSON_spec_mark_optional ( |
374 | GNUNET_JSON_spec_json ("methods", | 374 | GNUNET_JSON_spec_array_const ("methods", |
375 | &methods), | 375 | &methods), |
376 | NULL), | 376 | NULL), |
377 | GNUNET_JSON_spec_end () | 377 | GNUNET_JSON_spec_end () |
378 | }; | 378 | }; |
@@ -411,7 +411,6 @@ add_authentication (json_t *state, | |||
411 | break; | 411 | break; |
412 | } | 412 | } |
413 | } | 413 | } |
414 | GNUNET_JSON_parse_free (ispec); | ||
415 | if (! challenge_size_ok (size_limit_in_mb, | 414 | if (! challenge_size_ok (size_limit_in_mb, |
416 | challenge_size)) | 415 | challenge_size)) |
417 | { | 416 | { |
@@ -767,17 +766,20 @@ free_costs (struct Costs *costs) | |||
767 | * Check if providers @a p1 and @a p2 have equivalent | 766 | * Check if providers @a p1 and @a p2 have equivalent |
768 | * methods and cost structures. | 767 | * methods and cost structures. |
769 | * | 768 | * |
769 | * @param pb policy builder with list of providers | ||
770 | * @param p1 name of provider to compare | ||
771 | * @param p2 name of provider to compare | ||
770 | * @return true if the providers are fully equivalent | 772 | * @return true if the providers are fully equivalent |
771 | */ | 773 | */ |
772 | static bool | 774 | static bool |
773 | equiv_provider (struct PolicyBuilder *pb, | 775 | equiv_provider (const struct PolicyBuilder *pb, |
774 | const char *p1, | 776 | const char *p1, |
775 | const char *p2) | 777 | const char *p2) |
776 | { | 778 | { |
777 | json_t *j1; | 779 | const json_t *j1; |
778 | json_t *j2; | 780 | const json_t *j2; |
779 | json_t *m1; | 781 | const json_t *m1; |
780 | json_t *m2; | 782 | const json_t *m2; |
781 | struct TALER_Amount uc1; | 783 | struct TALER_Amount uc1; |
782 | struct TALER_Amount uc2; | 784 | struct TALER_Amount uc2; |
783 | 785 | ||
@@ -794,8 +796,8 @@ equiv_provider (struct PolicyBuilder *pb, | |||
794 | 796 | ||
795 | { | 797 | { |
796 | struct GNUNET_JSON_Specification s1[] = { | 798 | struct GNUNET_JSON_Specification s1[] = { |
797 | GNUNET_JSON_spec_json ("methods", | 799 | GNUNET_JSON_spec_array_const ("methods", |
798 | &m1), | 800 | &m1), |
799 | TALER_JSON_spec_amount_any ("truth_upload_fee", | 801 | TALER_JSON_spec_amount_any ("truth_upload_fee", |
800 | &uc1), | 802 | &uc1), |
801 | GNUNET_JSON_spec_end () | 803 | GNUNET_JSON_spec_end () |
@@ -813,8 +815,8 @@ equiv_provider (struct PolicyBuilder *pb, | |||
813 | 815 | ||
814 | { | 816 | { |
815 | struct GNUNET_JSON_Specification s2[] = { | 817 | struct GNUNET_JSON_Specification s2[] = { |
816 | GNUNET_JSON_spec_json ("methods", | 818 | GNUNET_JSON_spec_array_const ("methods", |
817 | &m2), | 819 | &m2), |
818 | TALER_JSON_spec_amount_any ("truth_upload_fee", | 820 | TALER_JSON_spec_amount_any ("truth_upload_fee", |
819 | &uc2), | 821 | &uc2), |
820 | GNUNET_JSON_spec_end () | 822 | GNUNET_JSON_spec_end () |
@@ -933,7 +935,7 @@ eval_provider_selection (struct PolicyBuilder *pb, | |||
933 | pb->m_idx[i]); | 935 | pb->m_idx[i]); |
934 | const json_t *provider_cfg = json_object_get (pb->providers, | 936 | const json_t *provider_cfg = json_object_get (pb->providers, |
935 | prov_sel[i]); | 937 | prov_sel[i]); |
936 | json_t *provider_methods; | 938 | const json_t *provider_methods; |
937 | const char *method_type; | 939 | const char *method_type; |
938 | json_t *md; | 940 | json_t *md; |
939 | size_t index; | 941 | size_t index; |
@@ -943,8 +945,8 @@ eval_provider_selection (struct PolicyBuilder *pb, | |||
943 | struct GNUNET_JSON_Specification pspec[] = { | 945 | struct GNUNET_JSON_Specification pspec[] = { |
944 | GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", | 946 | GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", |
945 | &size_limit_in_mb), | 947 | &size_limit_in_mb), |
946 | GNUNET_JSON_spec_json ("methods", | 948 | GNUNET_JSON_spec_array_const ("methods", |
947 | &provider_methods), | 949 | &provider_methods), |
948 | TALER_JSON_spec_amount_any ("truth_upload_fee", | 950 | TALER_JSON_spec_amount_any ("truth_upload_fee", |
949 | &upload_cost), | 951 | &upload_cost), |
950 | GNUNET_JSON_spec_end () | 952 | GNUNET_JSON_spec_end () |
@@ -1016,7 +1018,6 @@ eval_provider_selection (struct PolicyBuilder *pb, | |||
1016 | GNUNET_break (0); | 1018 | GNUNET_break (0); |
1017 | pb->ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID; | 1019 | pb->ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID; |
1018 | pb->hint = "'methods' of provider"; | 1020 | pb->hint = "'methods' of provider"; |
1019 | GNUNET_JSON_parse_free (pspec); | ||
1020 | for (unsigned int i = 0; i<pb->req_methods; i++) | 1021 | for (unsigned int i = 0; i<pb->req_methods; i++) |
1021 | free_costs (policy_ent[i].usage_fee); | 1022 | free_costs (policy_ent[i].usage_fee); |
1022 | return; | 1023 | return; |
@@ -1038,14 +1039,12 @@ eval_provider_selection (struct PolicyBuilder *pb, | |||
1038 | { | 1039 | { |
1039 | /* Provider does not OFFER this method, combination not possible. | 1040 | /* Provider does not OFFER this method, combination not possible. |
1040 | Cost is basically 'infinite', but we simply then skip this. */ | 1041 | Cost is basically 'infinite', but we simply then skip this. */ |
1041 | GNUNET_JSON_parse_free (pspec); | ||
1042 | GNUNET_JSON_parse_free (mspec); | 1042 | GNUNET_JSON_parse_free (mspec); |
1043 | for (unsigned int i = 0; i<pb->req_methods; i++) | 1043 | for (unsigned int i = 0; i<pb->req_methods; i++) |
1044 | free_costs (policy_ent[i].usage_fee); | 1044 | free_costs (policy_ent[i].usage_fee); |
1045 | return; | 1045 | return; |
1046 | } | 1046 | } |
1047 | GNUNET_JSON_parse_free (mspec); | 1047 | GNUNET_JSON_parse_free (mspec); |
1048 | GNUNET_JSON_parse_free (pspec); | ||
1049 | } | 1048 | } |
1050 | 1049 | ||
1051 | /* calculate provider diversity by counting number of different | 1050 | /* calculate provider diversity by counting number of different |
@@ -1945,7 +1944,7 @@ add_policy (json_t *state, | |||
1945 | const char *provider_url; | 1944 | const char *provider_url; |
1946 | uint32_t method_idx; | 1945 | uint32_t method_idx; |
1947 | const char *method_type; | 1946 | const char *method_type; |
1948 | json_t *prov_methods; | 1947 | const json_t *prov_methods; |
1949 | struct GNUNET_JSON_Specification spec[] = { | 1948 | struct GNUNET_JSON_Specification spec[] = { |
1950 | GNUNET_JSON_spec_string ("provider", | 1949 | GNUNET_JSON_spec_string ("provider", |
1951 | &provider_url), | 1950 | &provider_url), |
@@ -1982,8 +1981,8 @@ add_policy (json_t *state, | |||
1982 | NULL), | 1981 | NULL), |
1983 | GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", | 1982 | GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", |
1984 | &limit), | 1983 | &limit), |
1985 | GNUNET_JSON_spec_json ("methods", | 1984 | GNUNET_JSON_spec_array_const ("methods", |
1986 | &prov_methods), | 1985 | &prov_methods), |
1987 | GNUNET_JSON_spec_end () | 1986 | GNUNET_JSON_spec_end () |
1988 | }; | 1987 | }; |
1989 | 1988 | ||
@@ -2016,17 +2015,6 @@ add_policy (json_t *state, | |||
2016 | json_decref (methods); | 2015 | json_decref (methods); |
2017 | continue; | 2016 | continue; |
2018 | } | 2017 | } |
2019 | if (! json_is_array (prov_methods)) | ||
2020 | { | ||
2021 | GNUNET_break (0); | ||
2022 | json_decref (methods); | ||
2023 | json_decref (prov_methods); | ||
2024 | ANASTASIS_redux_fail_ (cb, | ||
2025 | cb_cls, | ||
2026 | TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID, | ||
2027 | "provider lacks authentication methods"); | ||
2028 | return NULL; | ||
2029 | } | ||
2030 | } | 2018 | } |
2031 | 2019 | ||
2032 | { | 2020 | { |
@@ -2038,7 +2026,6 @@ add_policy (json_t *state, | |||
2038 | { | 2026 | { |
2039 | GNUNET_break (0); | 2027 | GNUNET_break (0); |
2040 | json_decref (methods); | 2028 | json_decref (methods); |
2041 | json_decref (prov_methods); | ||
2042 | ANASTASIS_redux_fail_ (cb, | 2029 | ANASTASIS_redux_fail_ (cb, |
2043 | cb_cls, | 2030 | cb_cls, |
2044 | TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID, | 2031 | TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID, |
@@ -2051,7 +2038,6 @@ add_policy (json_t *state, | |||
2051 | { | 2038 | { |
2052 | GNUNET_break (0); | 2039 | GNUNET_break (0); |
2053 | json_decref (methods); | 2040 | json_decref (methods); |
2054 | json_decref (prov_methods); | ||
2055 | ANASTASIS_redux_fail_ (cb, | 2041 | ANASTASIS_redux_fail_ (cb, |
2056 | cb_cls, | 2042 | cb_cls, |
2057 | TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID, | 2043 | TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID, |
@@ -2083,7 +2069,6 @@ add_policy (json_t *state, | |||
2083 | { | 2069 | { |
2084 | GNUNET_break (0); | 2070 | GNUNET_break (0); |
2085 | json_decref (methods); | 2071 | json_decref (methods); |
2086 | json_decref (prov_methods); | ||
2087 | ANASTASIS_redux_fail_ (cb, | 2072 | ANASTASIS_redux_fail_ (cb, |
2088 | cb_cls, | 2073 | cb_cls, |
2089 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, | 2074 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, |
@@ -2100,7 +2085,6 @@ add_policy (json_t *state, | |||
2100 | { | 2085 | { |
2101 | GNUNET_break (0); | 2086 | GNUNET_break (0); |
2102 | json_decref (methods); | 2087 | json_decref (methods); |
2103 | json_decref (prov_methods); | ||
2104 | ANASTASIS_redux_fail_ (cb, | 2088 | ANASTASIS_redux_fail_ (cb, |
2105 | cb_cls, | 2089 | cb_cls, |
2106 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, | 2090 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, |
@@ -2111,7 +2095,6 @@ add_policy (json_t *state, | |||
2111 | GNUNET_assert (0 == | 2095 | GNUNET_assert (0 == |
2112 | json_array_append (methods, | 2096 | json_array_append (methods, |
2113 | method)); | 2097 | method)); |
2114 | json_decref (prov_methods); | ||
2115 | } /* end of json_array_foreach (arg_array, index, method) */ | 2098 | } /* end of json_array_foreach (arg_array, index, method) */ |
2116 | } | 2099 | } |
2117 | 2100 | ||
@@ -3130,23 +3113,25 @@ secret_share_result_cb (void *cls, | |||
3130 | static void | 3113 | static void |
3131 | share_secret (struct UploadContext *uc) | 3114 | share_secret (struct UploadContext *uc) |
3132 | { | 3115 | { |
3133 | json_t *user_id; | 3116 | const json_t *user_id; |
3134 | json_t *core_secret; | 3117 | const json_t *core_secret; |
3135 | json_t *jpolicies; | 3118 | const json_t *jpolicies; |
3136 | json_t *providers = NULL; | 3119 | const json_t *providers = NULL; |
3137 | size_t policies_len; | 3120 | size_t policies_len; |
3138 | const char *secret_name = NULL; | 3121 | const char *secret_name = NULL; |
3139 | unsigned int pds_len; | 3122 | unsigned int pds_len; |
3140 | struct GNUNET_TIME_Relative timeout = GNUNET_TIME_UNIT_ZERO; | 3123 | struct GNUNET_TIME_Relative timeout = GNUNET_TIME_UNIT_ZERO; |
3141 | struct GNUNET_JSON_Specification spec[] = { | 3124 | struct GNUNET_JSON_Specification spec[] = { |
3142 | GNUNET_JSON_spec_json ("identity_attributes", | 3125 | GNUNET_JSON_spec_object_const ("identity_attributes", |
3143 | &user_id), | 3126 | &user_id), |
3144 | GNUNET_JSON_spec_json ("policies", | 3127 | GNUNET_JSON_spec_array_const ("policies", |
3145 | &jpolicies), | 3128 | &jpolicies), |
3146 | GNUNET_JSON_spec_json ("policy_providers", | 3129 | GNUNET_JSON_spec_mark_optional ( |
3147 | &providers), | 3130 | GNUNET_JSON_spec_array_const ("policy_providers", |
3148 | GNUNET_JSON_spec_json ("core_secret", | 3131 | &providers), |
3149 | &core_secret), | 3132 | NULL), |
3133 | GNUNET_JSON_spec_object_const ("core_secret", | ||
3134 | &core_secret), | ||
3150 | GNUNET_JSON_spec_mark_optional ( | 3135 | GNUNET_JSON_spec_mark_optional ( |
3151 | GNUNET_JSON_spec_string ("secret_name", | 3136 | GNUNET_JSON_spec_string ("secret_name", |
3152 | &secret_name), | 3137 | &secret_name), |
@@ -3198,40 +3183,32 @@ share_secret (struct UploadContext *uc) | |||
3198 | } | 3183 | } |
3199 | } | 3184 | } |
3200 | 3185 | ||
3201 | if ( (! json_is_object (user_id)) || | 3186 | policies_len = json_array_size (jpolicies); |
3202 | (! json_is_array (jpolicies)) || | 3187 | if (0 == policies_len) |
3203 | (0 == json_array_size (jpolicies)) || | ||
3204 | ( (NULL != providers) && | ||
3205 | (! json_is_array (providers)) ) ) | ||
3206 | { | 3188 | { |
3207 | ANASTASIS_redux_fail_ (uc->cb, | 3189 | ANASTASIS_redux_fail_ (uc->cb, |
3208 | uc->cb_cls, | 3190 | uc->cb_cls, |
3209 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, | 3191 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, |
3210 | "State parsing failed checks when preparing to share secret"); | 3192 | "State parsing failed checks when preparing to share secret"); |
3211 | GNUNET_JSON_parse_free (spec); | ||
3212 | upload_cancel_cb (uc); | 3193 | upload_cancel_cb (uc); |
3213 | return; | 3194 | return; |
3214 | } | 3195 | } |
3215 | 3196 | ||
3216 | policies_len = json_array_size (jpolicies); | ||
3217 | pds_len = json_array_size (providers); | 3197 | pds_len = json_array_size (providers); |
3218 | |||
3219 | if (0 == pds_len) | 3198 | if (0 == pds_len) |
3220 | { | 3199 | { |
3221 | ANASTASIS_redux_fail_ (uc->cb, | 3200 | ANASTASIS_redux_fail_ (uc->cb, |
3222 | uc->cb_cls, | 3201 | uc->cb_cls, |
3223 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, | 3202 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, |
3224 | "no workable providers in state"); | 3203 | "no workable providers in state"); |
3225 | GNUNET_JSON_parse_free (spec); | ||
3226 | upload_cancel_cb (uc); | 3204 | upload_cancel_cb (uc); |
3227 | return; | 3205 | return; |
3228 | } | 3206 | } |
3229 | 3207 | ||
3230 | |||
3231 | { | 3208 | { |
3232 | struct ANASTASIS_Policy *vpolicies[policies_len]; | 3209 | struct ANASTASIS_Policy *vpolicies[policies_len]; |
3233 | const struct ANASTASIS_Policy *policies[policies_len]; | 3210 | const struct ANASTASIS_Policy *policies[policies_len]; |
3234 | struct ANASTASIS_ProviderDetails pds[GNUNET_NZL (pds_len)]; | 3211 | struct ANASTASIS_ProviderDetails pds[pds_len]; |
3235 | 3212 | ||
3236 | /* initialize policies/vpolicies arrays */ | 3213 | /* initialize policies/vpolicies arrays */ |
3237 | memset (pds, | 3214 | memset (pds, |
@@ -3253,7 +3230,6 @@ share_secret (struct UploadContext *uc) | |||
3253 | uc->cb_cls, | 3230 | uc->cb_cls, |
3254 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, | 3231 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, |
3255 | "'methods' must be an array"); | 3232 | "'methods' must be an array"); |
3256 | GNUNET_JSON_parse_free (spec); | ||
3257 | upload_cancel_cb (uc); | 3233 | upload_cancel_cb (uc); |
3258 | return; | 3234 | return; |
3259 | } | 3235 | } |
@@ -3267,13 +3243,13 @@ share_secret (struct UploadContext *uc) | |||
3267 | { | 3243 | { |
3268 | const json_t *jmethod = json_array_get (jmethods, | 3244 | const json_t *jmethod = json_array_get (jmethods, |
3269 | j); | 3245 | j); |
3270 | json_t *jtruth = NULL; | 3246 | const json_t *jtruth = NULL; |
3271 | uint32_t truth_index; | 3247 | uint32_t truth_index; |
3272 | const char *provider_url; | 3248 | const char *provider_url; |
3273 | struct GNUNET_JSON_Specification ispec[] = { | 3249 | struct GNUNET_JSON_Specification ispec[] = { |
3274 | GNUNET_JSON_spec_mark_optional ( | 3250 | GNUNET_JSON_spec_mark_optional ( |
3275 | GNUNET_JSON_spec_json ("truth", | 3251 | GNUNET_JSON_spec_object_const ("truth", |
3276 | &jtruth), | 3252 | &jtruth), |
3277 | NULL), | 3253 | NULL), |
3278 | GNUNET_JSON_spec_string ("provider", | 3254 | GNUNET_JSON_spec_string ("provider", |
3279 | &provider_url), | 3255 | &provider_url), |
@@ -3295,7 +3271,6 @@ share_secret (struct UploadContext *uc) | |||
3295 | uc->cb_cls, | 3271 | uc->cb_cls, |
3296 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, | 3272 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, |
3297 | "'truth' failed to decode"); | 3273 | "'truth' failed to decode"); |
3298 | GNUNET_JSON_parse_free (spec); | ||
3299 | upload_cancel_cb (uc); | 3274 | upload_cancel_cb (uc); |
3300 | return; | 3275 | return; |
3301 | } | 3276 | } |
@@ -3312,8 +3287,6 @@ share_secret (struct UploadContext *uc) | |||
3312 | uc->cb_cls, | 3287 | uc->cb_cls, |
3313 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, | 3288 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, |
3314 | "'truth' failed to decode"); | 3289 | "'truth' failed to decode"); |
3315 | GNUNET_JSON_parse_free (ispec); | ||
3316 | GNUNET_JSON_parse_free (spec); | ||
3317 | upload_cancel_cb (uc); | 3290 | upload_cancel_cb (uc); |
3318 | return; | 3291 | return; |
3319 | } | 3292 | } |
@@ -3351,13 +3324,10 @@ share_secret (struct UploadContext *uc) | |||
3351 | uc->cb_cls, | 3324 | uc->cb_cls, |
3352 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, | 3325 | TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, |
3353 | "'truth' failed to decode"); | 3326 | "'truth' failed to decode"); |
3354 | GNUNET_JSON_parse_free (ispec); | ||
3355 | GNUNET_JSON_parse_free (spec); | ||
3356 | upload_cancel_cb (uc); | 3327 | upload_cancel_cb (uc); |
3357 | return; | 3328 | return; |
3358 | } | 3329 | } |
3359 | } | 3330 | } |
3360 | GNUNET_JSON_parse_free (ispec); | ||
3361 | ctruths[j] = truths[j]; | 3331 | ctruths[j] = truths[j]; |
3362 | } | 3332 | } |
3363 | p = ANASTASIS_policy_create (ctruths, | 3333 | p = ANASTASIS_policy_create (ctruths, |
@@ -3401,7 +3371,6 @@ share_secret (struct UploadContext *uc) | |||
3401 | for (unsigned int i = 0; i<policies_len; i++) | 3371 | for (unsigned int i = 0; i<policies_len; i++) |
3402 | ANASTASIS_policy_destroy (vpolicies[i]); | 3372 | ANASTASIS_policy_destroy (vpolicies[i]); |
3403 | upload_cancel_cb (uc); | 3373 | upload_cancel_cb (uc); |
3404 | GNUNET_JSON_parse_free (spec); | ||
3405 | return; | 3374 | return; |
3406 | } | 3375 | } |
3407 | } | 3376 | } |
@@ -3432,7 +3401,6 @@ share_secret (struct UploadContext *uc) | |||
3432 | for (unsigned int i = 0; i<policies_len; i++) | 3401 | for (unsigned int i = 0; i<policies_len; i++) |
3433 | ANASTASIS_policy_destroy (vpolicies[i]); | 3402 | ANASTASIS_policy_destroy (vpolicies[i]); |
3434 | } | 3403 | } |
3435 | GNUNET_JSON_parse_free (spec); | ||
3436 | if (NULL == uc->ss) | 3404 | if (NULL == uc->ss) |
3437 | { | 3405 | { |
3438 | GNUNET_break (0); | 3406 | GNUNET_break (0); |
diff --git a/src/reducer/anastasis_api_recovery_redux.c b/src/reducer/anastasis_api_recovery_redux.c index 93884bb..e795c55 100644 --- a/src/reducer/anastasis_api_recovery_redux.c +++ b/src/reducer/anastasis_api_recovery_redux.c | |||
@@ -2308,12 +2308,12 @@ done_secret_selecting (json_t *state, | |||
2308 | void *cb_cls) | 2308 | void *cb_cls) |
2309 | { | 2309 | { |
2310 | uint32_t mask; | 2310 | uint32_t mask; |
2311 | json_t *pa; | 2311 | const json_t *pa; |
2312 | struct GNUNET_JSON_Specification spec[] = { | 2312 | struct GNUNET_JSON_Specification spec[] = { |
2313 | GNUNET_JSON_spec_uint32 ("attribute_mask", | 2313 | GNUNET_JSON_spec_uint32 ("attribute_mask", |
2314 | &mask), | 2314 | &mask), |
2315 | GNUNET_JSON_spec_json ("providers", | 2315 | GNUNET_JSON_spec_array_const ("providers", |
2316 | &pa), | 2316 | &pa), |
2317 | GNUNET_JSON_spec_end () | 2317 | GNUNET_JSON_spec_end () |
2318 | }; | 2318 | }; |
2319 | struct ANASTASIS_CRYPTO_ProviderSaltP provider_salt; | 2319 | struct ANASTASIS_CRYPTO_ProviderSaltP provider_salt; |
@@ -2448,7 +2448,6 @@ done_secret_selecting (json_t *state, | |||
2448 | pd->ra.cleanup_cls = pd; | 2448 | pd->ra.cleanup_cls = pd; |
2449 | return &pd->ra; | 2449 | return &pd->ra; |
2450 | } | 2450 | } |
2451 | |||
2452 | } | 2451 | } |
2453 | } | 2452 | } |
2454 | 2453 | ||
diff --git a/src/restclient/anastasis_api_config.c b/src/restclient/anastasis_api_config.c index 5dcc7ec..215d224 100644 --- a/src/restclient/anastasis_api_config.c +++ b/src/restclient/anastasis_api_config.c | |||
@@ -100,7 +100,7 @@ handle_config_finished (void *cls, | |||
100 | { | 100 | { |
101 | const char *name; | 101 | const char *name; |
102 | struct ANASTASIS_Config acfg; | 102 | struct ANASTASIS_Config acfg; |
103 | json_t *methods; | 103 | const json_t *methods; |
104 | struct GNUNET_JSON_Specification spec[] = { | 104 | struct GNUNET_JSON_Specification spec[] = { |
105 | GNUNET_JSON_spec_string ("name", | 105 | GNUNET_JSON_spec_string ("name", |
106 | &name), | 106 | &name), |
@@ -108,8 +108,8 @@ handle_config_finished (void *cls, | |||
108 | &acfg.business_name), | 108 | &acfg.business_name), |
109 | GNUNET_JSON_spec_string ("version", | 109 | GNUNET_JSON_spec_string ("version", |
110 | &acfg.version), | 110 | &acfg.version), |
111 | GNUNET_JSON_spec_json ("methods", | 111 | GNUNET_JSON_spec_array_const ("methods", |
112 | &methods), | 112 | &methods), |
113 | GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", | 113 | GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", |
114 | &acfg.storage_limit_in_megabytes), | 114 | &acfg.storage_limit_in_megabytes), |
115 | TALER_JSON_spec_amount_any ("annual_fee", | 115 | TALER_JSON_spec_amount_any ("annual_fee", |
@@ -157,7 +157,6 @@ handle_config_finished (void *cls, | |||
157 | { | 157 | { |
158 | GNUNET_break_op (0); | 158 | GNUNET_break_op (0); |
159 | response_code = 0; | 159 | response_code = 0; |
160 | GNUNET_JSON_parse_free (spec); | ||
161 | break; | 160 | break; |
162 | } | 161 | } |
163 | if ( (ANASTASIS_PROTOCOL_CURRENT < current) && | 162 | if ( (ANASTASIS_PROTOCOL_CURRENT < current) && |
@@ -166,7 +165,6 @@ handle_config_finished (void *cls, | |||
166 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 165 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
167 | "Provider protocol version too new\n"); | 166 | "Provider protocol version too new\n"); |
168 | response_code = 0; | 167 | response_code = 0; |
169 | GNUNET_JSON_parse_free (spec); | ||
170 | break; | 168 | break; |
171 | } | 169 | } |
172 | if ( (ANASTASIS_PROTOCOL_CURRENT > current) && | 170 | if ( (ANASTASIS_PROTOCOL_CURRENT > current) && |
@@ -176,17 +174,9 @@ handle_config_finished (void *cls, | |||
176 | "Provider protocol version too old\n"); | 174 | "Provider protocol version too old\n"); |
177 | GNUNET_break_op (0); | 175 | GNUNET_break_op (0); |
178 | response_code = 0; | 176 | response_code = 0; |
179 | GNUNET_JSON_parse_free (spec); | ||
180 | break; | 177 | break; |
181 | } | 178 | } |
182 | } | 179 | } |
183 | if (! json_is_array (methods)) | ||
184 | { | ||
185 | GNUNET_break_op (0); | ||
186 | GNUNET_JSON_parse_free (spec); | ||
187 | response_code = 0; | ||
188 | break; | ||
189 | } | ||
190 | acfg.methods_length = json_array_size (methods); | 180 | acfg.methods_length = json_array_size (methods); |
191 | { | 181 | { |
192 | struct ANASTASIS_AuthorizationMethodConfig mcfg[GNUNET_NZL ( | 182 | struct ANASTASIS_AuthorizationMethodConfig mcfg[GNUNET_NZL ( |
@@ -210,7 +200,6 @@ handle_config_finished (void *cls, | |||
210 | NULL, NULL)) ) | 200 | NULL, NULL)) ) |
211 | { | 201 | { |
212 | GNUNET_break_op (0); | 202 | GNUNET_break_op (0); |
213 | GNUNET_JSON_parse_free (spec); | ||
214 | response_code = 0; | 203 | response_code = 0; |
215 | goto end; | 204 | goto end; |
216 | } | 205 | } |
@@ -222,7 +211,6 @@ handle_config_finished (void *cls, | |||
222 | co->cb (co->cb_cls, | 211 | co->cb (co->cb_cls, |
223 | MHD_HTTP_OK, | 212 | MHD_HTTP_OK, |
224 | &acfg); | 213 | &acfg); |
225 | GNUNET_JSON_parse_free (spec); | ||
226 | ANASTASIS_config_cancel (co); | 214 | ANASTASIS_config_cancel (co); |
227 | return; | 215 | return; |
228 | } | 216 | } |
diff --git a/src/restclient/anastasis_api_truth_challenge.c b/src/restclient/anastasis_api_truth_challenge.c index aa9119c..7a39db5 100644 --- a/src/restclient/anastasis_api_truth_challenge.c +++ b/src/restclient/anastasis_api_truth_challenge.c | |||
@@ -124,7 +124,7 @@ handle_truth_challenge_finished (void *cls, | |||
124 | const char *ct; | 124 | const char *ct; |
125 | const char *tan_hint = NULL; | 125 | const char *tan_hint = NULL; |
126 | const char *filename = NULL; | 126 | const char *filename = NULL; |
127 | json_t *wire_details = NULL; | 127 | const json_t *wire_details = NULL; |
128 | struct GNUNET_JSON_Specification spec[] = { | 128 | struct GNUNET_JSON_Specification spec[] = { |
129 | GNUNET_JSON_spec_string ( | 129 | GNUNET_JSON_spec_string ( |
130 | "challenge_type", | 130 | "challenge_type", |
@@ -138,8 +138,8 @@ handle_truth_challenge_finished (void *cls, | |||
138 | &filename), | 138 | &filename), |
139 | NULL), | 139 | NULL), |
140 | GNUNET_JSON_spec_mark_optional ( | 140 | GNUNET_JSON_spec_mark_optional ( |
141 | GNUNET_JSON_spec_json ("wire_details", | 141 | GNUNET_JSON_spec_object_const ("wire_details", |
142 | &wire_details), | 142 | &wire_details), |
143 | NULL), | 143 | NULL), |
144 | GNUNET_JSON_spec_end () | 144 | GNUNET_JSON_spec_end () |
145 | }; | 145 | }; |
@@ -204,7 +204,6 @@ handle_truth_challenge_finished (void *cls, | |||
204 | NULL, NULL)) | 204 | NULL, NULL)) |
205 | { | 205 | { |
206 | GNUNET_break_op (0); | 206 | GNUNET_break_op (0); |
207 | GNUNET_JSON_parse_free (spec); | ||
208 | tcd.http_status = 0; | 207 | tcd.http_status = 0; |
209 | tcd.ec = TALER_EC_GENERIC_REPLY_MALFORMED; | 208 | tcd.ec = TALER_EC_GENERIC_REPLY_MALFORMED; |
210 | break; | 209 | break; |
@@ -212,7 +211,6 @@ handle_truth_challenge_finished (void *cls, | |||
212 | tcd.details.success.cs = ANASTASIS_CS_WIRE_FUNDS; | 211 | tcd.details.success.cs = ANASTASIS_CS_WIRE_FUNDS; |
213 | tco->cb (tco->cb_cls, | 212 | tco->cb (tco->cb_cls, |
214 | &tcd); | 213 | &tcd); |
215 | GNUNET_JSON_parse_free (spec); | ||
216 | ANASTASIS_truth_challenge_cancel (tco); | 214 | ANASTASIS_truth_challenge_cancel (tco); |
217 | return; | 215 | return; |
218 | } | 216 | } |
diff --git a/src/testing/test_anastasis.c b/src/testing/test_anastasis.c index f9e8531..e3eec24 100644 --- a/src/testing/test_anastasis.c +++ b/src/testing/test_anastasis.c | |||
@@ -369,9 +369,15 @@ main (int argc, | |||
369 | dir); | 369 | dir); |
370 | } | 370 | } |
371 | id_data = ANASTASIS_TESTING_make_id_data_example ("MaxMuster123456789"); | 371 | id_data = ANASTASIS_TESTING_make_id_data_example ("MaxMuster123456789"); |
372 | payer_payto = "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME; | 372 | payer_payto = |
373 | exchange_payto = "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME; | 373 | "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME |
374 | merchant_payto = "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME; | 374 | "?receiver-name=62"; |
375 | exchange_payto = | ||
376 | "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME | ||
377 | "?receiver-name=exchange"; | ||
378 | merchant_payto = | ||
379 | "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME | ||
380 | "?receiver-name=merchant"; | ||
375 | merchant_url = "http://localhost:8080/"; | 381 | merchant_url = "http://localhost:8080/"; |
376 | 382 | ||
377 | if (NULL == | 383 | if (NULL == |
diff --git a/src/testing/test_anastasis_api.c b/src/testing/test_anastasis_api.c index 04071c9..cdf8f54 100644 --- a/src/testing/test_anastasis_api.c +++ b/src/testing/test_anastasis_api.c | |||
@@ -322,9 +322,15 @@ main (int argc, | |||
322 | "%s/.secret", | 322 | "%s/.secret", |
323 | dir); | 323 | dir); |
324 | } | 324 | } |
325 | payer_payto = "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME; | 325 | payer_payto = |
326 | exchange_payto = "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME; | 326 | "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME |
327 | merchant_payto = "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME; | 327 | "?receiver-name=62"; |
328 | exchange_payto = | ||
329 | "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME | ||
330 | "?receiver-name=exchange"; | ||
331 | merchant_payto = | ||
332 | "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME | ||
333 | "?receiver-name=merchant"; | ||
328 | merchant_url = "http://localhost:8080/"; | 334 | merchant_url = "http://localhost:8080/"; |
329 | 335 | ||
330 | if (NULL == | 336 | if (NULL == |
diff --git a/src/testing/test_anastasis_api.conf b/src/testing/test_anastasis_api.conf index 3b2f976..db2c30c 100644 --- a/src/testing/test_anastasis_api.conf +++ b/src/testing/test_anastasis_api.conf | |||
@@ -2,6 +2,11 @@ | |||
2 | # | 2 | # |
3 | [PATHS] | 3 | [PATHS] |
4 | TALER_TEST_HOME = test_anastasis_api_home/ | 4 | TALER_TEST_HOME = test_anastasis_api_home/ |
5 | TALER_HOME = ${TALER_TEST_HOME:-${HOME:-${USERPROFILE}}} | ||
6 | TALER_DATA_HOME = ${TALER_TEST_HOME:-${XDG_DATA_HOME:-${TALER_HOME}/.local/share/}/.local/share/}taler/ | ||
7 | TALER_CONFIG_HOME = ${TALER_TEST_HOME:-${XDG_CONFIG_HOME:-${TALER_HOME}/.config/}/.config/}taler/ | ||
8 | TALER_CACHE_HOME = ${TALER_TEST_HOME:-${XDG_CACHE_HOME:-${TALER_HOME}/.cache/}/.cache/}taler/ | ||
9 | TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/taler-system-runtime/ | ||
5 | 10 | ||
6 | [taler] | 11 | [taler] |
7 | CURRENCY = EUR | 12 | CURRENCY = EUR |
@@ -94,7 +99,7 @@ KEY_DIR = ${TALER_DATA_HOME}/exchange-secmod-cs/keys | |||
94 | CONFIG = "postgres:///talercheck" | 99 | CONFIG = "postgres:///talercheck" |
95 | 100 | ||
96 | [exchange-account-exchange] | 101 | [exchange-account-exchange] |
97 | PAYTO_URI = "payto://x-taler-bank/localhost:8082/2" | 102 | PAYTO_URI = "payto://x-taler-bank/localhost:8082/2?receiver-name=exchange" |
98 | ENABLE_DEBIT = YES | 103 | ENABLE_DEBIT = YES |
99 | ENABLE_CREDIT = YES | 104 | ENABLE_CREDIT = YES |
100 | 105 | ||
diff --git a/src/testing/testing_cmd_recover_secret.c b/src/testing/testing_cmd_recover_secret.c index 81f2d64..35a8580 100644 --- a/src/testing/testing_cmd_recover_secret.c +++ b/src/testing/testing_cmd_recover_secret.c | |||
@@ -302,7 +302,7 @@ recover_secret_cleanup (void *cls, | |||
302 | * @param index index number of the object to extract. | 302 | * @param index index number of the object to extract. |
303 | * @return #GNUNET_OK on success | 303 | * @return #GNUNET_OK on success |
304 | */ | 304 | */ |
305 | static int | 305 | static enum GNUNET_GenericReturnValue |
306 | recover_secret_traits (void *cls, | 306 | recover_secret_traits (void *cls, |
307 | const void **ret, | 307 | const void **ret, |
308 | const char *trait, | 308 | const char *trait, |