summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-11-04 10:48:22 +0100
committerChristian Grothoff <christian@grothoff.org>2018-11-04 10:48:32 +0100
commitb39c3f9ca626cf8908f4f552d481dd3e9d162140 (patch)
tree857f95e44a75a19ebab90a98c4788d2511eac089 /src
parentdce058af76abad983df4a671616fd76a11bd133f (diff)
downloadexchange-b39c3f9ca626cf8908f4f552d481dd3e9d162140.tar.gz
exchange-b39c3f9ca626cf8908f4f552d481dd3e9d162140.tar.bz2
exchange-b39c3f9ca626cf8908f4f552d481dd3e9d162140.zip
add missing default configs for auditor-httpd, make -u not mandatory as it is not needed for -r and check URL is well-formed if given; fix auditordb exchange insertion/removal logic
Diffstat (limited to 'src')
-rw-r--r--src/auditor/auditor.conf13
-rw-r--r--src/auditor/taler-auditor-exchange.c39
-rw-r--r--src/auditor/taler-auditor-sign.c2
-rw-r--r--src/auditordb/plugin_auditordb_postgres.c4
4 files changed, 48 insertions, 10 deletions
diff --git a/src/auditor/auditor.conf b/src/auditor/auditor.conf
index 22395cc6..c3b9a00c 100644
--- a/src/auditor/auditor.conf
+++ b/src/auditor/auditor.conf
@@ -10,3 +10,16 @@ AUDITOR_PRIV_FILE = ${TALER_DATA_HOME}/auditor/offline-keys/auditor.priv
# What is the Web site of the auditor (i.e. to file complaints about
# a misbehaving exchange)?
# AUDITOR_URL = https://auditor.taler.net/
+
+
+# Network configuration for the normal API/service HTTP server
+# serve via tcp socket (on PORT)
+SERVE = tcp
+
+# Unix domain socket to listen on,
+# only effective with "SERVE = unix"
+UNIXPATH = ${TALER_RUNTIME_DIR}/exchange.http
+UNIXPATH_MODE = 660
+
+# HTTP port the auditor listens to
+PORT = 8082
diff --git a/src/auditor/taler-auditor-exchange.c b/src/auditor/taler-auditor-exchange.c
index b316f602..64e12d0b 100644
--- a/src/auditor/taler-auditor-exchange.c
+++ b/src/auditor/taler-auditor-exchange.c
@@ -73,12 +73,11 @@ main (int argc,
"KEY",
"public key of the exchange (Crockford base32 encoded)",
&master_public_key)),
- GNUNET_GETOPT_option_mandatory
- (GNUNET_GETOPT_option_string ('u',
- "exchange-url",
- "URL",
- "base URL of the exchange",
- &exchange_url)),
+ GNUNET_GETOPT_option_string ('u',
+ "exchange-url",
+ "URL",
+ "base URL of the exchange",
+ &exchange_url),
GNUNET_GETOPT_option_flag ('r',
"remove",
"remove the exchange's key (default is to add)",
@@ -93,7 +92,7 @@ main (int argc,
NULL));
if (GNUNET_GETOPT_run ("taler-auditor-exchange",
options,
- argc, argv) < 0)
+ argc, argv) <= 0)
return 1;
cfg = GNUNET_CONFIGURATION_create ();
if (GNUNET_SYSERR ==
@@ -108,6 +107,32 @@ main (int argc,
}
GNUNET_free_non_null (cfgfile);
+ if (! remove_flag)
+ {
+ if (NULL == exchange_url)
+ {
+ FPRINTF (stderr,
+ _("Missing either `%s' or `%s'.\n"),
+ "-u URL",
+ "--remove");
+ return 1;
+ }
+ if ( (0 == strlen (exchange_url)) ||
+ ( (0 != strncasecmp ("http://",
+ exchange_url,
+ strlen ("http://"))) &&
+ (0 != strncasecmp ("https://",
+ exchange_url,
+ strlen ("https://"))) ) ||
+ ('/' != exchange_url[strlen(exchange_url)-1]) )
+ {
+ fprintf (stderr,
+ "Exchange URL must begin with `http://` or `https://` and end with `/'\n");
+ return 3;
+ }
+ }
+
+
if (NULL ==
(adb = TALER_AUDITORDB_plugin_load (cfg)))
{
diff --git a/src/auditor/taler-auditor-sign.c b/src/auditor/taler-auditor-sign.c
index e3453713..90efbd0e 100644
--- a/src/auditor/taler-auditor-sign.c
+++ b/src/auditor/taler-auditor-sign.c
@@ -193,7 +193,7 @@ main (int argc,
NULL));
if (GNUNET_GETOPT_run ("taler-auditor-sign",
options,
- argc, argv) < 0)
+ argc, argv) <= 0)
return 1;
cfg = GNUNET_CONFIGURATION_create ();
if (GNUNET_SYSERR ==
diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c
index 2f426b99..67f5949d 100644
--- a/src/auditordb/plugin_auditordb_postgres.c
+++ b/src/auditordb/plugin_auditordb_postgres.c
@@ -1219,7 +1219,7 @@ postgres_insert_exchange (void *cls,
const char *exchange_url)
{
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (&master_pub),
+ GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_string (exchange_url),
GNUNET_PQ_query_param_end
};
@@ -1246,7 +1246,7 @@ postgres_delete_exchange (void *cls,
const struct TALER_MasterPublicKeyP *master_pub)
{
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (&master_pub),
+ GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_end
};