From 141015969be5bcdcd231cfa639250a537456255e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 21 Nov 2021 23:46:23 +0100 Subject: -bugfixes --- src/testing/testing_api_cmd_keyshare_lookup.c | 21 +++++++++++---------- src/testing/testing_cmd_challenge_answer.c | 8 +++++--- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src/testing') diff --git a/src/testing/testing_api_cmd_keyshare_lookup.c b/src/testing/testing_api_cmd_keyshare_lookup.c index 5b2adea..8b06a67 100644 --- a/src/testing/testing_api_cmd_keyshare_lookup.c +++ b/src/testing/testing_api_cmd_keyshare_lookup.c @@ -222,7 +222,7 @@ keyshare_lookup_run (void *cls, const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key; const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid; const struct ANASTASIS_PaymentSecretP *payment_secret; - const char **answer; + const char **answerp; ksls->is = is; if (NULL == ksls->upload_reference) @@ -301,13 +301,13 @@ keyshare_lookup_run (void *cls, } if (GNUNET_OK != ANASTASIS_TESTING_get_trait_code (download_cmd, - &answer)) + &answerp)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (ksls->is); return; } - if (NULL == *answer) + if (NULL == *answerp) { GNUNET_break (0); TALER_TESTING_interpreter_fail (ksls->is); @@ -317,7 +317,7 @@ keyshare_lookup_run (void *cls, else { /* answer is the answer */ - answer = &ksls->answer; + answerp = &ksls->answer; } if (NULL != ksls->payment_reference) @@ -344,9 +344,9 @@ keyshare_lookup_run (void *cls, { struct GNUNET_HashCode h_answer; - if (NULL != *answer) - GNUNET_CRYPTO_hash (*answer, - strlen (*answer), + if (NULL != *answerp) + GNUNET_CRYPTO_hash (*answerp, + strlen (*answerp), &h_answer); ksls->kslo = ANASTASIS_keyshare_lookup (is->ctx, ksls->anastasis_url, @@ -354,7 +354,7 @@ keyshare_lookup_run (void *cls, truth_key, payment_secret, GNUNET_TIME_UNIT_ZERO, - (NULL != *answer) + (NULL != *answerp) ? &h_answer : NULL, &keyshare_lookup_cb, @@ -386,6 +386,7 @@ keyshare_lookup_cleanup (void *cls, GNUNET_free (ksls->pay_uri); GNUNET_free (ksls->order_id); GNUNET_free (ksls->code); + GNUNET_free (ksls->filename); GNUNET_free (ksls->instructions); GNUNET_free (ksls->redirect_uri); GNUNET_free (ksls); @@ -401,7 +402,7 @@ keyshare_lookup_cleanup (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue keyshare_lookup_traits (void *cls, const void **ret, const char *trait, @@ -416,7 +417,7 @@ keyshare_lookup_traits (void *cls, TALER_TESTING_make_trait_order_id ( (const char **) &ksls->order_id), ANASTASIS_TESTING_make_trait_code ( - (const char **) ksls->code), + (const char **) &ksls->code), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_cmd_challenge_answer.c b/src/testing/testing_cmd_challenge_answer.c index ec8d03d..c9cb976 100644 --- a/src/testing/testing_cmd_challenge_answer.c +++ b/src/testing/testing_cmd_challenge_answer.c @@ -91,7 +91,7 @@ struct ChallengeState /** * code we read in the file generated by the plugin */ - char code[22]; + char *code; }; @@ -166,6 +166,7 @@ challenge_answer_cb (void *af_cls, TALER_TESTING_interpreter_fail (cs->is); return; } + cs->code = GNUNET_malloc (22); if (0 == fscanf (file, "%21s", cs->code)) @@ -480,6 +481,7 @@ challenge_cleanup (void *cls, } GNUNET_free (cs->payment_uri); GNUNET_free (cs->order_id); + GNUNET_free (cs->code); GNUNET_free (cs); } @@ -493,7 +495,7 @@ challenge_cleanup (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue challenge_create_traits (void *cls, const void **ret, const char *trait, @@ -502,7 +504,7 @@ challenge_create_traits (void *cls, struct ChallengeState *cs = cls; struct TALER_TESTING_Trait traits[] = { ANASTASIS_TESTING_make_trait_code ( - (const char **) cs->code), + (const char **) &cs->code), ANASTASIS_TESTING_make_trait_payment_secret ( &cs->payment_order_req), TALER_TESTING_make_trait_payto_uri ( -- cgit v1.2.3