Compare commits
2 Commits
e7aeec04f4
...
fea5bee835
Author | SHA1 | Date | |
---|---|---|---|
fea5bee835 | |||
d7342c17c6 |
@ -171,6 +171,7 @@ extension_update_event_cb (void *cls,
|
||||
// Get the config from the database as string
|
||||
{
|
||||
char *config_str;
|
||||
struct TALER_MasterSignatureP config_sig; // ignored
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
struct TALER_Extension *extension;
|
||||
json_error_t err;
|
||||
@ -182,7 +183,8 @@ extension_update_event_cb (void *cls,
|
||||
|
||||
qs = TEH_plugin->get_extension_config (TEH_plugin->cls,
|
||||
extension->name,
|
||||
&config_str);
|
||||
&config_str,
|
||||
&config_sig);
|
||||
|
||||
if (qs < 0)
|
||||
{
|
||||
|
@ -2753,8 +2753,11 @@ prepare_statements (struct PostgresClosure *pg)
|
||||
/* Used in #postgres_get_extension_config */
|
||||
GNUNET_PQ_make_prepare (
|
||||
"get_extension_config",
|
||||
"SELECT (config) FROM extensions"
|
||||
" WHERE name=$1;",
|
||||
"SELECT "
|
||||
" config, "
|
||||
" config_sig "
|
||||
"FROM extensions"
|
||||
" WHERE name=$1;",
|
||||
1),
|
||||
GNUNET_PQ_PREPARED_STATEMENT_END
|
||||
};
|
||||
@ -11446,7 +11449,8 @@ postgres_set_extension_config (void *cls,
|
||||
enum GNUNET_DB_QueryStatus
|
||||
postgres_get_extension_config (void *cls,
|
||||
const char *extension_name,
|
||||
char **config)
|
||||
char **config,
|
||||
struct TALER_MasterSignatureP *config_sig)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
@ -11455,6 +11459,7 @@ postgres_get_extension_config (void *cls,
|
||||
};
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_string ("config", config),
|
||||
GNUNET_PQ_result_spec_auto_from_type ("config_sig", config_sig),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
|
@ -108,6 +108,49 @@ mark_prepare_cb (void *cls,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple check that config retrieval and setting for extensions work
|
||||
*/
|
||||
static enum GNUNET_GenericReturnValue
|
||||
test_extension_config (void)
|
||||
{
|
||||
char *config;
|
||||
struct TALER_MasterSignatureP sig;
|
||||
|
||||
memset (&sig, 0x42, sizeof(sig));
|
||||
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
|
||||
plugin->get_extension_config (plugin->cls,
|
||||
"fnord",
|
||||
&config,
|
||||
&sig));
|
||||
|
||||
sig.eddsa_signature.r[23] = 0x23;
|
||||
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
plugin->set_extension_config (plugin->cls,
|
||||
"fnord",
|
||||
"bar",
|
||||
&sig));
|
||||
|
||||
memset (&sig, 0, sizeof(sig));
|
||||
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
plugin->get_extension_config (plugin->cls,
|
||||
"fnord",
|
||||
&config,
|
||||
&sig));
|
||||
|
||||
FAILIF (0 != strcmp ("bar", config));
|
||||
|
||||
FAILIF (0x23 != sig.eddsa_signature.r[23]);
|
||||
|
||||
return GNUNET_OK;
|
||||
drop:
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test API relating to persisting the wire plugins preparation data.
|
||||
*
|
||||
@ -1334,6 +1377,10 @@ run (void *cls)
|
||||
0,
|
||||
&recoup_cb,
|
||||
NULL));
|
||||
/* simple extension check */
|
||||
FAILIF (GNUNET_OK !=
|
||||
test_extension_config ());
|
||||
|
||||
RND_BLK (&reserve_pub);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":1.000010",
|
||||
|
@ -4049,7 +4049,8 @@ struct TALER_EXCHANGEDB_Plugin
|
||||
enum GNUNET_DB_QueryStatus
|
||||
(*get_extension_config)(void *cls,
|
||||
const char *extension_name,
|
||||
char **config);
|
||||
char **config,
|
||||
struct TALER_MasterSignatureP *config_sig);
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user