aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-01-17 18:01:56 +0100
committerChristian Grothoff <christian@grothoff.org>2020-01-17 18:01:56 +0100
commit8313dbd569a2579072f821f25c25c30543722b86 (patch)
tree9f9107bee1ca803025f3496850e35defc7d91ce5 /src
parent67bfd94009edfeaa6f0afcc9afc9208cf35f3672 (diff)
remove dead globals
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-httpd.c109
-rw-r--r--src/exchange/taler-exchange-httpd.h21
-rw-r--r--src/exchange/taler-exchange-httpd_keystate.c2
3 files changed, 57 insertions, 75 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index 44ac82d60..eb1bb79ea 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -75,16 +75,6 @@ struct ExchangeHttpRequestClosure
/**
- * Which currency is used by this exchange?
- */
-char *TEH_exchange_currency_string;
-
-/**
- * Should we return "Connection: close" in each response?
- */
-int TEH_exchange_connection_close;
-
-/**
* Base directory of the exchange (global)
*/
char *TEH_exchange_directory;
@@ -102,7 +92,7 @@ struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* How long is caching /keys allowed at most?
*/
-struct GNUNET_TIME_Relative max_keys_caching;
+struct GNUNET_TIME_Relative TEH_max_keys_caching;
/**
* Master public key (according to the
@@ -481,8 +471,6 @@ handle_mhd_request (void *cls,
static int
exchange_serve_process_config ()
{
- char *TEH_master_public_key_str;
-
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg,
"exchange",
@@ -495,7 +483,7 @@ exchange_serve_process_config ()
GNUNET_CONFIGURATION_get_value_time (cfg,
"exchange",
"MAX_KEYS_CACHING",
- &max_keys_caching))
+ &TEH_max_keys_caching))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"exchange",
@@ -525,49 +513,59 @@ exchange_serve_process_config ()
"REVOCATION_DIR");
return GNUNET_SYSERR;
}
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg,
- "taler",
- "CURRENCY",
- &TEH_exchange_currency_string))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "taler",
- "currency");
- return GNUNET_SYSERR;
- }
- if (strlen (TEH_exchange_currency_string) >= TALER_CURRENCY_LEN)
- {
- fprintf (stderr,
- "Currency `%s' longer than the allowed limit of %u characters.",
- TEH_exchange_currency_string,
- (unsigned int) TALER_CURRENCY_LEN);
- return GNUNET_SYSERR;
- }
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg,
- "exchange",
- "MASTER_PUBLIC_KEY",
- &TEH_master_public_key_str))
{
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "exchange",
- "master_public_key");
- return GNUNET_SYSERR;
+ char *currency_string;
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "taler",
+ "CURRENCY",
+ &currency_string))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "taler",
+ "CURRENCY");
+ return GNUNET_SYSERR;
+ }
+ if (strlen (currency_string) >= TALER_CURRENCY_LEN)
+ {
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ "taler",
+ "CURRENCY",
+ "Value is too long");
+ GNUNET_free (currency_string);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (currency_string);
}
- if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_public_key_from_string (TEH_master_public_key_str,
- strlen (
- TEH_master_public_key_str),
- &TEH_master_public_key.
- eddsa_pub))
{
- fprintf (stderr,
- "Invalid master public key given in exchange configuration.");
- GNUNET_free (TEH_master_public_key_str);
- return GNUNET_SYSERR;
+ char *master_public_key_str;
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "exchange",
+ "MASTER_PUBLIC_KEY",
+ &master_public_key_str))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "exchange",
+ "master_public_key");
+ return GNUNET_SYSERR;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CRYPTO_eddsa_public_key_from_string (master_public_key_str,
+ strlen (
+ master_public_key_str),
+ &TEH_master_public_key.
+ eddsa_pub))
+ {
+ fprintf (stderr,
+ "Invalid master public key given in exchange configuration.");
+ GNUNET_free (master_public_key_str);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (master_public_key_str);
}
- GNUNET_free (TEH_master_public_key_str);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Launching exchange with public key `%s'...\n",
GNUNET_p2s (&TEH_master_public_key.eddsa_pub));
@@ -784,11 +782,12 @@ main (int argc,
char *cfgfile = NULL;
char *loglev = NULL;
char *logfile = NULL;
+ int connection_close;
const struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_flag ('C',
"connection-close",
"force HTTP connections to be closed after each request",
- &TEH_exchange_connection_close),
+ &connection_close),
GNUNET_GETOPT_option_cfgfile (&cfgfile),
GNUNET_GETOPT_option_flag ('i',
"init-db",
@@ -825,7 +824,7 @@ main (int argc,
argc, argv))
return 1;
go = TALER_MHD_GO_NONE;
- if (TEH_exchange_connection_close)
+ if (connection_close)
go |= TALER_MHD_GO_FORCE_CONNECTION_CLOSE;
TALER_MHD_setup (go);
GNUNET_assert (GNUNET_OK ==
diff --git a/src/exchange/taler-exchange-httpd.h b/src/exchange/taler-exchange-httpd.h
index bf0653606..38c611c66 100644
--- a/src/exchange/taler-exchange-httpd.h
+++ b/src/exchange/taler-exchange-httpd.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014, 2015 GNUnet e.V.
+ Copyright (C) 2014, 2015, 2020 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -19,8 +19,6 @@
* @author Florian Dold
* @author Benedikt Mueller
* @author Christian Grothoff
- *
- * FIXME: Consider which of these need to really be globals...
*/
#ifndef TALER_EXCHANGE_HTTPD_H
#define TALER_EXCHANGE_HTTPD_H
@@ -29,19 +27,9 @@
/**
- * Which currency is used by this exchange?
- */
-extern char *TEH_exchange_currency_string;
-
-/**
- * Should we return "Connection: close" in each response?
- */
-extern int TEH_exchange_connection_close;
-
-/**
* How long is caching /keys allowed at most?
*/
-extern struct GNUNET_TIME_Relative max_keys_caching;
+extern struct GNUNET_TIME_Relative TEH_max_keys_caching;
/**
* The exchange's configuration.
@@ -65,11 +53,6 @@ extern char *TEH_revocation_directory;
extern struct TALER_MasterPublicKeyP TEH_master_public_key;
/**
- * Private key of the exchange we use to sign messages.
- */
-extern struct GNUNET_CRYPTO_EddsaPrivateKey TEH_exchange_private_signing_key;
-
-/**
* Our DB plugin.
*/
extern struct TALER_EXCHANGEDB_Plugin *TEH_plugin;
diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c
index 31cb13684..8b40144dd 100644
--- a/src/exchange/taler-exchange-httpd_keystate.c
+++ b/src/exchange/taler-exchange-httpd_keystate.c
@@ -1258,7 +1258,7 @@ setup_general_response_headers (const struct TEH_KS_StateHandle *key_state,
{
struct GNUNET_TIME_Absolute m;
- m = GNUNET_TIME_relative_to_absolute (max_keys_caching);
+ m = GNUNET_TIME_relative_to_absolute (TEH_max_keys_caching);
m = GNUNET_TIME_absolute_min (m,
key_state->next_reload);
get_date_string (m,