diff options
-rw-r--r-- | src/exchange/taler-exchange-httpd.c | 13 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_db.c | 2 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_wire.c | 25 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_wire.h | 10 | ||||
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 4 |
5 files changed, 42 insertions, 12 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index 11cf00dd1..fa000d06b 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -625,10 +625,6 @@ exchange_serve_process_config () return GNUNET_SYSERR; } if (GNUNET_OK != - TEH_VALIDATION_init (cfg)) - return GNUNET_SYSERR; - - if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "exchange", "master_public_key", @@ -637,7 +633,6 @@ exchange_serve_process_config () GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "exchange", "master_public_key"); - TEH_VALIDATION_done (); return GNUNET_SYSERR; } if (GNUNET_OK != @@ -648,11 +643,17 @@ exchange_serve_process_config () fprintf (stderr, "Invalid master public key given in exchange configuration."); GNUNET_free (TEH_master_public_key_str); - TEH_VALIDATION_done (); return GNUNET_SYSERR; } GNUNET_free (TEH_master_public_key_str); + if ( (GNUNET_OK != + TEH_VALIDATION_init (cfg)) || + (GNUNET_OK != + TEH_WIRE_init ()) ) + return GNUNET_SYSERR; + + if (NULL == (TEH_plugin = TALER_EXCHANGEDB_plugin_load (cfg))) { diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c index 9257cbef8..589229f7e 100644 --- a/src/exchange/taler-exchange-httpd_db.c +++ b/src/exchange/taler-exchange-httpd_db.c @@ -615,7 +615,7 @@ TEH_DB_execute_reserve_status (struct MHD_Connection *connection, "error", "Reserve not found", "parameter", "withdraw_pub"); res = TEH_RESPONSE_reply_reserve_status_success (connection, - rh); + rh); TEH_plugin->free_reserve_history (TEH_plugin->cls, rh); return res; diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c index 9c8b2ff13..26cbb1870 100644 --- a/src/exchange/taler-exchange-httpd_wire.c +++ b/src/exchange/taler-exchange-httpd_wire.c @@ -120,9 +120,7 @@ TEH_WIRE_handler_wire (struct TEH_RequestHandler *rh, const char *upload_data, size_t *upload_data_size) { - if (NULL == wire_methods) - wire_methods = TEH_VALIDATION_get_wire_methods ("exchange-wire-incoming"); - + GNUNET_assert (NULL != wire_methods); return TEH_RESPONSE_reply_json (connection, wire_methods, MHD_HTTP_OK); @@ -130,6 +128,27 @@ TEH_WIRE_handler_wire (struct TEH_RequestHandler *rh, /** + * Initialize wire subsystem. + * + * @return #GNUNET_OK on success, #GNUNET_SYSERR if we found no valid + * wire methods + */ +int +TEH_WIRE_init () +{ + wire_methods = TEH_VALIDATION_get_wire_methods ("exchange-wire-incoming"); + if ( (NULL == wire_methods) || + (0 == json_object_size (wire_methods)) ) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to find properly configured wire transfer method\n"); + return GNUNET_SYSERR; + } + return GNUNET_OK; +} + + +/** * Initialize libgcrypt. */ void __attribute__ ((destructor)) diff --git a/src/exchange/taler-exchange-httpd_wire.h b/src/exchange/taler-exchange-httpd_wire.h index a85fde696..72dd2198f 100644 --- a/src/exchange/taler-exchange-httpd_wire.h +++ b/src/exchange/taler-exchange-httpd_wire.h @@ -27,6 +27,16 @@ /** + * Initialize wire subsystem. + * + * @return #GNUNET_OK on success, #GNUNET_SYSERR if we found no valid + * wire methods + */ +int +TEH_WIRE_init (void); + + +/** * Obtain fee structure for @a wire_plugin_name wire transfers. * * @param wire_plugin_name name of the plugin to load fees for diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 179d60976..febbf0c6c 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -2186,8 +2186,8 @@ postgres_get_reserve_history (void *cls, GNUNET_assert (NULL != rh_tail); GNUNET_assert (NULL == rh_tail->next); result = GNUNET_PQ_exec_prepared (session->conn, - "get_reserves_out", - params); + "get_reserves_out", + params); if (PGRES_TUPLES_OK != PQresultStatus (result)) { QUERY_ERR (result); |