fixing #5754 (make copy, as original may disappear)

This commit is contained in:
Christian Grothoff 2019-06-06 20:52:32 +02:00
parent 69a07468de
commit a4813d1864
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 38 additions and 30 deletions

View File

@ -514,9 +514,9 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
denom_pub); denom_pub);
GNUNET_assert (NULL != dki); GNUNET_assert (NULL != dki);
GNUNET_assert (GNUNET_SYSERR != GNUNET_assert (GNUNET_SYSERR !=
TALER_amount_subtract (&amount_without_fee, TALER_amount_subtract (&amount_without_fee,
amount, amount,
&dki->fee_deposit)); &dki->fee_deposit));
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key, GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
&denom_pub_hash); &denom_pub_hash);
if (GNUNET_OK != if (GNUNET_OK !=

View File

@ -304,8 +304,8 @@ TEAH_acc_confirmation_cb (void *cls,
*/ */
void void
TEAH_get_auditors_for_dc (struct TALER_EXCHANGE_Handle *h, TEAH_get_auditors_for_dc (struct TALER_EXCHANGE_Handle *h,
TEAH_AuditorCallback ac, TEAH_AuditorCallback ac,
void *ac_cls) void *ac_cls)
{ {
if (NULL == h->auditors_head) if (NULL == h->auditors_head)
{ {
@ -368,7 +368,7 @@ free_keys_request (struct KeysRequest *kr)
*/ */
static int static int
parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key, parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key,
int check_sigs, int check_sigs,
json_t *sign_key_obj, json_t *sign_key_obj,
const struct TALER_MasterPublicKeyP *master_key) const struct TALER_MasterPublicKeyP *master_key)
{ {
@ -529,7 +529,7 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
*/ */
static int static int
parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
int check_sigs, int check_sigs,
json_t *auditor_obj, json_t *auditor_obj,
const struct TALER_EXCHANGE_Keys *key_data) const struct TALER_EXCHANGE_Keys *key_data)
{ {
@ -632,9 +632,9 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
&auditor_sig.eddsa_sig, &auditor_sig.eddsa_sig,
&auditor->auditor_pub.eddsa_pub)) &auditor->auditor_pub.eddsa_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
} }
auditor->denom_keys[off].denom_key_offset = dk_off; auditor->denom_keys[off].denom_key_offset = dk_off;
@ -792,9 +792,9 @@ TALER_denoms_cmp (struct TALER_EXCHANGE_DenomPublicKey *denom1,
*/ */
static int static int
decode_keys_json (const json_t *resp_obj, decode_keys_json (const json_t *resp_obj,
int check_sig, int check_sig,
struct TALER_EXCHANGE_Keys *key_data, struct TALER_EXCHANGE_Keys *key_data,
enum TALER_EXCHANGE_VersionCompatibility *vc) enum TALER_EXCHANGE_VersionCompatibility *vc)
{ {
struct TALER_ExchangeSignatureP sig; struct TALER_ExchangeSignatureP sig;
struct GNUNET_HashContext *hash_context; struct GNUNET_HashContext *hash_context;
@ -842,10 +842,10 @@ decode_keys_json (const json_t *resp_obj,
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (3 != sscanf (ver, if (3 != sscanf (ver,
"%u:%u:%u", "%u:%u:%u",
&current, &current,
&revision, &revision,
&age)) &age))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -977,11 +977,11 @@ decode_keys_json (const json_t *resp_obj,
int found = GNUNET_NO; int found = GNUNET_NO;
memset (&ai, memset (&ai,
0, 0,
sizeof (ai)); sizeof (ai));
EXITIF (GNUNET_SYSERR == EXITIF (GNUNET_SYSERR ==
parse_json_auditor (&ai, parse_json_auditor (&ai,
check_sig, check_sig,
auditor_info, auditor_info,
key_data)); key_data));
for (unsigned int j=0;j<key_data->num_auditors;j++) for (unsigned int j=0;j<key_data->num_auditors;j++)
@ -1165,6 +1165,7 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
return GNUNET_TIME_UNIT_ZERO_ABS; return GNUNET_TIME_UNIT_ZERO_ABS;
} }
/** /**
* Callback used when downloading the reply to a /keys request * Callback used when downloading the reply to a /keys request
* is complete. * is complete.
@ -1505,7 +1506,7 @@ header_cb (char *buffer,
*/ */
static void static void
deserialize_data (struct TALER_EXCHANGE_Handle *exchange, deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
const json_t *data) const json_t *data)
{ {
enum TALER_EXCHANGE_VersionCompatibility vc; enum TALER_EXCHANGE_VersionCompatibility vc;
json_t *keys; json_t *keys;
@ -2016,7 +2017,7 @@ TALER_EXCHANGE_disconnect (struct TALER_EXCHANGE_Handle *exchange)
*/ */
const struct TALER_EXCHANGE_SigningPublicKey * const struct TALER_EXCHANGE_SigningPublicKey *
TALER_EXCHANGE_get_signing_key_details (const struct TALER_EXCHANGE_Keys *keys, TALER_EXCHANGE_get_signing_key_details (const struct TALER_EXCHANGE_Keys *keys,
const struct TALER_ExchangePublicKeyP *pub) const struct TALER_ExchangePublicKeyP *pub)
{ {
for (unsigned int i=0;i<keys->num_sign_keys;i++) for (unsigned int i=0;i<keys->num_sign_keys;i++)
{ {

View File

@ -57,7 +57,7 @@ struct TALER_EXCHANGE_PaybackHandle
/** /**
* Denomination key of the coin. * Denomination key of the coin.
*/ */
const struct TALER_EXCHANGE_DenomPublicKey *pk; struct TALER_EXCHANGE_DenomPublicKey pk;
/** /**
* Handle for the request. * Handle for the request.
@ -195,7 +195,7 @@ handle_payback_finished (void *cls,
struct TALER_Amount total; struct TALER_Amount total;
const struct TALER_EXCHANGE_DenomPublicKey *dki; const struct TALER_EXCHANGE_DenomPublicKey *dki;
dki = ph->pk; dki = &ph->pk;
history = json_object_get (j, history = json_object_get (j,
"history"); "history");
if (GNUNET_OK != if (GNUNET_OK !=
@ -318,7 +318,8 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
ph = GNUNET_new (struct TALER_EXCHANGE_PaybackHandle); ph = GNUNET_new (struct TALER_EXCHANGE_PaybackHandle);
ph->coin_pub = pr.coin_pub; ph->coin_pub = pr.coin_pub;
ph->exchange = exchange; ph->exchange = exchange;
ph->pk = pk; ph->pk = *pk;
ph->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key);
ph->cb = payback_cb; ph->cb = payback_cb;
ph->cb_cls = payback_cb_cls; ph->cb_cls = payback_cb_cls;
ph->url = TEAH_path_to_url (exchange, "/payback"); ph->url = TEAH_path_to_url (exchange, "/payback");
@ -332,6 +333,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
curl_easy_cleanup (eh); curl_easy_cleanup (eh);
json_decref (payback_obj); json_decref (payback_obj);
GNUNET_free (ph->url); GNUNET_free (ph->url);
GNUNET_CRYPTO_rsa_public_key_free (ph->pk.key.rsa_public_key);
GNUNET_free (ph); GNUNET_free (ph);
return NULL; return NULL;
} }
@ -365,6 +367,7 @@ TALER_EXCHANGE_payback_cancel (struct TALER_EXCHANGE_PaybackHandle *ph)
} }
GNUNET_free (ph->url); GNUNET_free (ph->url);
TALER_curl_easy_post_finished (&ph->ctx); TALER_curl_easy_post_finished (&ph->ctx);
GNUNET_CRYPTO_rsa_public_key_free (ph->pk.key.rsa_public_key);
GNUNET_free (ph); GNUNET_free (ph);
} }

View File

@ -700,7 +700,7 @@ struct TALER_EXCHANGE_ReserveWithdrawHandle
/** /**
* Denomination key we are withdrawing. * Denomination key we are withdrawing.
*/ */
const struct TALER_EXCHANGE_DenomPublicKey *pk; struct TALER_EXCHANGE_DenomPublicKey pk;
/** /**
* Closure for @a cb. * Closure for @a cb.
@ -755,7 +755,7 @@ reserve_withdraw_ok (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh,
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_planchet_to_coin (&wsh->pk->key, TALER_planchet_to_coin (&wsh->pk.key,
blind_sig, blind_sig,
&wsh->ps, &wsh->ps,
&wsh->c_hash, &wsh->c_hash,
@ -770,7 +770,7 @@ reserve_withdraw_ok (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh,
/* signature is valid, return it to the application */ /* signature is valid, return it to the application */
wsh->cb (wsh->cb_cls, wsh->cb (wsh->cb_cls,
MHD_HTTP_OK, MHD_HTTP_OK,
TALER_EC_NONE, TALER_EC_NONE,
&fc.sig, &fc.sig,
json); json);
/* make sure callback isn't called again after return */ /* make sure callback isn't called again after return */
@ -868,8 +868,8 @@ reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle *
/* Compute how much we expected to charge to the reserve */ /* Compute how much we expected to charge to the reserve */
if (GNUNET_OK != if (GNUNET_OK !=
TALER_amount_add (&requested_amount, TALER_amount_add (&requested_amount,
&wsh->pk->value, &wsh->pk.value,
&wsh->pk->fee_withdraw)) &wsh->pk.fee_withdraw))
{ {
/* Overflow here? Very strange, our CPU must be fried... */ /* Overflow here? Very strange, our CPU must be fried... */
GNUNET_break (0); GNUNET_break (0);
@ -1008,7 +1008,8 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
wsh->exchange = exchange; wsh->exchange = exchange;
wsh->cb = res_cb; wsh->cb = res_cb;
wsh->cb_cls = res_cb_cls; wsh->cb_cls = res_cb_cls;
wsh->pk = pk; wsh->pk = *pk;
wsh->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key);
wsh->reserve_pub = *reserve_pub; wsh->reserve_pub = *reserve_pub;
wsh->c_hash = pd->c_hash; wsh->c_hash = pd->c_hash;
GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key, GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key,
@ -1023,6 +1024,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
if (NULL == withdraw_obj) if (NULL == withdraw_obj)
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_CRYPTO_rsa_public_key_free (wsh->pk.key.rsa_public_key);
GNUNET_free (wsh); GNUNET_free (wsh);
return NULL; return NULL;
} }
@ -1039,6 +1041,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
curl_easy_cleanup (eh); curl_easy_cleanup (eh);
json_decref (withdraw_obj); json_decref (withdraw_obj);
GNUNET_free (wsh->url); GNUNET_free (wsh->url);
GNUNET_CRYPTO_rsa_public_key_free (wsh->pk.key.rsa_public_key);
GNUNET_free (wsh); GNUNET_free (wsh);
return NULL; return NULL;
} }
@ -1202,6 +1205,7 @@ TALER_EXCHANGE_reserve_withdraw_cancel (struct TALER_EXCHANGE_ReserveWithdrawHan
} }
GNUNET_free (sign->url); GNUNET_free (sign->url);
TALER_curl_easy_post_finished (&sign->ctx); TALER_curl_easy_post_finished (&sign->ctx);
GNUNET_CRYPTO_rsa_public_key_free (sign->pk.key.rsa_public_key);
GNUNET_free (sign); GNUNET_free (sign);
} }