aboutsummaryrefslogtreecommitdiff
path: root/src/auditor
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-07-29 23:56:46 +0200
committerChristian Grothoff <christian@grothoff.org>2021-07-29 23:56:46 +0200
commit0ef7c0a0b716785e7d1b0233e622d2e7267a0280 (patch)
treeff4b46d1182acd71fa5c6e29b9aaa786dbcf2b22 /src/auditor
parent1b419adab48fc0fd915835e0d57c5923e515280c (diff)
fix #6960
Diffstat (limited to 'src/auditor')
-rw-r--r--src/auditor/Makefile.am10
-rw-r--r--src/auditor/taler-auditor-dbinit.c10
-rw-r--r--src/auditor/taler-auditor-exchange.c22
-rw-r--r--src/auditor/taler-auditor-httpd.c14
-rw-r--r--src/auditor/taler-auditor-sync.c20
5 files changed, 39 insertions, 37 deletions
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am
index b040126cd..09a0deec3 100644
--- a/src/auditor/Makefile.am
+++ b/src/auditor/Makefile.am
@@ -130,8 +130,8 @@ taler_helper_auditor_wire_SOURCES = \
taler-helper-auditor-wire.c
taler_helper_auditor_wire_LDADD = \
$(LIBGCRYPT_LIBS) \
- $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/json/libtalerjson.la \
+ $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/bank-lib/libtalerbank.la \
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
$(top_builddir)/src/auditordb/libtalerauditordb.la \
@@ -174,11 +174,13 @@ taler_auditor_exchange_LDADD = \
taler_auditor_sync_SOURCES = \
taler-auditor-sync.c
taler_auditor_sync_LDADD = \
- $(LIBGCRYPT_LIBS) \
- $(top_builddir)/src/util/libtalerutil.la \
- $(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
+ $(top_builddir)/src/pq/libtalerpq.la \
+ $(top_builddir)/src/json/libtalerjson.la \
+ $(top_builddir)/src/util/libtalerutil.la \
+ -lgnunetjson \
-lgnunetutil \
+ $(LIBGCRYPT_LIBS) \
$(XLIB)
taler_auditor_sync_LDFLAGS = \
$(POSTGRESQL_LDFLAGS)
diff --git a/src/auditor/taler-auditor-dbinit.c b/src/auditor/taler-auditor-dbinit.c
index d0509fc08..fe5e5310e 100644
--- a/src/auditor/taler-auditor-dbinit.c
+++ b/src/auditor/taler-auditor-dbinit.c
@@ -69,7 +69,7 @@ run (void *cls,
{
fprintf (stderr,
"Failed to initialize database plugin.\n");
- global_ret = 1;
+ global_ret = EXIT_NOTINSTALLED;
return;
}
if (reset_db)
@@ -94,7 +94,7 @@ run (void *cls,
fprintf (stderr,
"Failed to initialize database.\n");
TALER_AUDITORDB_plugin_unload (plugin);
- global_ret = 1;
+ global_ret = EXIT_NOPERMISSION;
return;
}
if (gc_db)
@@ -143,7 +143,7 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
- return 4;
+ return EXIT_INVALIDARGUMENT;
ret = GNUNET_PROGRAM_run (
argc, argv,
"taler-auditor-dbinit",
@@ -152,9 +152,9 @@ main (int argc,
&run, NULL);
GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret)
- return 3;
+ return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
return global_ret;
}
diff --git a/src/auditor/taler-auditor-exchange.c b/src/auditor/taler-auditor-exchange.c
index e8e40ba59..b8b8428e7 100644
--- a/src/auditor/taler-auditor-exchange.c
+++ b/src/auditor/taler-auditor-exchange.c
@@ -99,9 +99,9 @@ main (int argc,
options,
argc, argv);
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret)
- return 1;
+ return EXIT_INVALIDARGUMENT;
}
if (NULL == cfgfile)
cfgfile = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file);
@@ -119,7 +119,7 @@ main (int argc,
"Malformed configuration file `%s', exit ...\n",
cfgfile);
GNUNET_free (cfgfile);
- return 1;
+ return EXIT_NOTCONFIGURED;
}
GNUNET_free (cfgfile);
@@ -131,7 +131,7 @@ main (int argc,
_ ("Missing either `%s' or `%s'.\n"),
"-u URL",
"--remove");
- return 1;
+ return EXIT_INVALIDARGUMENT;
}
if ( (0 == strlen (exchange_url)) ||
( (0 != strncasecmp ("http://",
@@ -144,7 +144,7 @@ main (int argc,
{
fprintf (stderr,
"Exchange URL must begin with `http://` or `https://` and end with `/'\n");
- return 1;
+ return EXIT_INVALIDARGUMENT;
}
}
@@ -154,7 +154,7 @@ main (int argc,
{
fprintf (stderr,
"Failed to initialize auditor database plugin.\n");
- return 3;
+ return EXIT_NOTINSTALLED;
}
/* Create required tables */
@@ -164,7 +164,7 @@ main (int argc,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to create tables in auditor's database\n");
TALER_AUDITORDB_plugin_unload (adb);
- return 3;
+ return EXIT_NOPERMISSION;
}
/* Update DB */
@@ -178,7 +178,7 @@ main (int argc,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to initialize database session\n");
TALER_AUDITORDB_plugin_unload (adb);
- return 3;
+ return EXIT_FAILURE;
}
if (remove_flag)
@@ -200,7 +200,7 @@ main (int argc,
"Failed to update auditor database (status code: %d)\n",
qs);
TALER_AUDITORDB_plugin_unload (adb);
- return 3;
+ return EXIT_FAILURE;
}
if (0 == qs)
{
@@ -210,11 +210,11 @@ main (int argc,
? "Could not remove exchange from database: entry already absent\n"
: "Could not add exchange to database: entry already exists\n");
TALER_AUDITORDB_plugin_unload (adb);
- return 4;
+ return EXIT_FAILURE;
}
}
TALER_AUDITORDB_plugin_unload (adb);
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c
index 36d0547f8..d68ec7593 100644
--- a/src/auditor/taler-auditor-httpd.c
+++ b/src/auditor/taler-auditor-httpd.c
@@ -576,9 +576,9 @@ main (int argc,
options,
argc, argv);
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret)
- return 3;
+ return EXIT_FAILURE;
}
go = TALER_MHD_GO_NONE;
if (auditor_connection_close)
@@ -599,13 +599,13 @@ main (int argc,
"Malformed configuration file `%s', exiting ...\n",
cfgfile);
GNUNET_free (cfgfile);
- return 1;
+ return EXIT_NOTCONFIGURED;
}
GNUNET_free (cfgfile);
if (GNUNET_OK !=
auditor_serve_process_config ())
- return 1;
+ return EXIT_NOTCONFIGURED;
TEAH_DEPOSIT_CONFIRMATION_init ();
/* check for systemd-style FD passing */
listen_pid = getenv ("LISTEN_PID");
@@ -649,7 +649,7 @@ main (int argc,
if (-1 == fh)
{
TEAH_DEPOSIT_CONFIRMATION_done ();
- return 1;
+ return EXIT_NOPERMISSION; /* most likely at least */
}
}
@@ -674,7 +674,7 @@ main (int argc,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start HTTP server.\n");
TEAH_DEPOSIT_CONFIRMATION_done ();
- return 1;
+ return EXIT_FAILURE;
}
/* normal behavior */
@@ -751,7 +751,7 @@ main (int argc,
TALER_EXCHANGEDB_plugin_unload (TAH_eplugin);
TAH_eplugin = NULL;
TEAH_DEPOSIT_CONFIRMATION_done ();
- return (GNUNET_SYSERR == ret) ? 1 : 0;
+ return (GNUNET_SYSERR == ret) ? EXIT_FAILURE : EXIT_SUCCESS;
}
diff --git a/src/auditor/taler-auditor-sync.c b/src/auditor/taler-auditor-sync.c
index 84562c5b2..5f9111cea 100644
--- a/src/auditor/taler-auditor-sync.c
+++ b/src/auditor/taler-auditor-sync.c
@@ -269,7 +269,7 @@ transact (struct TALER_EXCHANGEDB_Session *ss,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to lookup records from table %d: hard error\n",
i);
- global_ret = 3;
+ global_ret = EXIT_FAILURE;
return GNUNET_SYSERR;
}
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
@@ -285,7 +285,7 @@ transact (struct TALER_EXCHANGEDB_Session *ss,
"Failed to lookup records from table %d: no results\n",
i);
GNUNET_break (0); /* should be impossible */
- global_ret = 4;
+ global_ret = EXIT_FAILURE;
return GNUNET_SYSERR;
}
if (0 == ctx.qs)
@@ -306,7 +306,7 @@ transact (struct TALER_EXCHANGEDB_Session *ss,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Hard error committing transaction on table %d\n",
i);
- global_ret = 5;
+ global_ret = EXIT_FAILURE;
return GNUNET_SYSERR;
}
}
@@ -530,13 +530,13 @@ setup (struct GNUNET_CONFIGURATION_Handle *src_cfg,
src = TALER_EXCHANGEDB_plugin_load (src_cfg);
if (NULL == src)
{
- global_ret = 3;
+ global_ret = EXIT_NOTINSTALLED;
return;
}
dst = TALER_EXCHANGEDB_plugin_load (dst_cfg);
if (NULL == dst)
{
- global_ret = 3;
+ global_ret = EXIT_NOTINSTALLED;
TALER_EXCHANGEDB_plugin_unload (src);
src = NULL;
return;
@@ -601,9 +601,9 @@ main (int argc,
options,
argc, argv);
if (GNUNET_NO == ret)
- return 0;
+ return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret)
- return 1;
+ return EXIT_INVALIDARGUMENT;
}
GNUNET_assert (GNUNET_OK ==
GNUNET_log_setup ("taler-auditor-sync",
@@ -615,14 +615,14 @@ main (int argc,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Source and destination configuration files must differ!\n");
- return 1;
+ return EXIT_INVALIDARGUMENT;
}
src_cfg = load_config (src_cfgfile);
if (NULL == src_cfg)
{
GNUNET_free (src_cfgfile);
GNUNET_free (dst_cfgfile);
- return 1;
+ return EXIT_NOTCONFIGURED;
}
dst_cfg = load_config (dst_cfgfile);
if (NULL == dst_cfg)
@@ -630,7 +630,7 @@ main (int argc,
GNUNET_CONFIGURATION_destroy (src_cfg);
GNUNET_free (src_cfgfile);
GNUNET_free (dst_cfgfile);
- return 1;
+ return EXIT_NOTCONFIGURED;
}
setup (src_cfg,
dst_cfg);