-fix minor bugs
This commit is contained in:
parent
013942ba91
commit
b9a30d29cb
@ -1 +1 @@
|
||||
Subproject commit d4234f340c6e7261de36ab5fad3d53597ea8ecd0
|
||||
Subproject commit 75c838e74c41bf9a6c02cdfe8109a444056bf26d
|
@ -283,6 +283,9 @@ add_deposit (const struct Merchant *m)
|
||||
d.coin.denom_pub_hash = h_denom_pub;
|
||||
d.coin.denom_sig = denom_sig;
|
||||
RANDOMIZE (&d.h_contract_terms);
|
||||
memset (&d.coin.h_age_commitment,
|
||||
0,
|
||||
sizeof (d.coin.h_age_commitment));
|
||||
|
||||
if (0 >=
|
||||
plugin->ensure_coin_known (plugin->cls,
|
||||
|
@ -270,7 +270,8 @@ run (void *cls,
|
||||
&msg_size),
|
||||
GNUNET_JSON_spec_end ()
|
||||
};
|
||||
if (GNUNET_OK != GNUNET_JSON_parse (args,
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_JSON_parse (args,
|
||||
eddsa_sign_spec,
|
||||
NULL,
|
||||
NULL))
|
||||
@ -280,15 +281,16 @@ run (void *cls,
|
||||
global_ret = 1;
|
||||
return;
|
||||
}
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_CRYPTO_eddsa_sign_ (
|
||||
&priv,
|
||||
msg,
|
||||
&sig
|
||||
);
|
||||
&sig));
|
||||
resp = GNUNET_JSON_PACK (
|
||||
GNUNET_JSON_pack_data_auto ("sig", &sig)
|
||||
);
|
||||
json_dumpf (resp, stdout, JSON_COMPACT);
|
||||
json_dumpf (resp, stdout,
|
||||
JSON_COMPACT);
|
||||
printf ("\n");
|
||||
fflush (stdout);
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
|
@ -628,8 +628,9 @@ TEH_handler_batch_withdraw (struct TEH_RequestContext *rc,
|
||||
memset (&wc,
|
||||
0,
|
||||
sizeof (wc));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_amount_set_zero (TEH_currency,
|
||||
&wc.batch_total);
|
||||
&wc.batch_total));
|
||||
wc.reserve_pub = reserve_pub;
|
||||
|
||||
{
|
||||
|
@ -207,8 +207,9 @@ create_transaction (void *cls,
|
||||
struct TALER_Amount purse_fee;
|
||||
bool in_conflict = true;
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_amount_set_zero (pcc->amount.currency,
|
||||
&purse_fee);
|
||||
&purse_fee));
|
||||
/* 1) create purse */
|
||||
qs = TEH_plugin->insert_purse_request (
|
||||
TEH_plugin->cls,
|
||||
@ -739,8 +740,22 @@ TEH_handler_purses_create (
|
||||
TALER_EC_GENERIC_PARAMETER_MALFORMED,
|
||||
"deposits");
|
||||
}
|
||||
gf = TEH_keys_global_fee_by_time (TEH_keys_get_state (),
|
||||
{
|
||||
struct TEH_KeyStateHandle *keys;
|
||||
|
||||
keys = TEH_keys_get_state ();
|
||||
if (NULL == keys)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
return TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING,
|
||||
NULL);
|
||||
}
|
||||
gf = TEH_keys_global_fee_by_time (keys,
|
||||
pcc.exchange_timestamp);
|
||||
}
|
||||
if (NULL == gf)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||
|
@ -162,8 +162,9 @@ reply_merge_success (struct MHD_Connection *connection,
|
||||
&pcc->target_amount,
|
||||
&pcc->wf->wad))
|
||||
{
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_amount_set_zero (TEH_currency,
|
||||
&merge_amount);
|
||||
&merge_amount));
|
||||
}
|
||||
}
|
||||
if (TALER_EC_NONE !=
|
||||
@ -524,8 +525,9 @@ TEH_handler_purses_merge (
|
||||
{
|
||||
struct TALER_Amount zero_purse_fee;
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_amount_set_zero (pcc.target_amount.currency,
|
||||
&zero_purse_fee);
|
||||
&zero_purse_fee));
|
||||
if (GNUNET_OK !=
|
||||
TALER_wallet_account_merge_verify (
|
||||
pcc.merge_timestamp,
|
||||
|
@ -232,8 +232,22 @@ TEH_handler_reserves_history (struct TEH_RequestContext *rc,
|
||||
TALER_EC_EXCHANGE_GENERIC_CLOCK_SKEW,
|
||||
NULL);
|
||||
}
|
||||
rsc.gf = TEH_keys_global_fee_by_time (TEH_keys_get_state (),
|
||||
{
|
||||
struct TEH_KeyStateHandle *keys;
|
||||
|
||||
keys = TEH_keys_get_state ();
|
||||
if (NULL == keys)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
return TALER_MHD_reply_with_error (rc->connection,
|
||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING,
|
||||
NULL);
|
||||
}
|
||||
rsc.gf = TEH_keys_global_fee_by_time (keys,
|
||||
rsc.timestamp);
|
||||
}
|
||||
if (NULL == rsc.gf)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
|
@ -557,8 +557,22 @@ TEH_handler_reserves_purse (
|
||||
TALER_EC_EXCHANGE_RESERVES_PURSE_EXPIRATION_IS_NEVER,
|
||||
NULL);
|
||||
}
|
||||
rpc.gf = TEH_keys_global_fee_by_time (TEH_keys_get_state (),
|
||||
{
|
||||
struct TEH_KeyStateHandle *keys;
|
||||
|
||||
keys = TEH_keys_get_state ();
|
||||
if (NULL == keys)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
return TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING,
|
||||
NULL);
|
||||
}
|
||||
rpc.gf = TEH_keys_global_fee_by_time (keys,
|
||||
rpc.exchange_timestamp);
|
||||
}
|
||||
if (NULL == rpc.gf)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||
|
@ -14594,8 +14594,9 @@ postgres_do_reserve_purse (
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_amount_set_zero (pg->currency,
|
||||
&zero_fee);
|
||||
&zero_fee));
|
||||
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"call_reserve_purse",
|
||||
params,
|
||||
|
@ -423,7 +423,6 @@ struct TALER_EXCHANGE_HttpResponse
|
||||
* reply (too big, invalid JSON).
|
||||
*/
|
||||
const json_t *reply;
|
||||
|
||||
/**
|
||||
* Set to the human-readable 'hint' that is optionally
|
||||
* provided by the exchange together with errors. NULL
|
||||
|
@ -192,16 +192,17 @@ TALER_EXCHANGE_add_auditor_denomination (
|
||||
GNUNET_JSON_pack_data_auto ("auditor_sig",
|
||||
auditor_sig));
|
||||
eh = TALER_AUDITOR_curl_easy_get_ (ah->url);
|
||||
GNUNET_assert (NULL != eh);
|
||||
if (GNUNET_OK !=
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&ah->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
json_decref (body);
|
||||
GNUNET_free (ah->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
|
@ -414,8 +414,9 @@ TALER_EXCHANGE_batch_withdraw2 (
|
||||
wh->cb = res_cb;
|
||||
wh->cb_cls = res_cb_cls;
|
||||
wh->num_coins = pds_length;
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_amount_set_zero (keys->currency,
|
||||
&wh->requested_amount);
|
||||
&wh->requested_amount));
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv,
|
||||
&wh->reserve_pub.eddsa_pub);
|
||||
{
|
||||
|
@ -173,16 +173,17 @@ TALER_EXCHANGE_management_disable_auditor (
|
||||
GNUNET_JSON_pack_timestamp ("validity_end",
|
||||
validity_end));
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
|
||||
GNUNET_assert (NULL != eh);
|
||||
if (GNUNET_OK !=
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&ah->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
json_decref (body);
|
||||
GNUNET_free (ah->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
|
@ -163,16 +163,17 @@ TALER_EXCHANGE_management_enable_auditor (
|
||||
GNUNET_JSON_pack_timestamp ("validity_start",
|
||||
validity_start));
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
|
||||
GNUNET_assert (NULL != eh);
|
||||
if (GNUNET_OK !=
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&ah->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
json_decref (body);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
GNUNET_free (ah->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "taler_json_lib.h"
|
||||
#include <gnunet/gnunet_curl_lib.h>
|
||||
#include "taler_extensions.h"
|
||||
#include "exchange_api_curl_defaults.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "taler_signatures.h"
|
||||
#include "taler_curl_lib.h"
|
||||
@ -154,26 +155,24 @@ TALER_EXCHANGE_management_post_extensions (
|
||||
GNUNET_JSON_pack_data_auto ("extensions_sig",
|
||||
&ped->extensions_sig));
|
||||
|
||||
eh = curl_easy_init ();
|
||||
GNUNET_assert (NULL != eh);
|
||||
if (GNUNET_OK !=
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&ph->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
json_decref (body);
|
||||
GNUNET_free (ph->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Requesting URL '%s'\n",
|
||||
ph->url);
|
||||
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
|
||||
CURLOPT_URL,
|
||||
ph->url));
|
||||
ph->job = GNUNET_CURL_job_add2 (ctx,
|
||||
eh,
|
||||
ph->post_ctx.headers,
|
||||
|
@ -191,16 +191,17 @@ TALER_EXCHANGE_post_management_keys (
|
||||
GNUNET_JSON_pack_array_steal ("signkey_sigs",
|
||||
signkey_sigs));
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
|
||||
GNUNET_assert (NULL != eh);
|
||||
if (GNUNET_OK !=
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&ph->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
json_decref (body);
|
||||
GNUNET_free (ph->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
|
@ -175,15 +175,17 @@ TALER_EXCHANGE_management_revoke_denomination_key (
|
||||
return NULL;
|
||||
}
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
|
||||
if (GNUNET_OK !=
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&rh->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
json_decref (body);
|
||||
GNUNET_free (rh->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
|
@ -165,16 +165,17 @@ TALER_EXCHANGE_management_revoke_signing_key (
|
||||
GNUNET_JSON_pack_data_auto ("master_sig",
|
||||
master_sig));
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
|
||||
GNUNET_assert (NULL != eh);
|
||||
if (GNUNET_OK !=
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&rh->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
json_decref (body);
|
||||
GNUNET_free (rh->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
|
@ -179,16 +179,17 @@ TALER_EXCHANGE_management_set_global_fees (
|
||||
GNUNET_JSON_pack_uint64 ("purse_account_limit",
|
||||
purse_account_limit));
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (sgfh->url);
|
||||
GNUNET_assert (NULL != eh);
|
||||
if (GNUNET_OK !=
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&sgfh->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
json_decref (body);
|
||||
GNUNET_free (sgfh->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
|
@ -168,16 +168,17 @@ TALER_EXCHANGE_management_set_wire_fees (
|
||||
TALER_JSON_pack_amount ("wire_fee",
|
||||
&fees->wire));
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (swfh->url);
|
||||
GNUNET_assert (NULL != eh);
|
||||
if (GNUNET_OK !=
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&swfh->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
json_decref (body);
|
||||
GNUNET_free (swfh->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
|
@ -163,16 +163,17 @@ TALER_EXCHANGE_management_disable_wire (
|
||||
GNUNET_JSON_pack_timestamp ("validity_end",
|
||||
validity_end));
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
|
||||
GNUNET_assert (NULL != eh);
|
||||
if (GNUNET_OK !=
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&wh->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
json_decref (body);
|
||||
GNUNET_free (wh->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
|
@ -174,16 +174,17 @@ TALER_EXCHANGE_management_enable_wire (
|
||||
GNUNET_JSON_pack_timestamp ("validity_start",
|
||||
validity_start));
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
|
||||
GNUNET_assert (NULL != eh);
|
||||
if (GNUNET_OK !=
|
||||
if ( (NULL == eh) ||
|
||||
(GNUNET_OK !=
|
||||
TALER_curl_easy_post (&wh->post_ctx,
|
||||
eh,
|
||||
body))
|
||||
body)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
if (NULL != eh)
|
||||
curl_easy_cleanup (eh);
|
||||
json_decref (body);
|
||||
GNUNET_free (wh->url);
|
||||
GNUNET_free (eh);
|
||||
return NULL;
|
||||
}
|
||||
json_decref (body);
|
||||
|
@ -357,7 +357,6 @@ TALER_EXCHANGE_purse_create_with_merge (
|
||||
GNUNET_free (pcm);
|
||||
return NULL;
|
||||
}
|
||||
pcm->h_contract_terms = pcm->h_contract_terms;
|
||||
pcm->merge_timestamp = merge_timestamp;
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&purse_priv->eddsa_priv,
|
||||
&pcm->purse_pub.eddsa_pub);
|
||||
@ -401,8 +400,9 @@ TALER_EXCHANGE_purse_create_with_merge (
|
||||
}
|
||||
else
|
||||
{
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_amount_set_zero (pcm->purse_value_after_fees.currency,
|
||||
&purse_fee);
|
||||
&purse_fee));
|
||||
flags = TALER_WAMF_MODE_CREATE_FROM_PURSE_QUOTA;
|
||||
}
|
||||
|
||||
|
@ -133,8 +133,10 @@ merge_cb (void *cls,
|
||||
{
|
||||
ds->reserve_history.type = TALER_EXCHANGE_RTT_MERGE;
|
||||
ds->reserve_history.amount = ds->value_after_fees;
|
||||
TALER_amount_set_zero (ds->value_after_fees.currency,
|
||||
&ds->reserve_history.details.merge_details.purse_fee);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_amount_set_zero (
|
||||
ds->value_after_fees.currency,
|
||||
&ds->reserve_history.details.merge_details.purse_fee));
|
||||
ds->reserve_history.details.merge_details.h_contract_terms
|
||||
= ds->h_contract_terms;
|
||||
ds->reserve_history.details.merge_details.merge_pub
|
||||
|
@ -1215,7 +1215,6 @@ import_key (void *cls,
|
||||
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
|
||||
"open",
|
||||
filename);
|
||||
GNUNET_break (0 == close (fd));
|
||||
return GNUNET_OK;
|
||||
}
|
||||
if (0 != fstat (fd,
|
||||
@ -1224,6 +1223,7 @@ import_key (void *cls,
|
||||
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
|
||||
"stat",
|
||||
filename);
|
||||
GNUNET_break (0 == close (fd));
|
||||
return GNUNET_OK;
|
||||
}
|
||||
if (! S_ISREG (sbuf.st_mode))
|
||||
|
@ -918,6 +918,7 @@ import_key (void *cls,
|
||||
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
|
||||
"stat",
|
||||
filename);
|
||||
GNUNET_break (0 == close (fd));
|
||||
return GNUNET_OK;
|
||||
}
|
||||
if (! S_ISREG (sbuf.st_mode))
|
||||
@ -925,6 +926,7 @@ import_key (void *cls,
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||
"File `%s' is not a regular file, which is not allowed for private keys!\n",
|
||||
filename);
|
||||
GNUNET_break (0 == close (fd));
|
||||
return GNUNET_OK;
|
||||
}
|
||||
if (0 != (sbuf.st_mode & (S_IWUSR | S_IRWXG | S_IRWXO)))
|
||||
|
@ -628,8 +628,8 @@ sem_up (struct Semaphore *sem)
|
||||
static void
|
||||
sem_done (struct Semaphore *sem)
|
||||
{
|
||||
pthread_cond_destroy (&sem->cv);
|
||||
pthread_mutex_destroy (&sem->mutex);
|
||||
GNUNET_break (0 == pthread_cond_destroy (&sem->cv));
|
||||
GNUNET_break (0 == pthread_mutex_destroy (&sem->mutex));
|
||||
}
|
||||
|
||||
|
||||
@ -1625,6 +1625,7 @@ import_key (void *cls,
|
||||
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
|
||||
"stat",
|
||||
filename);
|
||||
GNUNET_break (0 == close (fd));
|
||||
return GNUNET_OK;
|
||||
}
|
||||
if (! S_ISREG (sbuf.st_mode))
|
||||
|
Loading…
Reference in New Issue
Block a user