get code for most new endpoints to build (but DB not done)
This commit is contained in:
parent
b65a2f77eb
commit
3240844e48
@ -1 +1 @@
|
|||||||
Subproject commit 8341d17cd88b1e88943f192a47fbc61ce925816c
|
Subproject commit 3501eb7b857d573258c1ab1c42d7e827c36cec9d
|
@ -78,14 +78,22 @@ taler_exchange_transfer_LDADD = \
|
|||||||
|
|
||||||
taler_exchange_httpd_SOURCES = \
|
taler_exchange_httpd_SOURCES = \
|
||||||
taler-exchange-httpd.c taler-exchange-httpd.h \
|
taler-exchange-httpd.c taler-exchange-httpd.h \
|
||||||
|
taler-exchange-httpd_auditors.c \
|
||||||
taler-exchange-httpd_db.c taler-exchange-httpd_db.h \
|
taler-exchange-httpd_db.c taler-exchange-httpd_db.h \
|
||||||
taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.h \
|
taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.h \
|
||||||
taler-exchange-httpd_deposits_get.c taler-exchange-httpd_deposits_get.h \
|
taler-exchange-httpd_deposits_get.c taler-exchange-httpd_deposits_get.h \
|
||||||
taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \
|
taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \
|
||||||
taler-exchange-httpd_link.c taler-exchange-httpd_link.h \
|
taler-exchange-httpd_link.c taler-exchange-httpd_link.h \
|
||||||
|
taler-exchange-httpd_management_auditors.c \
|
||||||
|
taler-exchange-httpd_management_auditors_AP_disable.c \
|
||||||
|
taler-exchange-httpd_management_denominations_HDP_revoke.c \
|
||||||
|
taler-exchange-httpd_management_signkey_EP_revoke.c \
|
||||||
|
taler-exchange-httpd_management_wire.c \
|
||||||
|
taler-exchange-httpd_management_wire_disable.c \
|
||||||
|
taler-exchange-httpd_management_wire_fees.c \
|
||||||
|
taler-exchange-httpd_melt.c taler-exchange-httpd_melt.h \
|
||||||
taler-exchange-httpd_mhd.c taler-exchange-httpd_mhd.h \
|
taler-exchange-httpd_mhd.c taler-exchange-httpd_mhd.h \
|
||||||
taler-exchange-httpd_recoup.c taler-exchange-httpd_recoup.h \
|
taler-exchange-httpd_recoup.c taler-exchange-httpd_recoup.h \
|
||||||
taler-exchange-httpd_melt.c taler-exchange-httpd_melt.h \
|
|
||||||
taler-exchange-httpd_refreshes_reveal.c taler-exchange-httpd_refreshes_reveal.h \
|
taler-exchange-httpd_refreshes_reveal.c taler-exchange-httpd_refreshes_reveal.h \
|
||||||
taler-exchange-httpd_refund.c taler-exchange-httpd_refund.h \
|
taler-exchange-httpd_refund.c taler-exchange-httpd_refund.h \
|
||||||
taler-exchange-httpd_reserves_get.c taler-exchange-httpd_reserves_get.h \
|
taler-exchange-httpd_reserves_get.c taler-exchange-httpd_reserves_get.h \
|
||||||
@ -94,6 +102,10 @@ taler_exchange_httpd_SOURCES = \
|
|||||||
taler-exchange-httpd_transfers_get.c taler-exchange-httpd_transfers_get.h \
|
taler-exchange-httpd_transfers_get.c taler-exchange-httpd_transfers_get.h \
|
||||||
taler-exchange-httpd_wire.c taler-exchange-httpd_wire.h \
|
taler-exchange-httpd_wire.c taler-exchange-httpd_wire.h \
|
||||||
taler-exchange-httpd_withdraw.c taler-exchange-httpd_withdraw.h
|
taler-exchange-httpd_withdraw.c taler-exchange-httpd_withdraw.h
|
||||||
|
|
||||||
|
# taler-exchange-httpd_management_post_keys.c
|
||||||
|
|
||||||
|
|
||||||
taler_exchange_httpd_LDADD = \
|
taler_exchange_httpd_LDADD = \
|
||||||
$(LIBGCRYPT_LIBS) \
|
$(LIBGCRYPT_LIBS) \
|
||||||
$(top_builddir)/src/bank-lib/libtalerbank.la \
|
$(top_builddir)/src/bank-lib/libtalerbank.la \
|
||||||
|
@ -112,6 +112,11 @@ struct TALER_MasterPublicKeyP TEH_master_public_key;
|
|||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGEDB_Plugin *TEH_plugin;
|
struct TALER_EXCHANGEDB_Plugin *TEH_plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Our currency.
|
||||||
|
*/
|
||||||
|
char *TEH_currency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default timeout in seconds for HTTP requests.
|
* Default timeout in seconds for HTTP requests.
|
||||||
*/
|
*/
|
||||||
@ -814,6 +819,15 @@ exchange_serve_process_config (void)
|
|||||||
"REVOCATION_DIR");
|
"REVOCATION_DIR");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
TALER_config_get_currency (TEH_cfg,
|
||||||
|
&TEH_currency))
|
||||||
|
{
|
||||||
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
|
"taler",
|
||||||
|
"CURRENCY");
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
char *master_public_key_str;
|
char *master_public_key_str;
|
||||||
|
|
||||||
|
@ -68,6 +68,11 @@ extern struct TALER_MasterPublicKeyP TEH_master_public_key;
|
|||||||
*/
|
*/
|
||||||
extern struct TALER_EXCHANGEDB_Plugin *TEH_plugin;
|
extern struct TALER_EXCHANGEDB_Plugin *TEH_plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Our currency.
|
||||||
|
*/
|
||||||
|
extern char *TEH_currency;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Struct describing an URL and the handler for it.
|
* @brief Struct describing an URL and the handler for it.
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_refund.h"
|
#include "taler_signatures.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closure for the #add_auditor_denom_sig transaction.
|
* Closure for the #add_auditor_denom_sig transaction.
|
||||||
@ -78,12 +78,13 @@ add_auditor_denom_sig (void *cls,
|
|||||||
struct AddAuditorDenomContext *awc = cls;
|
struct AddAuditorDenomContext *awc = cls;
|
||||||
struct TALER_EXCHANGEDB_DenominationKeyMetaData meta;
|
struct TALER_EXCHANGEDB_DenominationKeyMetaData meta;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
char *auditor_url;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
|
||||||
qs = TEH_plugin->lookup_deomination_key (
|
qs = TEH_plugin->lookup_denomination_key (
|
||||||
TEH_plugin->cls,
|
TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
aws->h_denom_pub,
|
awc->h_denom_pub,
|
||||||
&meta);
|
&meta);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
{
|
{
|
||||||
@ -92,23 +93,25 @@ add_auditor_denom_sig (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_LOOKUP_FAILED,
|
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
||||||
"lookup denomination key");
|
"lookup denomination key");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
||||||
{
|
{
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
MHD_HTTP_NOT_FOUND,
|
connection,
|
||||||
TALER_EC_XXX,
|
MHD_HTTP_NOT_FOUND,
|
||||||
"denomination unkown");
|
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN,
|
||||||
|
GNUNET_h2s (awc->h_denom_pub));
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
qs = TEH_plugin->lookup_auditor_status (
|
qs = TEH_plugin->lookup_auditor_status (
|
||||||
TEH_plugin->cls,
|
TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
aws->auditor_pub,
|
awc->auditor_pub,
|
||||||
|
&auditor_url,
|
||||||
&enabled);
|
&enabled);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
{
|
{
|
||||||
@ -117,36 +120,39 @@ add_auditor_denom_sig (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_LOOKUP_FAILED,
|
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
||||||
"lookup auditor");
|
"lookup auditor");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
||||||
{
|
{
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
MHD_HTTP_PRECONDITION_FAILED,
|
connection,
|
||||||
TALER_EC_EXCHANGE_XXX,
|
MHD_HTTP_PRECONDITION_FAILED,
|
||||||
"auditor unkown");
|
TALER_EC_EXCHANGE_AUDITORS_AUDITOR_UNKNOWN,
|
||||||
|
TALER_B2S (awc->auditor_pub));
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
if (! enabled)
|
if (! enabled)
|
||||||
{
|
{
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
GNUNET_free (auditor_url);
|
||||||
MHD_HTTP_GONE,
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
TALER_EC_EXCHANGE_XXX,
|
connection,
|
||||||
"auditor no longer in use");
|
MHD_HTTP_GONE,
|
||||||
|
TALER_EC_EXCHANGE_AUDITORS_AUDITOR_INACTIVE,
|
||||||
|
TALER_B2S (awc->auditor_pub));
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
struct TALER_ExchangeKeyValidityPS kv = {
|
struct TALER_ExchangeKeyValidityPS kv = {
|
||||||
.purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS),
|
.purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS),
|
||||||
.purpose.size = htonl (kv),
|
.purpose.size = htonl (sizeof (kv)),
|
||||||
.master = TEH_master_public_key.eddsa_pub,
|
.master = TEH_master_public_key,
|
||||||
.start = meta->start,
|
.start = GNUNET_TIME_absolute_hton (meta.start),
|
||||||
.expire_withdraw = GNUNET_TIME_absolute_hton (meta.expire_withdraw),
|
.expire_withdraw = GNUNET_TIME_absolute_hton (meta.expire_withdraw),
|
||||||
.expire_deposit = GNUNET_TIME_absolute_hton (meta.expire_deposit),
|
.expire_deposit = GNUNET_TIME_absolute_hton (meta.expire_deposit),
|
||||||
.expire_legal = GNUNET_TIME_absolute_hton (meta.expire_legal),
|
.expire_legal = GNUNET_TIME_absolute_hton (meta.expire_legal),
|
||||||
.denom_hash = meta->denom_hash
|
.denom_hash = *awc->h_denom_pub
|
||||||
};
|
};
|
||||||
|
|
||||||
TALER_amount_hton (&kv.value,
|
TALER_amount_hton (&kv.value,
|
||||||
@ -162,19 +168,21 @@ add_auditor_denom_sig (void *cls,
|
|||||||
GNUNET_CRYPTO_hash (auditor_url,
|
GNUNET_CRYPTO_hash (auditor_url,
|
||||||
strlen (auditor_url) + 1,
|
strlen (auditor_url) + 1,
|
||||||
&kv.auditor_url_hash);
|
&kv.auditor_url_hash);
|
||||||
|
GNUNET_free (auditor_url);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS,
|
TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS,
|
||||||
&kv,
|
&kv,
|
||||||
&master_sig.eddsa_sig,
|
&awc->auditor_sig.eddsa_sig,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
/* signature invalid */
|
/* signature invalid */
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
MHD_HTTP_FORBIDDEN,
|
connection,
|
||||||
TALER_EC_EXCHANGE_XXX,
|
MHD_HTTP_FORBIDDEN,
|
||||||
NULL);
|
TALER_EC_EXCHANGE_AUDITORS_AUDITOR_SIGNATURE_INVALID,
|
||||||
|
NULL);
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,7 +191,7 @@ add_auditor_denom_sig (void *cls,
|
|||||||
session,
|
session,
|
||||||
awc->h_denom_pub,
|
awc->h_denom_pub,
|
||||||
awc->auditor_pub,
|
awc->auditor_pub,
|
||||||
&aws->auditor_sig);
|
&awc->auditor_sig);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
@ -223,6 +231,7 @@ TEH_handler_management_denominations_auditors (
|
|||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
MHD_RESULT res;
|
||||||
|
|
||||||
{
|
{
|
||||||
enum GNUNET_GenericReturnValue res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
|
@ -81,6 +81,7 @@ add_auditor (void *cls,
|
|||||||
{
|
{
|
||||||
struct AddAuditorContext *aac = cls;
|
struct AddAuditorContext *aac = cls;
|
||||||
struct GNUNET_TIME_Absolute last_date;
|
struct GNUNET_TIME_Absolute last_date;
|
||||||
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
qs = TEH_plugin->lookup_auditor_timestamp (TEH_plugin->cls,
|
qs = TEH_plugin->lookup_auditor_timestamp (TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
@ -93,16 +94,16 @@ add_auditor (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_LOOKUP_FAILED,
|
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
||||||
"lookup auditor");
|
"lookup auditor");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
if (last_date.abs_value_us > aac->start_date.abs_value_us)
|
if (last_date.abs_value_us > aac->validity_start.abs_value_us)
|
||||||
{
|
{
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_CONFLICT,
|
MHD_HTTP_CONFLICT,
|
||||||
TALER_EC_EXCHANGE_AUDITOR_MORE_RECENT_PRESENT,
|
TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_MORE_RECENT_PRESENT,
|
||||||
NULL);
|
NULL);
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
@ -111,14 +112,14 @@ add_auditor (void *cls,
|
|||||||
session,
|
session,
|
||||||
&aac->auditor_pub,
|
&aac->auditor_pub,
|
||||||
aac->auditor_url,
|
aac->auditor_url,
|
||||||
aac->start_date,
|
aac->validity_start,
|
||||||
&aac->master_sig);
|
&aac->master_sig);
|
||||||
else
|
else
|
||||||
qs = TEH_plugin->update_auditor (TEH_plugin->cls,
|
qs = TEH_plugin->update_auditor (TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
&aac->auditor_pub,
|
&aac->auditor_pub,
|
||||||
aac->auditor_url,
|
aac->auditor_url,
|
||||||
aac->start_date,
|
aac->validity_start,
|
||||||
&aac->master_sig,
|
&aac->master_sig,
|
||||||
true);
|
true);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
@ -163,6 +164,7 @@ TEH_handler_management_auditors (
|
|||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
MHD_RESULT res;
|
||||||
|
|
||||||
{
|
{
|
||||||
enum GNUNET_GenericReturnValue res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
@ -180,25 +182,25 @@ TEH_handler_management_auditors (
|
|||||||
.purpose.purpose = htonl (
|
.purpose.purpose = htonl (
|
||||||
TALER_SIGNATURE_MASTER_ADD_AUDITOR),
|
TALER_SIGNATURE_MASTER_ADD_AUDITOR),
|
||||||
.purpose.size = htonl (sizeof (aa)),
|
.purpose.size = htonl (sizeof (aa)),
|
||||||
.start_date = GNUNET_TIME_absolute_hton (validity_start),
|
.start_date = GNUNET_TIME_absolute_hton (aac.validity_start),
|
||||||
.auditor_pub = *auditor_pub
|
.auditor_pub = aac.auditor_pub
|
||||||
};
|
};
|
||||||
|
|
||||||
GNUNET_CRYPTO_hash (auditor_url,
|
GNUNET_CRYPTO_hash (aac.auditor_url,
|
||||||
strlen (auditor_url) + 1,
|
strlen (aac.auditor_url) + 1,
|
||||||
&aa.h_auditor_url);
|
&aa.h_auditor_url);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_MASTER_ADD_AUDITOR,
|
TALER_SIGNATURE_MASTER_ADD_AUDITOR,
|
||||||
&aa,
|
&aa,
|
||||||
&master_sig.eddsa_sig,
|
&aac.master_sig.eddsa_signature,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return TALER_MHD_reply_with_error (
|
return TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_FORBIDDEN,
|
MHD_HTTP_FORBIDDEN,
|
||||||
TALER_EC_EXCHANGE_AUDITOR_ADD_SIGNATURE_INVALID,
|
TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_ADD_SIGNATURE_INVALID,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,7 @@ del_auditor (void *cls,
|
|||||||
{
|
{
|
||||||
struct DelAuditorContext *dac = cls;
|
struct DelAuditorContext *dac = cls;
|
||||||
struct GNUNET_TIME_Absolute last_date;
|
struct GNUNET_TIME_Absolute last_date;
|
||||||
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
qs = TEH_plugin->lookup_auditor_timestamp (TEH_plugin->cls,
|
qs = TEH_plugin->lookup_auditor_timestamp (TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
@ -93,16 +94,16 @@ del_auditor (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_LOOKUP_FAILED,
|
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
||||||
"lookup auditor");
|
"lookup auditor");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
if (last_date.abs_value_us > dac->end_date.abs_value_us)
|
if (last_date.abs_value_us > dac->validity_end.abs_value_us)
|
||||||
{
|
{
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_CONFLICT,
|
MHD_HTTP_CONFLICT,
|
||||||
TALER_EC_EXCHANGE_AUDITOR_MORE_RECENT_PRESENT,
|
TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_MORE_RECENT_PRESENT,
|
||||||
NULL);
|
NULL);
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
@ -111,7 +112,7 @@ del_auditor (void *cls,
|
|||||||
*mhd_ret = TALER_MHD_reply_with_error (
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_NOT_FOUND,
|
MHD_HTTP_NOT_FOUND,
|
||||||
TALER_EC_EXCHANGE_AUDITOR_NOT_FOUND,
|
TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_NOT_FOUND,
|
||||||
NULL);
|
NULL);
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
@ -119,7 +120,7 @@ del_auditor (void *cls,
|
|||||||
session,
|
session,
|
||||||
&dac->auditor_pub,
|
&dac->auditor_pub,
|
||||||
"",
|
"",
|
||||||
dac->end_date,
|
dac->validity_end,
|
||||||
&dac->master_sig,
|
&dac->master_sig,
|
||||||
false);
|
false);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
@ -162,6 +163,7 @@ TEH_handler_management_auditors_AP_disable (
|
|||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
MHD_RESULT res;
|
||||||
|
|
||||||
{
|
{
|
||||||
enum GNUNET_GenericReturnValue res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
@ -179,22 +181,22 @@ TEH_handler_management_auditors_AP_disable (
|
|||||||
.purpose.purpose = htonl (
|
.purpose.purpose = htonl (
|
||||||
TALER_SIGNATURE_MASTER_DEL_AUDITOR),
|
TALER_SIGNATURE_MASTER_DEL_AUDITOR),
|
||||||
.purpose.size = htonl (sizeof (da)),
|
.purpose.size = htonl (sizeof (da)),
|
||||||
.end_date = GNUNET_TIME_absolute_hton (validity_end),
|
.end_date = GNUNET_TIME_absolute_hton (dac.validity_end),
|
||||||
.auditor_pub = *auditor_pub
|
.auditor_pub = dac.auditor_pub
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_MASTER_DEL_AUDITOR,
|
TALER_SIGNATURE_MASTER_DEL_AUDITOR,
|
||||||
&da,
|
&da,
|
||||||
&master_sig.eddsa_sig,
|
&dac.master_sig.eddsa_signature,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return TALER_MHD_reply_with_error (
|
return TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_FORBIDDEN,
|
MHD_HTTP_FORBIDDEN,
|
||||||
TALER_EC_EXCHANGE_AUDITOR_DEL_SIGNATURE_INVALID,
|
TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_DEL_SIGNATURE_INVALID,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,14 +76,14 @@ TEH_handler_management_denominations_HDP_revoke (
|
|||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
|
TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
|
||||||
&rm,
|
&rm,
|
||||||
&master_sig.eddsa_sig,
|
&master_sig.eddsa_signature,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return TALER_MHD_reply_with_error (
|
return TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_FORBIDDEN,
|
MHD_HTTP_FORBIDDEN,
|
||||||
TALER_EC_EXCHANGE_DENOMINATION_REVOKE_SIGNATURE_INVALID,
|
TALER_EC_EXCHANGE_MANAGEMENT_DENOMINATION_REVOKE_SIGNATURE_INVALID,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,8 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_refund.h"
|
#include "taler_signatures.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,7 +125,7 @@ add_keys (void *cls,
|
|||||||
bool is_active = false;
|
bool is_active = false;
|
||||||
struct TALER_EXCHANGEDB_DenominationKeyMetaData meta;
|
struct TALER_EXCHANGEDB_DenominationKeyMetaData meta;
|
||||||
|
|
||||||
qs = TEH_plugin->lookup_future_deomination_key (
|
qs = TEH_plugin->lookup_future_denomination_key (
|
||||||
TEH_plugin->cls,
|
TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
&akc->d_sigs[i].h_denom_pub,
|
&akc->d_sigs[i].h_denom_pub,
|
||||||
@ -134,7 +133,7 @@ add_keys (void *cls,
|
|||||||
if (0 == qs)
|
if (0 == qs)
|
||||||
{
|
{
|
||||||
/* For idempotency, check if the key is already active */
|
/* For idempotency, check if the key is already active */
|
||||||
qs = TEH_plugin->lookup_deomination_key (
|
qs = TEH_plugin->lookup_denomination_key (
|
||||||
TEH_plugin->cls,
|
TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
&akc->d_sigs[i].h_denom_pub,
|
&akc->d_sigs[i].h_denom_pub,
|
||||||
@ -148,17 +147,17 @@ add_keys (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_LOOKUP_FAILED,
|
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
||||||
"lookup denomination key");
|
"lookup denomination key");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
if (0 == qs)
|
if (0 == qs)
|
||||||
{
|
{
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
MHD_HTTP_NOT_FOUND,
|
connection,
|
||||||
TALER_EC_GENERIC_DENOM_UNKNOWN,
|
MHD_HTTP_NOT_FOUND,
|
||||||
GNUNET_h2s (
|
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN,
|
||||||
&aks->d_sigs[i].h_denom_pub));
|
GNUNET_h2s (&akc->d_sigs[i].h_denom_pub));
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,20 +189,20 @@ add_keys (void *cls,
|
|||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY,
|
TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY,
|
||||||
&dkv,
|
&dkv,
|
||||||
&akc->d_sigs[i].master_sig.eddsa_sig,
|
&akc->d_sigs[i].master_sig.eddsa_signature,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return TALER_MHD_reply_with_error (
|
return TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_FORBIDDEN,
|
MHD_HTTP_FORBIDDEN,
|
||||||
TALER_EC_EXCHANGE_KEYS_ADD_SIGNATURE_INVALID,
|
TALER_EC_EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_ADD_SIGNATURE_INVALID,
|
||||||
GNUNET_h2s (&aks->d_sigs[i].h_denom_pub));
|
GNUNET_h2s (&akc->d_sigs[i].h_denom_pub));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_active)
|
if (is_active)
|
||||||
continue; /* skip, already known */
|
continue; /* skip, already known */
|
||||||
qs = TEH_plugin->activate_deomination_key (
|
qs = TEH_plugin->activate_denomination_key (
|
||||||
TEH_plugin->cls,
|
TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
&akc->d_sigs[i].h_denom_pub,
|
&akc->d_sigs[i].h_denom_pub,
|
||||||
@ -252,17 +251,17 @@ add_keys (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_LOOKUP_FAILED,
|
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
||||||
"lookup signing key");
|
"lookup signing key");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
if (0 == qs)
|
if (0 == qs)
|
||||||
{
|
{
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
MHD_HTTP_NOT_FOUND,
|
connection,
|
||||||
TALER_EC_GENERIC_SIGNKEY_UNKNOWN,
|
MHD_HTTP_NOT_FOUND,
|
||||||
TALER_B2S (
|
TALER_EC_EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_UNKNOWN,
|
||||||
&aks->s_sigs[i].exchange_pub));
|
TALER_B2S (&akc->s_sigs[i].exchange_pub));
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,27 +270,27 @@ add_keys (void *cls,
|
|||||||
struct TALER_ExchangeSigningKeyValidityPS skv = {
|
struct TALER_ExchangeSigningKeyValidityPS skv = {
|
||||||
.purpose.purpose = htonl (
|
.purpose.purpose = htonl (
|
||||||
TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY),
|
TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY),
|
||||||
.purpose.size = htonl (sizeof (dkv)),
|
.purpose.size = htonl (sizeof (skv)),
|
||||||
.master_public_key = TEH_master_public_key,
|
.master_public_key = TEH_master_public_key,
|
||||||
.start = x,
|
.start = x,
|
||||||
.expire = y,
|
.expire = y,
|
||||||
.end = z,
|
.end = z,
|
||||||
.signkey_pub = akc->d_sigs[i].exchange_pub
|
.signkey_pub = akc->s_sigs[i].exchange_pub
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY,
|
TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY,
|
||||||
&skv,
|
&skv,
|
||||||
&akc->s_sigs[i].master_sig.eddsa_sig,
|
&akc->s_sigs[i].master_sig.eddsa_signature,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return TALER_MHD_reply_with_error (
|
return TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_FORBIDDEN,
|
MHD_HTTP_FORBIDDEN,
|
||||||
TALER_EC_EXCHANGE_KEYS_ADD_SIGNATURE_INVALID,
|
TALER_EC_EXCHANGE_MANAGEMENT_KEYS_DENOMKEY_ADD_SIGNATURE_INVALID,
|
||||||
GNUNET_h2s (&aks->d_sigs[i].h_denom_pub));
|
GNUNET_h2s (&akc->d_sigs[i].h_denom_pub));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_active)
|
if (is_active)
|
||||||
@ -365,7 +364,7 @@ TEH_handler_management_post_keys (
|
|||||||
return TALER_MHD_reply_with_error (
|
return TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
TALER_EC_XXX,
|
TALER_EC_GENERIC_PARAMETER_MALFORMED,
|
||||||
"array expected for denom_sigs and signkey_sigs");
|
"array expected for denom_sigs and signkey_sigs");
|
||||||
}
|
}
|
||||||
akc.nd_sigs = json_array_size (denom_sigs);
|
akc.nd_sigs = json_array_size (denom_sigs);
|
||||||
@ -375,7 +374,7 @@ TEH_handler_management_post_keys (
|
|||||||
for (unsigned int i = 0; i<akc.nd_sigs; i++)
|
for (unsigned int i = 0; i<akc.nd_sigs; i++)
|
||||||
{
|
{
|
||||||
struct DenomSig *d = &akc.d_sigs[i];
|
struct DenomSig *d = &akc.d_sigs[i];
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification ispec[] = {
|
||||||
GNUNET_JSON_spec_fixed_auto ("master_sig",
|
GNUNET_JSON_spec_fixed_auto ("master_sig",
|
||||||
&d->master_sig),
|
&d->master_sig),
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
|
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
|
||||||
@ -385,9 +384,9 @@ TEH_handler_management_post_keys (
|
|||||||
enum GNUNET_GenericReturnValue res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
|
|
||||||
res = TALER_MHD_parse_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
root,
|
|
||||||
json_array_get (denom_sigs,
|
json_array_get (denom_sigs,
|
||||||
i));
|
i),
|
||||||
|
ispec);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
{
|
{
|
||||||
ret = MHD_NO; /* hard failure */
|
ret = MHD_NO; /* hard failure */
|
||||||
@ -412,7 +411,7 @@ TEH_handler_management_post_keys (
|
|||||||
for (unsigned int i = 0; i<akc.nd_sigs; i++)
|
for (unsigned int i = 0; i<akc.nd_sigs; i++)
|
||||||
{
|
{
|
||||||
struct SigningSig *s = &akc.s_sigs[i];
|
struct SigningSig *s = &akc.s_sigs[i];
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification ispec[] = {
|
||||||
GNUNET_JSON_spec_fixed_auto ("master_sig",
|
GNUNET_JSON_spec_fixed_auto ("master_sig",
|
||||||
&s->master_sig),
|
&s->master_sig),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
||||||
@ -422,9 +421,9 @@ TEH_handler_management_post_keys (
|
|||||||
enum GNUNET_GenericReturnValue res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
|
|
||||||
res = TALER_MHD_parse_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
root,
|
|
||||||
json_array_get (signkey_sigs,
|
json_array_get (signkey_sigs,
|
||||||
i));
|
i),
|
||||||
|
ispec);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
{
|
{
|
||||||
ret = MHD_NO; /* hard failure */
|
ret = MHD_NO; /* hard failure */
|
||||||
@ -446,11 +445,11 @@ TEH_handler_management_post_keys (
|
|||||||
}
|
}
|
||||||
qs = TEH_DB_run_transaction (connection,
|
qs = TEH_DB_run_transaction (connection,
|
||||||
"add keys",
|
"add keys",
|
||||||
&res,
|
&ret,
|
||||||
&add_keys,
|
&add_keys,
|
||||||
&akc);
|
&akc);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
return res;
|
return ret;
|
||||||
return TALER_MHD_reply_static (
|
return TALER_MHD_reply_static (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_NO_CONTENT,
|
MHD_HTTP_NO_CONTENT,
|
||||||
|
@ -64,7 +64,7 @@ TEH_handler_management_signkeys_EP_revoke (
|
|||||||
return MHD_YES; /* failure */
|
return MHD_YES; /* failure */
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
struct TALER_MasterDenominationKeyRevocationPS rm = {
|
struct TALER_MasterSigningKeyRevocationPS rm = {
|
||||||
.purpose.purpose = htonl (
|
.purpose.purpose = htonl (
|
||||||
TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED),
|
TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED),
|
||||||
.purpose.size = htonl (sizeof (rm)),
|
.purpose.size = htonl (sizeof (rm)),
|
||||||
@ -75,14 +75,14 @@ TEH_handler_management_signkeys_EP_revoke (
|
|||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED,
|
TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED,
|
||||||
&rm,
|
&rm,
|
||||||
&master_sig.eddsa_sig,
|
&master_sig.eddsa_signature,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return TALER_MHD_reply_with_error (
|
return TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_FORBIDDEN,
|
MHD_HTTP_FORBIDDEN,
|
||||||
TALER_EC_EXCHANGE_SIGNKEY_REVOKE_SIGNATURE_INVALID,
|
TALER_EC_EXCHANGE_MANAGEMENT_SIGNKEY_REVOKE_SIGNATURE_INVALID,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_refund.h"
|
#include "taler_signatures.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closure for the #add_wire transaction.
|
* Closure for the #add_wire transaction.
|
||||||
@ -50,7 +50,7 @@ struct AddWireContext
|
|||||||
/**
|
/**
|
||||||
* Payto:// URI this is about.
|
* Payto:// URI this is about.
|
||||||
*/
|
*/
|
||||||
const char *payto_url;
|
const char *payto_uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timestamp for checking against replay attacks.
|
* Timestamp for checking against replay attacks.
|
||||||
@ -83,6 +83,7 @@ add_wire (void *cls,
|
|||||||
{
|
{
|
||||||
struct AddWireContext *awc = cls;
|
struct AddWireContext *awc = cls;
|
||||||
struct GNUNET_TIME_Absolute last_date;
|
struct GNUNET_TIME_Absolute last_date;
|
||||||
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
qs = TEH_plugin->lookup_wire_timestamp (TEH_plugin->cls,
|
qs = TEH_plugin->lookup_wire_timestamp (TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
@ -95,31 +96,30 @@ add_wire (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_LOOKUP_FAILED,
|
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
||||||
"lookup wire");
|
"lookup wire");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
if (last_date.abs_value_us > awc->start_date.abs_value_us)
|
if (last_date.abs_value_us > awc->validity_start.abs_value_us)
|
||||||
{
|
{
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_CONFLICT,
|
MHD_HTTP_CONFLICT,
|
||||||
TALER_EC_EXCHANGE_WIRE_MORE_RECENT_PRESENT,
|
TALER_EC_EXCHANGE_MANAGEMENT_WIRE_MORE_RECENT_PRESENT,
|
||||||
NULL);
|
NULL);
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
if (0 == qs)
|
if (0 == qs)
|
||||||
qs = TEH_plugin->insert_wire (TEH_plugin->cls,
|
qs = TEH_plugin->insert_wire (TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
&awc->payto_uri,
|
awc->payto_uri,
|
||||||
awc->start_date,
|
awc->validity_start,
|
||||||
&awc->master_sig_add);
|
&awc->master_sig_wire);
|
||||||
else
|
else
|
||||||
qs = TEH_plugin->update_wire (TEH_plugin->cls,
|
qs = TEH_plugin->update_wire (TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
&awc->payto_uri,
|
awc->payto_uri,
|
||||||
awc->start_date,
|
awc->validity_start,
|
||||||
&awc->master_sig_add,
|
|
||||||
true);
|
true);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
{
|
{
|
||||||
@ -132,21 +132,6 @@ add_wire (void *cls,
|
|||||||
"add wire");
|
"add wire");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
qs = TEH_plugin->insert_wire_details (TEH_plugin->cls,
|
|
||||||
session,
|
|
||||||
&awc->payto_uri,
|
|
||||||
&awc->master_sig_wire);
|
|
||||||
if (qs < 0)
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
|
||||||
return qs;
|
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
|
||||||
TALER_EC_GENERIC_DB_STORE_FAILED,
|
|
||||||
"add wire details");
|
|
||||||
return qs;
|
|
||||||
}
|
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +161,7 @@ TEH_handler_management_denominations_wire (
|
|||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
MHD_RESULT ret;
|
||||||
|
|
||||||
{
|
{
|
||||||
enum GNUNET_GenericReturnValue res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
@ -190,10 +176,9 @@ TEH_handler_management_denominations_wire (
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
struct TALER_MasterAddWirePS aw = {
|
struct TALER_MasterAddWirePS aw = {
|
||||||
.purpose.purpose = htonl (
|
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_WIRE),
|
||||||
TALER_SIGNATURE_MASTER_ADD_WIRE),
|
|
||||||
.purpose.size = htonl (sizeof (aw)),
|
.purpose.size = htonl (sizeof (aw)),
|
||||||
.start_date = GNUNET_TIME_absolute_hton (validity_start),
|
.start_date = GNUNET_TIME_absolute_hton (awc.validity_start),
|
||||||
};
|
};
|
||||||
|
|
||||||
GNUNET_CRYPTO_hash (awc.payto_uri,
|
GNUNET_CRYPTO_hash (awc.payto_uri,
|
||||||
@ -203,14 +188,14 @@ TEH_handler_management_denominations_wire (
|
|||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_MASTER_ADD_WIRE,
|
TALER_SIGNATURE_MASTER_ADD_WIRE,
|
||||||
&aw,
|
&aw,
|
||||||
&master_sig.eddsa_sig,
|
&awc.master_sig_add.eddsa_signature,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return TALER_MHD_reply_with_error (
|
return TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_FORBIDDEN,
|
MHD_HTTP_FORBIDDEN,
|
||||||
TALER_EC_EXCHANGE_WIRE_ADD_SIGNATURE_INVALID,
|
TALER_EC_EXCHANGE_MANAGEMENT_WIRE_ADD_SIGNATURE_INVALID,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,30 +208,30 @@ TEH_handler_management_denominations_wire (
|
|||||||
|
|
||||||
GNUNET_CRYPTO_hash (awc.payto_uri,
|
GNUNET_CRYPTO_hash (awc.payto_uri,
|
||||||
strlen (awc.payto_uri) + 1,
|
strlen (awc.payto_uri) + 1,
|
||||||
&wd.h_wire);
|
&wd.h_wire_details);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_MASTER_WIRE_DETAILS,
|
TALER_SIGNATURE_MASTER_WIRE_DETAILS,
|
||||||
&wd,
|
&wd,
|
||||||
&master_sig.eddsa_sig,
|
&awc.master_sig_wire.eddsa_signature,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return TALER_MHD_reply_with_error (
|
return TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_FORBIDDEN,
|
MHD_HTTP_FORBIDDEN,
|
||||||
TALER_EC_EXCHANGE_WIRE_DETALS_SIGNATURE_INVALID,
|
TALER_EC_EXCHANGE_MANAGEMENT_WIRE_DETAILS_SIGNATURE_INVALID,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qs = TEH_DB_run_transaction (connection,
|
qs = TEH_DB_run_transaction (connection,
|
||||||
"add wire",
|
"add wire",
|
||||||
&res,
|
&ret,
|
||||||
&add_wire,
|
&add_wire,
|
||||||
&awc);
|
&awc);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
return res;
|
return ret;
|
||||||
return TALER_MHD_reply_static (
|
return TALER_MHD_reply_static (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_NO_CONTENT,
|
MHD_HTTP_NO_CONTENT,
|
||||||
|
@ -44,12 +44,12 @@ struct DelWireContext
|
|||||||
/**
|
/**
|
||||||
* Payto:// URI this is about.
|
* Payto:// URI this is about.
|
||||||
*/
|
*/
|
||||||
const char *payto_url;
|
const char *payto_uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timestamp for checking against replay attacks.
|
* Timestamp for checking against replay attacks.
|
||||||
*/
|
*/
|
||||||
struct GNUNET_TIME_Absolute validity_start;
|
struct GNUNET_TIME_Absolute validity_end;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -77,11 +77,12 @@ del_wire (void *cls,
|
|||||||
{
|
{
|
||||||
struct DelWireContext *awc = cls;
|
struct DelWireContext *awc = cls;
|
||||||
struct GNUNET_TIME_Absolute last_date;
|
struct GNUNET_TIME_Absolute last_date;
|
||||||
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
qs = TEH_plugin->lookup_wire (TEH_plugin->cls,
|
qs = TEH_plugin->lookup_wire_timestamp (TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
awc->payto_uri,
|
awc->payto_uri,
|
||||||
&last_date);
|
&last_date);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
{
|
{
|
||||||
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
||||||
@ -89,32 +90,33 @@ del_wire (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_LOOKUP_FAILED,
|
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
||||||
"lookup wire");
|
"lookup wire");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
if (last_date.abs_value_us > awc->start_date.abs_value_us)
|
if (last_date.abs_value_us > awc->validity_end.abs_value_us)
|
||||||
{
|
{
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_CONFLICT,
|
MHD_HTTP_CONFLICT,
|
||||||
TALER_EC_EXCHANGE_WIRE_MORE_RECENT_PRESENT,
|
TALER_EC_EXCHANGE_MANAGEMENT_WIRE_MORE_RECENT_PRESENT,
|
||||||
NULL);
|
NULL);
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
if (0 == qs)
|
if (0 == qs)
|
||||||
qs = TEH_plugin->insert_wire (TEH_plugin->cls,
|
{
|
||||||
session,
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
&awc->payto_uri,
|
connection,
|
||||||
awc->end_date,
|
MHD_HTTP_NOT_FOUND,
|
||||||
&awc->master_sig_del);
|
TALER_EC_EXCHANGE_MANAGEMENT_WIRE_NOT_FOUND,
|
||||||
else
|
NULL);
|
||||||
qs = TEH_plugin->update_wire (TEH_plugin->cls,
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
session,
|
}
|
||||||
&awc->payto_uri,
|
qs = TEH_plugin->update_wire (TEH_plugin->cls,
|
||||||
awc->end_date,
|
session,
|
||||||
&awc->master_sig_del,
|
awc->payto_uri,
|
||||||
false);
|
awc->validity_end,
|
||||||
|
false);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
@ -126,20 +128,6 @@ del_wire (void *cls,
|
|||||||
"del wire");
|
"del wire");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
qs = TEH_plugin->delete_wire_details (TEH_plugin->cls,
|
|
||||||
session,
|
|
||||||
&awc->payto_uri);
|
|
||||||
if (qs < 0)
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
|
||||||
return qs;
|
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
|
||||||
TALER_EC_GENERIC_DB_STORE_FAILED,
|
|
||||||
"del wire details");
|
|
||||||
return qs;
|
|
||||||
}
|
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,6 +155,7 @@ TEH_handler_management_denominations_wire_disable (
|
|||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
MHD_RESULT ret;
|
||||||
|
|
||||||
{
|
{
|
||||||
enum GNUNET_GenericReturnValue res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
@ -184,7 +173,7 @@ TEH_handler_management_denominations_wire_disable (
|
|||||||
.purpose.purpose = htonl (
|
.purpose.purpose = htonl (
|
||||||
TALER_SIGNATURE_MASTER_DEL_WIRE),
|
TALER_SIGNATURE_MASTER_DEL_WIRE),
|
||||||
.purpose.size = htonl (sizeof (aw)),
|
.purpose.size = htonl (sizeof (aw)),
|
||||||
.end_date = GNUNET_TIME_absolute_hton (validity_end),
|
.end_date = GNUNET_TIME_absolute_hton (awc.validity_end),
|
||||||
};
|
};
|
||||||
|
|
||||||
GNUNET_CRYPTO_hash (awc.payto_uri,
|
GNUNET_CRYPTO_hash (awc.payto_uri,
|
||||||
@ -194,24 +183,24 @@ TEH_handler_management_denominations_wire_disable (
|
|||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_MASTER_DEL_WIRE,
|
TALER_SIGNATURE_MASTER_DEL_WIRE,
|
||||||
&aw,
|
&aw,
|
||||||
&master_sig.eddsa_sig,
|
&awc.master_sig.eddsa_signature,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return TALER_MHD_reply_with_error (
|
return TALER_MHD_reply_with_error (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_FORBIDDEN,
|
MHD_HTTP_FORBIDDEN,
|
||||||
TALER_EC_EXCHANGE_WIRE_DEL_SIGNATURE_INVALID,
|
TALER_EC_EXCHANGE_MANAGEMENT_WIRE_DEL_SIGNATURE_INVALID,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qs = TEH_DB_run_transaction (connection,
|
qs = TEH_DB_run_transaction (connection,
|
||||||
"del wire",
|
"del wire",
|
||||||
&res,
|
&ret,
|
||||||
&del_wire,
|
&del_wire,
|
||||||
&awc);
|
&awc);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
return res;
|
return ret;
|
||||||
return TALER_MHD_reply_static (
|
return TALER_MHD_reply_static (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_NO_CONTENT,
|
MHD_HTTP_NO_CONTENT,
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_refund.h"
|
#include "taler_signatures.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closure for the #add_fee transaction.
|
* Closure for the #add_fee transaction.
|
||||||
@ -94,12 +94,12 @@ add_fee (void *cls,
|
|||||||
struct TALER_Amount wire_fee;
|
struct TALER_Amount wire_fee;
|
||||||
struct TALER_Amount closing_fee;
|
struct TALER_Amount closing_fee;
|
||||||
|
|
||||||
qs = TEH_plugin->lookup_wire_fee (
|
qs = TEH_plugin->lookup_wire_fee_by_time (
|
||||||
TEH_plugin->cls,
|
TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
aws->wire_method,
|
afc->wire_method,
|
||||||
aws->start_time,
|
afc->start_time,
|
||||||
aws->end_time,
|
afc->end_time,
|
||||||
&wire_fee,
|
&wire_fee,
|
||||||
&closing_fee);
|
&closing_fee);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
@ -109,7 +109,7 @@ add_fee (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_LOOKUP_FAILED,
|
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
||||||
"lookup wire fee");
|
"lookup wire fee");
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
@ -129,10 +129,11 @@ add_fee (void *cls,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
*mhd_ret = TALER_MHD_reply_with_error (
|
||||||
MHD_HTTP_CONFLICT,
|
connection,
|
||||||
TALER_EC_XXX,
|
MHD_HTTP_CONFLICT,
|
||||||
NULL);
|
TALER_EC_EXCHANGE_MANAGEMENT_WIRE_FEE_MISMATCH,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
@ -140,12 +141,12 @@ add_fee (void *cls,
|
|||||||
qs = TEH_plugin->insert_wire_fee (
|
qs = TEH_plugin->insert_wire_fee (
|
||||||
TEH_plugin->cls,
|
TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
aws->wire_method,
|
afc->wire_method,
|
||||||
aws->start_time,
|
afc->start_time,
|
||||||
aws->end_time,
|
afc->end_time,
|
||||||
&aws->wire_fee,
|
&afc->wire_fee,
|
||||||
&aws->closing_fee,
|
&afc->closing_fee,
|
||||||
&aws->master_sig);
|
&afc->master_sig);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
{
|
{
|
||||||
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
||||||
@ -179,10 +180,10 @@ TEH_handler_management_post_wire_fees (
|
|||||||
&afc.master_sig),
|
&afc.master_sig),
|
||||||
GNUNET_JSON_spec_string ("wire_method",
|
GNUNET_JSON_spec_string ("wire_method",
|
||||||
&afc.wire_method),
|
&afc.wire_method),
|
||||||
TALER_JSON_spec_time_abs ("fee_start",
|
TALER_JSON_spec_absolute_time ("fee_start",
|
||||||
&afc.start_time),
|
&afc.start_time),
|
||||||
TALER_JSON_spec_time_abs ("fee_end",
|
TALER_JSON_spec_absolute_time ("fee_end",
|
||||||
&afc.end_time),
|
&afc.end_time),
|
||||||
TALER_JSON_spec_amount ("closing_fee",
|
TALER_JSON_spec_amount ("closing_fee",
|
||||||
&afc.closing_fee),
|
&afc.closing_fee),
|
||||||
TALER_JSON_spec_amount ("wire_fee",
|
TALER_JSON_spec_amount ("wire_fee",
|
||||||
@ -190,6 +191,7 @@ TEH_handler_management_post_wire_fees (
|
|||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
MHD_RESULT ret;
|
||||||
|
|
||||||
{
|
{
|
||||||
enum GNUNET_GenericReturnValue res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
@ -211,7 +213,7 @@ TEH_handler_management_post_wire_fees (
|
|||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return TALER_MHD_reply_with_error (connection,
|
return TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
TALER_EC_GENERIC_BAD_CURRENCY,
|
TALER_EC_GENERIC_CURRENCY_MISMATCH,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
if (0 !=
|
if (0 !=
|
||||||
@ -221,21 +223,21 @@ TEH_handler_management_post_wire_fees (
|
|||||||
/* currency does not match exchange's currency */
|
/* currency does not match exchange's currency */
|
||||||
return TALER_MHD_reply_with_error (connection,
|
return TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_PRECONDITION_FAILED,
|
MHD_HTTP_PRECONDITION_FAILED,
|
||||||
TALER_EC_GENERIC_BAD_CURRENCY,
|
TALER_EC_GENERIC_CURRENCY_MISMATCH,
|
||||||
TEH_currency);
|
TEH_currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
struct TALER_MasterWireFeePS wf = {
|
struct TALER_MasterWireFeePS wf = {
|
||||||
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES),
|
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES),
|
||||||
.purpose.size = htonl (wf),
|
.purpose.size = htonl (sizeof (wf)),
|
||||||
.start_date = GNUNET_TIME_absolute_hton (afc.start_date),
|
.start_date = GNUNET_TIME_absolute_hton (afc.start_time),
|
||||||
.end_date = GNUNET_TIME_absolute_hton (afc.end_date),
|
.end_date = GNUNET_TIME_absolute_hton (afc.end_time),
|
||||||
};
|
};
|
||||||
|
|
||||||
TALER_amount_hton (&kv.wire_fee,
|
TALER_amount_hton (&wf.wire_fee,
|
||||||
&afc.wire_fee);
|
&afc.wire_fee);
|
||||||
TALER_amount_hton (&kv.closing_fee,
|
TALER_amount_hton (&wf.closing_fee,
|
||||||
&afc.closing_fee);
|
&afc.closing_fee);
|
||||||
GNUNET_CRYPTO_hash (afc.wire_method,
|
GNUNET_CRYPTO_hash (afc.wire_method,
|
||||||
strlen (afc.wire_method) + 1,
|
strlen (afc.wire_method) + 1,
|
||||||
@ -244,26 +246,26 @@ TEH_handler_management_post_wire_fees (
|
|||||||
GNUNET_CRYPTO_eddsa_verify (
|
GNUNET_CRYPTO_eddsa_verify (
|
||||||
TALER_SIGNATURE_MASTER_WIRE_FEES,
|
TALER_SIGNATURE_MASTER_WIRE_FEES,
|
||||||
&wf,
|
&wf,
|
||||||
&afc.master_sig.eddsa_sig,
|
&afc.master_sig.eddsa_signature,
|
||||||
&TEH_master_public_key.eddsa_pub))
|
&TEH_master_public_key.eddsa_pub))
|
||||||
{
|
{
|
||||||
/* signature invalid */
|
/* signature invalid */
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
return TALER_MHD_reply_with_error (
|
||||||
MHD_HTTP_FORBIDDEN,
|
connection,
|
||||||
TALER_EC_EXCHANGE_XXX,
|
MHD_HTTP_FORBIDDEN,
|
||||||
NULL);
|
TALER_EC_EXCHANGE_MANAGEMENT_WIRE_FEE_SIGNATURE_INVALID,
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qs = TEH_DB_run_transaction (connection,
|
qs = TEH_DB_run_transaction (connection,
|
||||||
"add wire fee",
|
"add wire fee",
|
||||||
&res,
|
&ret,
|
||||||
&add_fee,
|
&add_fee,
|
||||||
&afc);
|
&afc);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
return res;
|
return ret;
|
||||||
return TALER_MHD_reply_static (
|
return TALER_MHD_reply_static (
|
||||||
connection,
|
connection,
|
||||||
MHD_HTTP_NO_CONTENT,
|
MHD_HTTP_NO_CONTENT,
|
||||||
|
@ -141,6 +141,8 @@ COMMENT ON TABLE wire_accounts
|
|||||||
IS 'Table with current and historic bank accounts of the exchange. Entries never expire as we need to remember the last_change column indefinitely.';
|
IS 'Table with current and historic bank accounts of the exchange. Entries never expire as we need to remember the last_change column indefinitely.';
|
||||||
COMMENT ON COLUMN wire_accounts.payto_uri
|
COMMENT ON COLUMN wire_accounts.payto_uri
|
||||||
IS 'payto URI (RFC 8905) with the bank account of the exchange.';
|
IS 'payto URI (RFC 8905) with the bank account of the exchange.';
|
||||||
|
COMMENT ON COLUMN wire_accounts.master_sig
|
||||||
|
IS 'Signature of purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS';
|
||||||
COMMENT ON COLUMN wire_accounts.is_active
|
COMMENT ON COLUMN wire_accounts.is_active
|
||||||
IS 'true if we are currently supporting the use of this account.';
|
IS 'true if we are currently supporting the use of this account.';
|
||||||
COMMENT ON COLUMN wire_accounts.last_change
|
COMMENT ON COLUMN wire_accounts.last_change
|
||||||
|
@ -2977,7 +2977,8 @@ struct TALER_EXCHANGEDB_Plugin
|
|||||||
* @param cls closure
|
* @param cls closure
|
||||||
* @param session a session
|
* @param session a session
|
||||||
* @param auditor_pub key to look up information for
|
* @param auditor_pub key to look up information for
|
||||||
* @param[out] set to the base URL of the auditor's REST API
|
* @param[out] set to the base URL of the auditor's REST API; memory to be
|
||||||
|
* released by the caller!
|
||||||
* @param[out] enabled set if the auditor is currently in use
|
* @param[out] enabled set if the auditor is currently in use
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
@ -2985,7 +2986,7 @@ struct TALER_EXCHANGEDB_Plugin
|
|||||||
(*lookup_auditor_status)(void *cls,
|
(*lookup_auditor_status)(void *cls,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
const struct TALER_AuditorPublicKeyP *auditor_pub,
|
const struct TALER_AuditorPublicKeyP *auditor_pub,
|
||||||
char *auditor_url,
|
char **auditor_url,
|
||||||
bool *enabled);
|
bool *enabled);
|
||||||
|
|
||||||
|
|
||||||
@ -3057,7 +3058,8 @@ struct TALER_EXCHANGEDB_Plugin
|
|||||||
* @param payto_uri wire account of the exchange
|
* @param payto_uri wire account of the exchange
|
||||||
* @param start_date date when the account was added by the offline system
|
* @param start_date date when the account was added by the offline system
|
||||||
* (only to be used for replay detection)
|
* (only to be used for replay detection)
|
||||||
* @param master_sig signature affirming the addition of the account
|
* @param master_sig public signature affirming the existence of the account,
|
||||||
|
* must be of purpose #TALER_SIGNATURE_MASTER_WIRE_DETAILS
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
enum GNUNET_DB_QueryStatus
|
enum GNUNET_DB_QueryStatus
|
||||||
@ -3076,7 +3078,6 @@ struct TALER_EXCHANGEDB_Plugin
|
|||||||
* @param payto_uri account the update is about
|
* @param payto_uri account the update is about
|
||||||
* @param change_date date when the account status was last changed
|
* @param change_date date when the account status was last changed
|
||||||
* (only to be used for replay detection)
|
* (only to be used for replay detection)
|
||||||
* @param master_sig signature affirming the change in status (enable or disable)
|
|
||||||
* @param enabled true to enable, false to disable (the actual change)
|
* @param enabled true to enable, false to disable (the actual change)
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
@ -3085,7 +3086,6 @@ struct TALER_EXCHANGEDB_Plugin
|
|||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
const char *payto_uri,
|
const char *payto_uri,
|
||||||
struct GNUNET_TIME_Absolute change_date,
|
struct GNUNET_TIME_Absolute change_date,
|
||||||
const struct TALER_MasterSignatureP *master_sig,
|
|
||||||
bool enabled);
|
bool enabled);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user