From 6982ccd78b185751553a01d1f420d5603ad2faca Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 19 Aug 2018 12:22:42 +0200 Subject: [PATCH] force TALER_EXCHANGE_connect() va-list to be actually provided --- src/exchange-lib/exchange_api_handle.c | 23 ++++++++++++------- src/exchange-lib/test_exchange_api.c | 3 ++- .../test_exchange_api_keys_cherry_picking.c | 6 +++-- ...est_exchange_api_keys_cherry_picking_new.c | 9 ++------ src/exchange-lib/testing_api_loop.c | 3 ++- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/exchange-lib/exchange_api_handle.c b/src/exchange-lib/exchange_api_handle.c index 2be8b37bb..1d8a31b71 100644 --- a/src/exchange-lib/exchange_api_handle.c +++ b/src/exchange-lib/exchange_api_handle.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2017 GNUnet e.V. + Copyright (C) 2014-2018 GNUnet e.V. TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -117,6 +117,12 @@ struct TALER_EXCHANGE_Handle */ struct GNUNET_SCHEDULER_Task *retry_task; + /** + * Raw key data of the exchange, only valid if + * @e handshake_complete is past stage #MHS_CERT. + */ + json_t *key_data_raw; + /** * Key data of the exchange, only valid if * @e handshake_complete is past stage #MHS_CERT. @@ -133,12 +139,6 @@ struct TALER_EXCHANGE_Handle */ struct GNUNET_TIME_Absolute key_data_expiration; - /** - * Raw key data of the exchange, only valid if - * @e handshake_complete is past stage #MHS_CERT. - */ - json_t *key_data_raw; - /** * Stage of the exchange's initialization routines. */ @@ -801,7 +801,7 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange, if ( (GNUNET_NO == force_download) && (0 < GNUNET_TIME_absolute_get_remaining (exchange->key_data_expiration).rel_value_us) ) return exchange->key_data_expiration; - if (NULL != exchange->retry_task) + if (NULL == exchange->retry_task) exchange->retry_task = GNUNET_SCHEDULER_add_now (&request_keys, exchange); return GNUNET_TIME_UNIT_ZERO_ABS; @@ -1096,8 +1096,10 @@ header_cb (char *buffer, return total; } + /* ********************* public API ******************* */ + /** * Initialise a connection to the exchange. Will connect to the * exchange and obtain information about the exchange's master public @@ -1121,7 +1123,12 @@ TALER_EXCHANGE_connect (struct GNUNET_CURL_Context *ctx, ...) { struct TALER_EXCHANGE_Handle *exchange; + va_list ap; + va_start (ap, cert_cb_cls); + GNUNET_assert (TALER_EXCHANGE_OPTION_END == + va_arg (ap, int)); + va_end (ap); exchange = GNUNET_new (struct TALER_EXCHANGE_Handle); exchange->ctx = ctx; exchange->url = GNUNET_strdup (url); diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c index 7ca74a227..a96e49963 100644 --- a/src/exchange-lib/test_exchange_api.c +++ b/src/exchange-lib/test_exchange_api.c @@ -3821,7 +3821,8 @@ run (void *cls) fakebank = TALER_FAKEBANK_start (8082); exchange = TALER_EXCHANGE_connect (ctx, "http://localhost:8081", - &cert_cb, is, + &cert_cb, + is, TALER_EXCHANGE_OPTION_END); GNUNET_assert (NULL != exchange); timeout_task diff --git a/src/exchange-lib/test_exchange_api_keys_cherry_picking.c b/src/exchange-lib/test_exchange_api_keys_cherry_picking.c index e5fd22a1a..0dc0c540a 100644 --- a/src/exchange-lib/test_exchange_api_keys_cherry_picking.c +++ b/src/exchange-lib/test_exchange_api_keys_cherry_picking.c @@ -597,13 +597,15 @@ run (void *cls) rc = GNUNET_CURL_gnunet_rc_create (ctx); exchange = TALER_EXCHANGE_connect (ctx, "http://localhost:8081", - &cert_cb, is, + &cert_cb, + is, TALER_EXCHANGE_OPTION_END); GNUNET_assert (NULL != exchange); timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300), - &do_timeout, NULL); + &do_timeout, + NULL); GNUNET_SCHEDULER_add_shutdown (&do_shutdown, is); } diff --git a/src/exchange-lib/test_exchange_api_keys_cherry_picking_new.c b/src/exchange-lib/test_exchange_api_keys_cherry_picking_new.c index 64c03ff9f..d1fd25cf2 100644 --- a/src/exchange-lib/test_exchange_api_keys_cherry_picking_new.c +++ b/src/exchange-lib/test_exchange_api_keys_cherry_picking_new.c @@ -63,28 +63,22 @@ run (void *cls, struct TALER_TESTING_Interpreter *is) { struct TALER_TESTING_Command commands[] = { - /* Trigger keys reloading from disk. */ TALER_TESTING_cmd_signal ("signal-reaction-1", is->exchanged, SIGUSR1), - TALER_TESTING_cmd_check_keys ("check-keys-1", 1, 4, is->exchange), - /* 1st keyup happens at start-up */ - TALER_TESTING_cmd_exec_keyup ("keyup-2", + TALER_TESTING_cmd_exec_keyup ("keyup-2", CONFIG_FILE_EXTENDED), - TALER_TESTING_cmd_exec_auditor_sign ("sign-keys-1", CONFIG_FILE), - TALER_TESTING_cmd_signal ("trigger-keys-reload-1", is->exchanged, SIGUSR1), - TALER_TESTING_cmd_check_keys ("check-keys-2", 2, #if TALER_EXCHANGE_API_DISABLE_CHERRYPICKING @@ -99,6 +93,7 @@ run (void *cls, TALER_TESTING_run (is, commands); } + int main (int argc, char * const *argv) diff --git a/src/exchange-lib/testing_api_loop.c b/src/exchange-lib/testing_api_loop.c index 43d0ecc87..27611b2d0 100644 --- a/src/exchange-lib/testing_api_loop.c +++ b/src/exchange-lib/testing_api_loop.c @@ -657,7 +657,8 @@ main_wrapper_exchange_connect (void *cls) (is->exchange = TALER_EXCHANGE_connect (is->ctx, exchange_url, &cert_cb, - main_ctx))); + main_ctx, + TALER_EXCHANGE_OPTION_END))); GNUNET_free (exchange_url); GNUNET_CONFIGURATION_destroy (cfg); }