From b2c046a3f65f823ff6fbfef4f9c96e876aed56dc Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 20 Jun 2023 18:03:33 +0200 Subject: -get rid of GNUNET_SPEC_spec_json calls --- src/lib/anastasis_recovery.c | 80 +++++++---------- src/reducer/anastasis_api_backup_redux.c | 116 +++++++++---------------- src/reducer/anastasis_api_recovery_redux.c | 7 +- src/restclient/anastasis_api_config.c | 18 +--- src/restclient/anastasis_api_truth_challenge.c | 8 +- src/testing/test_anastasis.c | 12 ++- src/testing/test_anastasis_api.c | 12 ++- src/testing/test_anastasis_api.conf | 7 +- 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, void *plaintext; size_t size_plaintext; json_error_t json_error; - json_t *dec_policies; - json_t *esc_methods; + const json_t *dec_policies; + const json_t *esc_methods; r->plo = NULL; switch (http_status) @@ -761,10 +761,10 @@ policy_lookup_cb (void *cls, { const char *secret_name = NULL; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_json ("policies", - &dec_policies), - GNUNET_JSON_spec_json ("escrow_methods", - &esc_methods), + GNUNET_JSON_spec_array_const ("policies", + &dec_policies), + GNUNET_JSON_spec_array_const ("escrow_methods", + &esc_methods), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("secret_name", &secret_name), @@ -848,8 +848,6 @@ policy_lookup_cb (void *cls, NULL, NULL)) { GNUNET_break_op (0); - json_decref (esc_methods); - json_decref (dec_policies); r->csc (r->csc_cls, ANASTASIS_RS_POLICY_MALFORMED_JSON, NULL, @@ -864,13 +862,11 @@ policy_lookup_cb (void *cls, cs->instructions = GNUNET_strdup (instructions); cs->ci.instructions = cs->instructions; } - json_decref (esc_methods); for (unsigned int j = 0; j < r->ri.dps_len; j++) { struct DecryptionPolicy *dp = &r->dps[j]; - - json_t *uuids = NULL; + const json_t *uuids; json_t *uuid; size_t n_index; struct GNUNET_JSON_Specification spec[] = { @@ -879,22 +875,19 @@ policy_lookup_cb (void *cls, &dp->emk_size), GNUNET_JSON_spec_fixed_auto ("master_salt", &dp->master_salt), - GNUNET_JSON_spec_json ("uuids", - &uuids), + GNUNET_JSON_spec_array_const ("uuids", + &uuids), GNUNET_JSON_spec_end () }; r->ri.dps[j] = &r->dps[j].pub_details; - if ( (GNUNET_OK != - GNUNET_JSON_parse (json_array_get (dec_policies, - j), - spec, - NULL, NULL)) || - (! json_is_array (uuids)) ) + if (GNUNET_OK != + GNUNET_JSON_parse (json_array_get (dec_policies, + j), + spec, + NULL, NULL)) { GNUNET_break_op (0); - json_decref (uuids); - json_decref (dec_policies); r->csc (r->csc_cls, ANASTASIS_RS_POLICY_MALFORMED_JSON, NULL, @@ -925,8 +918,6 @@ policy_lookup_cb (void *cls, sizeof (uuid))) ) { GNUNET_break_op (0); - json_decref (dec_policies); - json_decref (uuids); r->csc (r->csc_cls, ANASTASIS_RS_POLICY_MALFORMED_JSON, NULL, @@ -947,8 +938,6 @@ policy_lookup_cb (void *cls, if (! found) { GNUNET_break_op (0); - json_decref (dec_policies); - json_decref (uuids); r->csc (r->csc_cls, ANASTASIS_RS_POLICY_MALFORMED_JSON, NULL, @@ -957,9 +946,7 @@ policy_lookup_cb (void *cls, return; } } - json_decref (uuids); } - json_decref (dec_policies); r->pc (r->pc_cls, &r->ri); } @@ -1134,7 +1121,7 @@ ANASTASIS_recovery_serialize (const struct ANASTASIS_Recovery *r) */ static enum GNUNET_GenericReturnValue parse_cs_array (struct ANASTASIS_Recovery *r, - json_t *cs_arr) + const json_t *cs_arr) { json_t *cs; unsigned int n_index; @@ -1220,7 +1207,7 @@ parse_cs_array (struct ANASTASIS_Recovery *r, */ static enum GNUNET_GenericReturnValue parse_dps_array (struct ANASTASIS_Recovery *r, - json_t *dps_arr) + const json_t *dps_arr) { json_t *dps; unsigned int n_index; @@ -1239,15 +1226,15 @@ parse_dps_array (struct ANASTASIS_Recovery *r, json_array_foreach (dps_arr, n_index, dps) { struct DecryptionPolicy *dp = &r->dps[n_index]; - json_t *challenges; + const json_t *challenges; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_varsize ("encrypted_master_key", &dp->emk, &dp->emk_size), GNUNET_JSON_spec_fixed_auto ("master_salt", &dp->master_salt), - GNUNET_JSON_spec_json ("challenges", - &challenges), + GNUNET_JSON_spec_array_const ("challenges", + &challenges), GNUNET_JSON_spec_end () }; const char *err_json_name; @@ -1270,12 +1257,6 @@ parse_dps_array (struct ANASTASIS_Recovery *r, } GNUNET_assert (NULL != dp->emk); GNUNET_assert (dp->emk_size > 0); - if (! json_is_array (challenges)) - { - GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); - return GNUNET_SYSERR; - } dp->pub_details.challenges_length = json_array_size (challenges); dp->pub_details.challenges = GNUNET_new_array ( dp->pub_details.challenges_length, @@ -1320,8 +1301,7 @@ parse_dps_array (struct ANASTASIS_Recovery *r, } } } - /* We don't free the spec, since we're still using dp->ems. */ - json_decref (challenges); + /* Do NOT free the spec: we are still using dp->ems. */ } return GNUNET_OK; } @@ -1363,9 +1343,9 @@ ANASTASIS_recovery_deserialize (struct GNUNET_CURL_Context *ctx, const char *err_json_name; unsigned int err_line; uint32_t version; - json_t *dps_arr; - json_t *cs_arr; - json_t *id_data; + const json_t *dps_arr; + const json_t *cs_arr; + const json_t *id_data; const char *provider_url; const char *secret_name; void *ecs; @@ -1381,12 +1361,12 @@ ANASTASIS_recovery_deserialize (struct GNUNET_CURL_Context *ctx, NULL), GNUNET_JSON_spec_uint32 ("version", &version), - GNUNET_JSON_spec_json ("decryption_policies", - &dps_arr), - GNUNET_JSON_spec_json ("challenges", - &cs_arr), - GNUNET_JSON_spec_json ("id_data", - &id_data), + GNUNET_JSON_spec_array_const ("decryption_policies", + &dps_arr), + GNUNET_JSON_spec_array_const ("challenges", + &cs_arr), + GNUNET_JSON_spec_object_const ("id_data", + &id_data), GNUNET_JSON_spec_varsize ("encrypted_core_secret", &ecs, &ecs_size), @@ -1420,7 +1400,7 @@ ANASTASIS_recovery_deserialize (struct GNUNET_CURL_Context *ctx, GNUNET_JSON_parse_free (spec); return NULL; } - r->id_data = json_incref (id_data); + r->id_data = json_incref ((json_t *) id_data); r->provider_url = GNUNET_strdup (provider_url); if (NULL != secret_name) 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 @@ /* This file is part of Anastasis - Copyright (C) 2020, 2021 Anastasis SARL + Copyright (C) 2020-2023 Anastasis SARL Anastasis is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -353,7 +353,7 @@ add_authentication (json_t *state, json_object_foreach (auth_providers, url, details) { - json_t *methods = NULL; + const json_t *methods = NULL; json_t *method; size_t index; uint32_t size_limit_in_mb = 0; @@ -371,8 +371,8 @@ add_authentication (json_t *state, &http_status), NULL), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_json ("methods", - &methods), + GNUNET_JSON_spec_array_const ("methods", + &methods), NULL), GNUNET_JSON_spec_end () }; @@ -411,7 +411,6 @@ add_authentication (json_t *state, break; } } - GNUNET_JSON_parse_free (ispec); if (! challenge_size_ok (size_limit_in_mb, challenge_size)) { @@ -767,17 +766,20 @@ free_costs (struct Costs *costs) * Check if providers @a p1 and @a p2 have equivalent * methods and cost structures. * + * @param pb policy builder with list of providers + * @param p1 name of provider to compare + * @param p2 name of provider to compare * @return true if the providers are fully equivalent */ static bool -equiv_provider (struct PolicyBuilder *pb, +equiv_provider (const struct PolicyBuilder *pb, const char *p1, const char *p2) { - json_t *j1; - json_t *j2; - json_t *m1; - json_t *m2; + const json_t *j1; + const json_t *j2; + const json_t *m1; + const json_t *m2; struct TALER_Amount uc1; struct TALER_Amount uc2; @@ -794,8 +796,8 @@ equiv_provider (struct PolicyBuilder *pb, { struct GNUNET_JSON_Specification s1[] = { - GNUNET_JSON_spec_json ("methods", - &m1), + GNUNET_JSON_spec_array_const ("methods", + &m1), TALER_JSON_spec_amount_any ("truth_upload_fee", &uc1), GNUNET_JSON_spec_end () @@ -813,8 +815,8 @@ equiv_provider (struct PolicyBuilder *pb, { struct GNUNET_JSON_Specification s2[] = { - GNUNET_JSON_spec_json ("methods", - &m2), + GNUNET_JSON_spec_array_const ("methods", + &m2), TALER_JSON_spec_amount_any ("truth_upload_fee", &uc2), GNUNET_JSON_spec_end () @@ -933,7 +935,7 @@ eval_provider_selection (struct PolicyBuilder *pb, pb->m_idx[i]); const json_t *provider_cfg = json_object_get (pb->providers, prov_sel[i]); - json_t *provider_methods; + const json_t *provider_methods; const char *method_type; json_t *md; size_t index; @@ -943,8 +945,8 @@ eval_provider_selection (struct PolicyBuilder *pb, struct GNUNET_JSON_Specification pspec[] = { GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", &size_limit_in_mb), - GNUNET_JSON_spec_json ("methods", - &provider_methods), + GNUNET_JSON_spec_array_const ("methods", + &provider_methods), TALER_JSON_spec_amount_any ("truth_upload_fee", &upload_cost), GNUNET_JSON_spec_end () @@ -1016,7 +1018,6 @@ eval_provider_selection (struct PolicyBuilder *pb, GNUNET_break (0); pb->ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID; pb->hint = "'methods' of provider"; - GNUNET_JSON_parse_free (pspec); for (unsigned int i = 0; ireq_methods; i++) free_costs (policy_ent[i].usage_fee); return; @@ -1038,14 +1039,12 @@ eval_provider_selection (struct PolicyBuilder *pb, { /* Provider does not OFFER this method, combination not possible. Cost is basically 'infinite', but we simply then skip this. */ - GNUNET_JSON_parse_free (pspec); GNUNET_JSON_parse_free (mspec); for (unsigned int i = 0; ireq_methods; i++) free_costs (policy_ent[i].usage_fee); return; } GNUNET_JSON_parse_free (mspec); - GNUNET_JSON_parse_free (pspec); } /* calculate provider diversity by counting number of different @@ -1945,7 +1944,7 @@ add_policy (json_t *state, const char *provider_url; uint32_t method_idx; const char *method_type; - json_t *prov_methods; + const json_t *prov_methods; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("provider", &provider_url), @@ -1982,8 +1981,8 @@ add_policy (json_t *state, NULL), GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", &limit), - GNUNET_JSON_spec_json ("methods", - &prov_methods), + GNUNET_JSON_spec_array_const ("methods", + &prov_methods), GNUNET_JSON_spec_end () }; @@ -2016,17 +2015,6 @@ add_policy (json_t *state, json_decref (methods); continue; } - if (! json_is_array (prov_methods)) - { - GNUNET_break (0); - json_decref (methods); - json_decref (prov_methods); - ANASTASIS_redux_fail_ (cb, - cb_cls, - TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID, - "provider lacks authentication methods"); - return NULL; - } } { @@ -2038,7 +2026,6 @@ add_policy (json_t *state, { GNUNET_break (0); json_decref (methods); - json_decref (prov_methods); ANASTASIS_redux_fail_ (cb, cb_cls, TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID, @@ -2051,7 +2038,6 @@ add_policy (json_t *state, { GNUNET_break (0); json_decref (methods); - json_decref (prov_methods); ANASTASIS_redux_fail_ (cb, cb_cls, TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID, @@ -2083,7 +2069,6 @@ add_policy (json_t *state, { GNUNET_break (0); json_decref (methods); - json_decref (prov_methods); ANASTASIS_redux_fail_ (cb, cb_cls, TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, @@ -2100,7 +2085,6 @@ add_policy (json_t *state, { GNUNET_break (0); json_decref (methods); - json_decref (prov_methods); ANASTASIS_redux_fail_ (cb, cb_cls, TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, @@ -2111,7 +2095,6 @@ add_policy (json_t *state, GNUNET_assert (0 == json_array_append (methods, method)); - json_decref (prov_methods); } /* end of json_array_foreach (arg_array, index, method) */ } @@ -3130,23 +3113,25 @@ secret_share_result_cb (void *cls, static void share_secret (struct UploadContext *uc) { - json_t *user_id; - json_t *core_secret; - json_t *jpolicies; - json_t *providers = NULL; + const json_t *user_id; + const json_t *core_secret; + const json_t *jpolicies; + const json_t *providers = NULL; size_t policies_len; const char *secret_name = NULL; unsigned int pds_len; struct GNUNET_TIME_Relative timeout = GNUNET_TIME_UNIT_ZERO; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_json ("identity_attributes", - &user_id), - GNUNET_JSON_spec_json ("policies", - &jpolicies), - GNUNET_JSON_spec_json ("policy_providers", - &providers), - GNUNET_JSON_spec_json ("core_secret", - &core_secret), + GNUNET_JSON_spec_object_const ("identity_attributes", + &user_id), + GNUNET_JSON_spec_array_const ("policies", + &jpolicies), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_array_const ("policy_providers", + &providers), + NULL), + GNUNET_JSON_spec_object_const ("core_secret", + &core_secret), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("secret_name", &secret_name), @@ -3198,40 +3183,32 @@ share_secret (struct UploadContext *uc) } } - if ( (! json_is_object (user_id)) || - (! json_is_array (jpolicies)) || - (0 == json_array_size (jpolicies)) || - ( (NULL != providers) && - (! json_is_array (providers)) ) ) + policies_len = json_array_size (jpolicies); + if (0 == policies_len) { ANASTASIS_redux_fail_ (uc->cb, uc->cb_cls, TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, "State parsing failed checks when preparing to share secret"); - GNUNET_JSON_parse_free (spec); upload_cancel_cb (uc); return; } - policies_len = json_array_size (jpolicies); pds_len = json_array_size (providers); - if (0 == pds_len) { ANASTASIS_redux_fail_ (uc->cb, uc->cb_cls, TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, "no workable providers in state"); - GNUNET_JSON_parse_free (spec); upload_cancel_cb (uc); return; } - { struct ANASTASIS_Policy *vpolicies[policies_len]; const struct ANASTASIS_Policy *policies[policies_len]; - struct ANASTASIS_ProviderDetails pds[GNUNET_NZL (pds_len)]; + struct ANASTASIS_ProviderDetails pds[pds_len]; /* initialize policies/vpolicies arrays */ memset (pds, @@ -3253,7 +3230,6 @@ share_secret (struct UploadContext *uc) uc->cb_cls, TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, "'methods' must be an array"); - GNUNET_JSON_parse_free (spec); upload_cancel_cb (uc); return; } @@ -3267,13 +3243,13 @@ share_secret (struct UploadContext *uc) { const json_t *jmethod = json_array_get (jmethods, j); - json_t *jtruth = NULL; + const json_t *jtruth = NULL; uint32_t truth_index; const char *provider_url; struct GNUNET_JSON_Specification ispec[] = { GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_json ("truth", - &jtruth), + GNUNET_JSON_spec_object_const ("truth", + &jtruth), NULL), GNUNET_JSON_spec_string ("provider", &provider_url), @@ -3295,7 +3271,6 @@ share_secret (struct UploadContext *uc) uc->cb_cls, TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, "'truth' failed to decode"); - GNUNET_JSON_parse_free (spec); upload_cancel_cb (uc); return; } @@ -3312,8 +3287,6 @@ share_secret (struct UploadContext *uc) uc->cb_cls, TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, "'truth' failed to decode"); - GNUNET_JSON_parse_free (ispec); - GNUNET_JSON_parse_free (spec); upload_cancel_cb (uc); return; } @@ -3351,13 +3324,10 @@ share_secret (struct UploadContext *uc) uc->cb_cls, TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, "'truth' failed to decode"); - GNUNET_JSON_parse_free (ispec); - GNUNET_JSON_parse_free (spec); upload_cancel_cb (uc); return; } } - GNUNET_JSON_parse_free (ispec); ctruths[j] = truths[j]; } p = ANASTASIS_policy_create (ctruths, @@ -3401,7 +3371,6 @@ share_secret (struct UploadContext *uc) for (unsigned int i = 0; iss) { 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, void *cb_cls) { uint32_t mask; - json_t *pa; + const json_t *pa; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_uint32 ("attribute_mask", &mask), - GNUNET_JSON_spec_json ("providers", - &pa), + GNUNET_JSON_spec_array_const ("providers", + &pa), GNUNET_JSON_spec_end () }; struct ANASTASIS_CRYPTO_ProviderSaltP provider_salt; @@ -2448,7 +2448,6 @@ done_secret_selecting (json_t *state, pd->ra.cleanup_cls = pd; return &pd->ra; } - } } 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, { const char *name; struct ANASTASIS_Config acfg; - json_t *methods; + const json_t *methods; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("name", &name), @@ -108,8 +108,8 @@ handle_config_finished (void *cls, &acfg.business_name), GNUNET_JSON_spec_string ("version", &acfg.version), - GNUNET_JSON_spec_json ("methods", - &methods), + GNUNET_JSON_spec_array_const ("methods", + &methods), GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", &acfg.storage_limit_in_megabytes), TALER_JSON_spec_amount_any ("annual_fee", @@ -157,7 +157,6 @@ handle_config_finished (void *cls, { GNUNET_break_op (0); response_code = 0; - GNUNET_JSON_parse_free (spec); break; } if ( (ANASTASIS_PROTOCOL_CURRENT < current) && @@ -166,7 +165,6 @@ handle_config_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Provider protocol version too new\n"); response_code = 0; - GNUNET_JSON_parse_free (spec); break; } if ( (ANASTASIS_PROTOCOL_CURRENT > current) && @@ -176,17 +174,9 @@ handle_config_finished (void *cls, "Provider protocol version too old\n"); GNUNET_break_op (0); response_code = 0; - GNUNET_JSON_parse_free (spec); break; } } - if (! json_is_array (methods)) - { - GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); - response_code = 0; - break; - } acfg.methods_length = json_array_size (methods); { struct ANASTASIS_AuthorizationMethodConfig mcfg[GNUNET_NZL ( @@ -210,7 +200,6 @@ handle_config_finished (void *cls, NULL, NULL)) ) { GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); response_code = 0; goto end; } @@ -222,7 +211,6 @@ handle_config_finished (void *cls, co->cb (co->cb_cls, MHD_HTTP_OK, &acfg); - GNUNET_JSON_parse_free (spec); ANASTASIS_config_cancel (co); return; } 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, const char *ct; const char *tan_hint = NULL; const char *filename = NULL; - json_t *wire_details = NULL; + const json_t *wire_details = NULL; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ( "challenge_type", @@ -138,8 +138,8 @@ handle_truth_challenge_finished (void *cls, &filename), NULL), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_json ("wire_details", - &wire_details), + GNUNET_JSON_spec_object_const ("wire_details", + &wire_details), NULL), GNUNET_JSON_spec_end () }; @@ -204,7 +204,6 @@ handle_truth_challenge_finished (void *cls, NULL, NULL)) { GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); tcd.http_status = 0; tcd.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; @@ -212,7 +211,6 @@ handle_truth_challenge_finished (void *cls, tcd.details.success.cs = ANASTASIS_CS_WIRE_FUNDS; tco->cb (tco->cb_cls, &tcd); - GNUNET_JSON_parse_free (spec); ANASTASIS_truth_challenge_cancel (tco); return; } 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, dir); } id_data = ANASTASIS_TESTING_make_id_data_example ("MaxMuster123456789"); - payer_payto = "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME; - exchange_payto = "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME; - merchant_payto = "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME; + payer_payto = + "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME + "?receiver-name=62"; + exchange_payto = + "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME + "?receiver-name=exchange"; + merchant_payto = + "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME + "?receiver-name=merchant"; merchant_url = "http://localhost:8080/"; 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, "%s/.secret", dir); } - payer_payto = "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME; - exchange_payto = "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME; - merchant_payto = "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME; + payer_payto = + "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME + "?receiver-name=62"; + exchange_payto = + "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME + "?receiver-name=exchange"; + merchant_payto = + "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME + "?receiver-name=merchant"; merchant_url = "http://localhost:8080/"; 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 @@ # [PATHS] TALER_TEST_HOME = test_anastasis_api_home/ +TALER_HOME = ${TALER_TEST_HOME:-${HOME:-${USERPROFILE}}} +TALER_DATA_HOME = ${TALER_TEST_HOME:-${XDG_DATA_HOME:-${TALER_HOME}/.local/share/}/.local/share/}taler/ +TALER_CONFIG_HOME = ${TALER_TEST_HOME:-${XDG_CONFIG_HOME:-${TALER_HOME}/.config/}/.config/}taler/ +TALER_CACHE_HOME = ${TALER_TEST_HOME:-${XDG_CACHE_HOME:-${TALER_HOME}/.cache/}/.cache/}taler/ +TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/taler-system-runtime/ [taler] CURRENCY = EUR @@ -94,7 +99,7 @@ KEY_DIR = ${TALER_DATA_HOME}/exchange-secmod-cs/keys CONFIG = "postgres:///talercheck" [exchange-account-exchange] -PAYTO_URI = "payto://x-taler-bank/localhost:8082/2" +PAYTO_URI = "payto://x-taler-bank/localhost:8082/2?receiver-name=exchange" ENABLE_DEBIT = YES ENABLE_CREDIT = YES 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, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue recover_secret_traits (void *cls, const void **ret, const char *trait, -- cgit v1.2.3