summaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2022-01-11 15:24:43 +0100
committerÖzgür Kesim <oec-taler@kesim.org>2022-01-21 15:41:02 +0100
commit0b56de6c994d3e525aa2d0195ff4607db3f14715 (patch)
tree9f34c40155dd5538841497c9f6a151deb2305a8d /src/exchangedb/plugin_exchangedb_postgres.c
parent0b6ebc6160f1fd1f6db7c433f0912b5d2845a59c (diff)
downloadexchange-0b56de6c994d3e525aa2d0195ff4607db3f14715.tar.gz
exchange-0b56de6c994d3e525aa2d0195ff4607db3f14715.tar.bz2
exchange-0b56de6c994d3e525aa2d0195ff4607db3f14715.zip
[age restriction] progress 12/n
- taler-offline-tool now handles extensions - command "extensions" added with subcommands "show" and "sign" - parses extensions from taler config - shows and signs of extensions and their configurations - creates signed set of configurations for upload - added test for retrieval of extension config - simplified signature verification for extensions - remove per-extension signatures, also from DB schema - adjust prepared statements accordingly - adjust DB event handler for extensions - allow NULL for config for extension in DB schema - handler for /management/extensions adjusted to new datastructures - changed test for TALER_denom_blind/TALER_denom_sign_blinded with and without TALER_AgeHash - minor updates and various fixes
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 4b0096078..918fc38ca 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -2745,15 +2745,17 @@ prepare_statements (struct PostgresClosure *pg)
/* Used in #postgres_set_extension_config */
GNUNET_PQ_make_prepare (
"set_extension_config",
- "INSERT INTO extensions (name, config, config_sig) VALUES ($1, $2, $3) "
+ "INSERT INTO extensions (name, config) VALUES ($1, $2) "
"ON CONFLICT (name) "
- "DO UPDATE SET (config, config_sig) = ($2, $3)",
- 3),
+ "DO UPDATE SET config=$2",
+ 2),
/* Used in #postgres_get_extension_config */
GNUNET_PQ_make_prepare (
"get_extension_config",
- "SELECT (config) FROM extensions"
- " WHERE name=$1;",
+ "SELECT "
+ " config "
+ "FROM extensions"
+ " WHERE name=$1;",
1),
GNUNET_PQ_PREPARED_STATEMENT_END
};
@@ -11410,20 +11412,20 @@ postgres_delete_shard_locks (void *cls)
* @param cls the @e cls of this struct with the plugin-specific state
* @param extension_name the name of the extension
* @param config JSON object of the configuration as string
- * @param config_sig signature of the configuration by the offline master key
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
postgres_set_extension_config (void *cls,
const char *extension_name,
- const char *config,
- const struct TALER_MasterSignatureP *config_sig)
+ const char *config)
{
struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam pcfg = (NULL == config || 0 == *config) ?
+ GNUNET_PQ_query_param_null () :
+ GNUNET_PQ_query_param_string (config);
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (extension_name),
- GNUNET_PQ_query_param_string (config),
- GNUNET_PQ_query_param_auto_from_type (config_sig),
+ pcfg,
GNUNET_PQ_query_param_end
};
@@ -11452,15 +11454,24 @@ postgres_get_extension_config (void *cls,
GNUNET_PQ_query_param_string (extension_name),
GNUNET_PQ_query_param_end
};
+ bool is_null;
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_string ("config", config),
+ GNUNET_PQ_result_spec_allow_null (
+ GNUNET_PQ_result_spec_string ("config", config),
+ &is_null),
GNUNET_PQ_result_spec_end
};
+ enum GNUNET_DB_QueryStatus qs;
- return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "get_extension_config",
- params,
- rs);
+ qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "get_extension_config",
+ params,
+ rs);
+ if (is_null)
+ {
+ *config = NULL;
+ }
+ return qs;
}