commit 93fc6fda7f726cd9f513d2aba3ed558527bcf166
parent c10cf3dfb4629f0be4dc789a4fef1574050ff914
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date: Fri, 5 Jan 2024 13:48:28 +0100
Merge remote-tracking branch 'refs/remotes/origin/master'
Diffstat:
27 files changed, 417 insertions(+), 949 deletions(-)
diff --git a/contrib/donau-dbconfig b/contrib/donau-dbconfig
@@ -0,0 +1,137 @@
+#!/bin/bash
+# This file is part of GNU TALER.
+# Copyright (C) 2023 Taler Systems SA
+#
+# TALER is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free Software
+# Foundation; either version 2.1, or (at your option) any later version.
+#
+# TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License along with
+# TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+#
+# @author Christian Grothoff
+#
+#
+# Error checking on
+set -eu
+
+RESET_DB=0
+SKIP_DBINIT=0
+DBUSER="donau-httpd"
+DBGROUP="donau-db"
+DBNAME="donau"
+CFGFILE="/etc/taler/secrets/donau-db.secret.conf"
+
+# Parse command-line options
+while getopts ':g:hn:rsu:' OPTION; do
+ case "$OPTION" in
+ h)
+ echo 'Supported options:'
+ echo " -c FILENAME -- write configuration to FILENAME (default: $CFGFILE)"
+ echo " -g GROUP -- donau to be run by GROUP (default: $DBGROUP)"
+ echo " -h -- print this help text"
+ echo " -n NAME -- user NAME for database name (default: $DBNAME)"
+ echo " -r -- reset database (dangerous)"
+ echo " -s -- skip database initialization"
+ echo " -u USER -- donau to be run by USER (default: $DBUSER)"
+ exit 0
+ ;;
+ n)
+ DBNAME="$OPTARG"
+ ;;
+ r)
+ RESET_DB="1"
+ ;;
+ s)
+ SKIP_DBINIT="1"
+ ;;
+ u)
+ DBUSER="$OPTARG"
+ ;;
+ ?)
+ exit_fail "Unrecognized command line option"
+ ;;
+ esac
+done
+
+if ! id postgres > /dev/null
+then
+ echo "Could not find 'postgres' user. Please install Postgresql first"
+ exit 1
+fi
+
+if [ "$(id -u)" -ne 0 ]
+then
+ echo "This script must be run as root"
+ exit 1
+fi
+
+if [ 0 = "$SKIP_DBINIT" ]
+then
+ if ! donau-dbinit -v 2> /dev/null
+ then
+ echo "Required 'donau-dbinit' not found. Please fix your installation."
+ fi
+fi
+
+if ! id "$DBUSER" > /dev/null
+then
+ echo "Could not find '$DBUSER' user. Please set it up first"
+ exit 1
+fi
+
+if sudo -i -u postgres psql "$DBNAME" < /dev/null 2> /dev/null
+then
+ if [ 1 = "$RESET_DB" ]
+ then
+ echo "Deleting existing database '$DBNAME'." 1>&2
+ sudo -i -u postgres dropdb "$DBNAME"
+ else
+ echo "Database '$DBNAME' already exists, refusing to setup again."
+ echo "Use -r to delete the existing database first (dangerous!)."
+ exit 77
+ fi
+fi
+
+echo "Setting up database user '$DBUSER'." 1>&2
+
+if ! sudo -i -u postgres createuser "$DBUSER" 2> /dev/null
+then
+ echo "Database user '$DBUSER' already existed. Continuing anyway." 1>&2
+fi
+
+echo "Creating database '$DBNAME'." 1>&2
+
+if ! sudo -i -u postgres createdb -O "$DBUSER" "$DBNAME"
+then
+ echo "Failed to create database '$DBNAME'"
+ exit 1
+fi
+
+if [ -f "$CFGFILE" ]
+then
+ echo "Adding database configuration to '$CFGFILE'." 1>&2
+ echo -e "[donaudb-postgres]\nCONFIG=postgres:///$DBNAME\n" >> "$CFGFILE"
+ chown root:"$DBGROUP" "$CFGFILE"
+ chmod 640 "$CFGFILE"
+else
+ echo "Configuration '$CFGFILE' does not yet exist, creating it." 1>&2
+ mkdir -p "$(dirname "$CFGFILE")"
+ echo -e "[donaudb-postgres]\nCONFIG=postgres:///$DBNAME\n" >> "$CFGFILE"
+ chown root:"$DBGROUP" "$CFGFILE"
+ chmod 640 "$CFGFILE"
+fi
+
+if [ 0 = "$SKIP_DBINIT" ]
+then
+ echo "Initializing database '$DBNAME'." 1>&2
+ sudo -u "$DBUSER" donau-dbinit
+fi
+
+echo "Database configuration finished." 1>&2
+
+exit 0
diff --git a/contrib/taler-donau-dbconfig b/contrib/taler-donau-dbconfig
@@ -1,137 +0,0 @@
-#!/bin/bash
-# This file is part of GNU TALER.
-# Copyright (C) 2023 Taler Systems SA
-#
-# TALER is free software; you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free Software
-# Foundation; either version 2.1, or (at your option) any later version.
-#
-# TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along with
-# TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-#
-# @author Christian Grothoff
-#
-#
-# Error checking on
-set -eu
-
-RESET_DB=0
-SKIP_DBINIT=0
-DBUSER="taler-donau-httpd"
-DBGROUP="taler-donau-db"
-DBNAME="donau"
-CFGFILE="/etc/taler/secrets/donau-db.secret.conf"
-
-# Parse command-line options
-while getopts ':g:hn:rsu:' OPTION; do
- case "$OPTION" in
- h)
- echo 'Supported options:'
- echo " -c FILENAME -- write configuration to FILENAME (default: $CFGFILE)"
- echo " -g GROUP -- taler-donau to be run by GROUP (default: $DBGROUP)"
- echo " -h -- print this help text"
- echo " -n NAME -- user NAME for database name (default: $DBNAME)"
- echo " -r -- reset database (dangerous)"
- echo " -s -- skip database initialization"
- echo " -u USER -- taler-donau to be run by USER (default: $DBUSER)"
- exit 0
- ;;
- n)
- DBNAME="$OPTARG"
- ;;
- r)
- RESET_DB="1"
- ;;
- s)
- SKIP_DBINIT="1"
- ;;
- u)
- DBUSER="$OPTARG"
- ;;
- ?)
- exit_fail "Unrecognized command line option"
- ;;
- esac
-done
-
-if ! id postgres > /dev/null
-then
- echo "Could not find 'postgres' user. Please install Postgresql first"
- exit 1
-fi
-
-if [ "$(id -u)" -ne 0 ]
-then
- echo "This script must be run as root"
- exit 1
-fi
-
-if [ 0 = "$SKIP_DBINIT" ]
-then
- if ! taler-donau-dbinit -v 2> /dev/null
- then
- echo "Required 'taler-donau-dbinit' not found. Please fix your installation."
- fi
-fi
-
-if ! id "$DBUSER" > /dev/null
-then
- echo "Could not find '$DBUSER' user. Please set it up first"
- exit 1
-fi
-
-if sudo -i -u postgres psql "$DBNAME" < /dev/null 2> /dev/null
-then
- if [ 1 = "$RESET_DB" ]
- then
- echo "Deleting existing database '$DBNAME'." 1>&2
- sudo -i -u postgres dropdb "$DBNAME"
- else
- echo "Database '$DBNAME' already exists, refusing to setup again."
- echo "Use -r to delete the existing database first (dangerous!)."
- exit 77
- fi
-fi
-
-echo "Setting up database user '$DBUSER'." 1>&2
-
-if ! sudo -i -u postgres createuser "$DBUSER" 2> /dev/null
-then
- echo "Database user '$DBUSER' already existed. Continuing anyway." 1>&2
-fi
-
-echo "Creating database '$DBNAME'." 1>&2
-
-if ! sudo -i -u postgres createdb -O "$DBUSER" "$DBNAME"
-then
- echo "Failed to create database '$DBNAME'"
- exit 1
-fi
-
-if [ -f "$CFGFILE" ]
-then
- echo "Adding database configuration to '$CFGFILE'." 1>&2
- echo -e "[donaudb-postgres]\nCONFIG=postgres:///$DBNAME\n" >> "$CFGFILE"
- chown root:"$DBGROUP" "$CFGFILE"
- chmod 640 "$CFGFILE"
-else
- echo "Configuration '$CFGFILE' does not yet exist, creating it." 1>&2
- mkdir -p "$(dirname "$CFGFILE")"
- echo -e "[donaudb-postgres]\nCONFIG=postgres:///$DBNAME\n" >> "$CFGFILE"
- chown root:"$DBGROUP" "$CFGFILE"
- chmod 640 "$CFGFILE"
-fi
-
-if [ 0 = "$SKIP_DBINIT" ]
-then
- echo "Initializing database '$DBNAME'." 1>&2
- sudo -u "$DBUSER" taler-donau-dbinit
-fi
-
-echo "Database configuration finished." 1>&2
-
-exit 0
diff --git a/doc/Makefile.am b/doc/Makefile.am
@@ -19,24 +19,24 @@ man_MANS = \
#prebuilt/man/taler-auditor-sync.1 \
#prebuilt/man/taler-bank-benchmark.1 \
#prebuilt/man/taler-bank-transfer.1 \
- prebuilt/man/taler-donau-aggregator.1 \
- prebuilt/man/taler-donau-benchmark.1 \
- prebuilt/man/taler-donau-closer.1 \
- prebuilt/man/taler-donau-dbconfig.1 \
- prebuilt/man/taler-donau-dbinit.1 \
- #prebuilt/man/taler-donau-drain.1 \
- #prebuilt/man/taler-donau-expire.1 \
+ prebuilt/man/donau-aggregator.1 \
+ prebuilt/man/donau-benchmark.1 \
+ prebuilt/man/donau-closer.1 \
+ prebuilt/man/donau-dbconfig.1 \
+ prebuilt/man/donau-dbinit.1 \
+ #prebuilt/man/donau-drain.1 \
+ #prebuilt/man/donau-expire.1 \
prebuilt/man/donau-httpd.1 \
- #prebuilt/man/taler-donau-kyc-aml-pep-trigger.1 \
- #prebuilt/man/taler-donau-kyc-tester.1 \
- prebuilt/man/taler-donau-offline.1 \
- prebuilt/man/taler-donau-router.1\
- prebuilt/man/taler-donau-secmod-cs.1\
- prebuilt/man/taler-donau-secmod-eddsa.1\
- prebuilt/man/taler-donau-secmod-rsa.1 \
- #prebuilt/man/taler-donau-transfer.1\
- #prebuilt/man/taler-donau-wire-gateway-client.1\
- #prebuilt/man/taler-donau-wirewatch.1 \
+ #prebuilt/man/donau-kyc-aml-pep-trigger.1 \
+ #prebuilt/man/donau-kyc-tester.1 \
+ prebuilt/man/donau-offline.1 \
+ prebuilt/man/donau-router.1\
+ prebuilt/man/donau-secmod-cs.1\
+ prebuilt/man/donau-secmod-eddsa.1\
+ prebuilt/man/donau-secmod-rsa.1 \
+ #prebuilt/man/donau-transfer.1\
+ #prebuilt/man/donau-wire-gateway-client.1\
+ #prebuilt/man/donau-wirewatch.1 \
#prebuilt/man/taler-helper-auditor-aggregation.1 \
#prebuilt/man/taler-helper-auditor-coins.1\
#prebuilt/man/taler-helper-auditor-deposits.1\
@@ -50,7 +50,7 @@ man_MANS = \
#prebuilt/texinfo/taler-auditor.texi \
#prebuilt/texinfo/taler-bank.texi \
#prebuilt/texinfo/taler-developer-manual.texi \
- #prebuilt/texinfo/taler-donau.texi
+ #prebuilt/texinfo/donau.texi
EXTRA_DIST = \
@@ -69,6 +69,6 @@ EXTRA_DIST = \
#prebuilt/texinfo/taler-developer-manual-figures/donau-db.png \
#prebuilt/texinfo/taler-developer-manual-figures/charity-db.png \
#prebuilt/texinfo/taler-developer-manual-figures/replication.png \
- #prebuilt/texinfo/taler-donau-figures/auditor-db.png \
- #prebuilt/texinfo/taler-donau-figures/donau-db.png\
- #prebuilt/texinfo/taler-donau-figures/replication.png
+ #prebuilt/texinfo/donau-figures/auditor-db.png \
+ #prebuilt/texinfo/donau-figures/donau-db.png\
+ #prebuilt/texinfo/donau-figures/replication.png
diff --git a/src/donau-tools/Makefile.am b/src/donau-tools/Makefile.am
@@ -15,7 +15,7 @@ bin_PROGRAMS = \
donau-dbinit
donau_dbinit_SOURCES = \
- taler-donau-dbinit.c
+ donau-dbinit.c
donau_dbinit_LDADD = \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libdonauutil.la \
@@ -23,7 +23,7 @@ donau_dbinit_LDADD = \
$(top_builddir)/src/donaudb/libdonaudb.la \
-lgnunetutil \
$(XLIB)
-taler_donau_dbinit_CPPFLAGS = \
+donau_dbinit_CPPFLAGS = \
-I$(top_srcdir)/src/include \
-I$(top_srcdir)/src/pq/ \
$(POSTGRESQL_CPPFLAGS)
diff --git a/src/donau-tools/donau-dbinit.c b/src/donau-tools/donau-dbinit.c
@@ -116,23 +116,23 @@ run (void *cls,
global_ret = EXIT_NOPERMISSION;
return;
}
- if (clear_shards)
- {
- if (GNUNET_OK !=
- plugin->delete_shard_locks (plugin->cls))
- {
- fprintf (stderr,
- "Clearing revolving shards failed!\n");
- }
- }
- if (gc_db)
- {
- if (GNUNET_SYSERR == plugin->gc (plugin->cls))
- {
- fprintf (stderr,
- "Garbage collection failed!\n");
- }
- }
+ // if (clear_shards)
+ // {
+ // if (GNUNET_OK !=
+ // plugin->delete_shard_locks (plugin->cls))
+ // {
+ // fprintf (stderr,
+ // "Clearing revolving shards failed!\n");
+ // }
+ // }
+ // if (gc_db)
+ // {
+ // if (GNUNET_SYSERR == plugin->gc (plugin->cls))
+ // {
+ // fprintf (stderr,
+ // "Garbage collection failed!\n");
+ // }
+ // }
}
DONAUDB_plugin_unload (plugin);
plugin = NULL;
diff --git a/src/donau-tools/taler-donau-dbinit.c b/src/donau-tools/taler-donau-dbinit.c
@@ -1,204 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014-2022 Taler Systems SA
-
- 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
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file donau-tools/donau-dbinit.c
- * @brief Create tables for the donau database.
- * @author Florian Dold
- * @author Christian Grothoff
- */
-#include "taler/platform.h"
-#include <gnunet/gnunet_util_lib.h>
-#include "donaudb_lib.h"
-
-
-/**
- * Return value from main().
- */
-static int global_ret;
-
-/**
- * -r option: do full DB reset
- */
-static int reset_db;
-
-/**
- * -s option: clear revolving shard locks
- */
-static int clear_shards;
-
-/**
- * -g option: garbage collect DB reset
- */
-static int gc_db;
-
-/**
- * -P option: setup a partitioned database
- */
-static uint32_t num_partitions;
-
-/**
- * -f option: force partitions to be created when there is only one
- */
-static int force_create_partitions;
-
-/**
- * Main function that will be run.
- *
- * @param cls closure
- * @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be NULL!)
- * @param cfg configuration
- */
-// static void
-// run (void *cls,
-// char *const *args,
-// const char *cfgfile,
-// const struct GNUNET_CONFIGURATION_Handle *cfg)
-// {
-// struct DONAUDB_Plugin *plugin;
-
-// (void) cls;
-// (void) args;
-// (void) cfgfile;
-
-// if (NULL ==
-// (plugin = DONAUDB_plugin_load (cfg)))
-// {
-// fprintf (stderr,
-// "Failed to initialize database plugin.\n");
-// global_ret = EXIT_NOTINSTALLED;
-// return;
-// }
-// if (reset_db)
-// {
-// if (GNUNET_OK !=
-// plugin->drop_tables (plugin->cls))
-// {
-// GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-// "Could not drop tables as requested. Either database was not yet initialized, or permission denied. Consult the logs. Will still try to create new tables.\n");
-// }
-// }
-// if (GNUNET_OK !=
-// plugin->create_tables (plugin->cls,
-// force_create_partitions || num_partitions > 0,
-// num_partitions))
-// {
-// fprintf (stderr,
-// "Failed to initialize database.\n");
-// DONAUDB_plugin_unload (plugin);
-// plugin = NULL;
-// global_ret = EXIT_NOPERMISSION;
-// return;
-// }
-// if (gc_db || clear_shards)
-// {
-// if (GNUNET_OK !=
-// plugin->preflight (plugin->cls))
-// {
-// fprintf (stderr,
-// "Failed to prepare database.\n");
-// DONAUDB_plugin_unload (plugin);
-// plugin = NULL;
-// global_ret = EXIT_NOPERMISSION;
-// return;
-// }
-// if (clear_shards)
-// {
-// if (GNUNET_OK !=
-// plugin->delete_shard_locks (plugin->cls))
-// {
-// fprintf (stderr,
-// "Clearing revolving shards failed!\n");
-// }
-// }
-// if (gc_db)
-// {
-// if (GNUNET_SYSERR == plugin->gc (plugin->cls))
-// {
-// fprintf (stderr,
-// "Garbage collection failed!\n");
-// }
-// }
-// }
-// DONAUDB_plugin_unload (plugin);
-// plugin = NULL;
-// }
-
-
-/**
- * The main function of the database initialization tool.
- * Used to initialize the Taler Donau's database.
- *
- * @param argc number of arguments from the command line
- * @param argv command line arguments
- * @return 0 ok, non-zero on error
- */
-int
-main (int argc,
- char *const *argv)
-{
- const struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_flag ('g',
- "gc",
- "garbage collect database",
- &gc_db),
- GNUNET_GETOPT_option_flag ('r',
- "reset",
- "reset database (DANGEROUS: all existing data is lost!)",
- &reset_db),
- GNUNET_GETOPT_option_flag ('s',
- "shardunlock",
- "unlock all revolving shard locks (use after system crash or shard size change while services are not running)",
- &clear_shards),
- GNUNET_GETOPT_option_uint ('P',
- "partition",
- "NUMBER",
- "Setup a partitioned database where each table which can be partitioned holds NUMBER partitions on a single DB node",
- &num_partitions),
- GNUNET_GETOPT_option_flag ('f',
- "force",
- "Force partitions to be created if there is only one partition",
- &force_create_partitions),
- GNUNET_GETOPT_OPTION_END
- };
- enum GNUNET_GenericReturnValue ret;
- (void) options; // delete me
- ret = 1; // delete me
-
- if (GNUNET_OK !=
- GNUNET_STRINGS_get_utf8_args (argc, argv,
- &argc, &argv))
- return EXIT_INVALIDARGUMENT;
- /* force linker to link against libtalerutil; if we do
- not do this, the linker may "optimize" libtalerutil
- away and skip #TALER_OS_init(), which we do need */
- // TALER_OS_init ();
- // ret = GNUNET_PROGRAM_run (
- // argc, argv,
- // "donau-dbinit",
- // gettext_noop ("Initialize Taler donau database"),
- // options,
- // &run, NULL);
- GNUNET_free_nz ((void *) argv);
- if (GNUNET_SYSERR == ret)
- return EXIT_INVALIDARGUMENT;
- if (GNUNET_NO == ret)
- return EXIT_SUCCESS;
- return global_ret;
-}
-
-
-/* end of donau-dbinit.c */
diff --git a/src/donau/Makefile.am b/src/donau/Makefile.am
@@ -49,10 +49,10 @@ donau_httpd_SOURCES = \
AM_TESTS_ENVIRONMENT=export TALER_PREFIX=$${TALER_PREFIX:-@libdir@};export PATH=$${TALER_PREFIX:-@prefix@}/bin:$$PATH;
check_SCRIPTS = \
- test_taler_donau_httpd.sh
+ test_donau_httpd.sh
if HAVE_EXPENSIVE_TESTS
check_SCRIPTS += \
- test_taler_donau_httpd_afl.sh
+ test_donau_httpd_afl.sh
endif
.NOTPARALLEL:
@@ -62,11 +62,11 @@ TESTS = \
# Distribution
EXTRA_DIST = \
- test_taler_donau_httpd_home/.local/share/taler/donau/offline-keys/master.priv \
- test_taler_donau_httpd.conf \
- test_taler_donau_unix.conf \
- test_taler_donau_httpd.get \
- test_taler_donau_httpd.post \
+ test_donau_httpd_home/.local/share/taler/donau/offline-keys/master.priv \
+ test_donau_httpd.conf \
+ test_donau_unix.conf \
+ test_donau_httpd.get \
+ test_donau_httpd.post \
donau.conf \
$(bin_SCRIPTS) \
$(check_SCRIPTS)
diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c
@@ -81,12 +81,6 @@ static struct MHD_Daemon *mhd;
struct GNUNET_TIME_Relative DH_max_keys_caching;
/**
- * Master public key (according to the
- * configuration in the donau directory). (global)
- */
-struct TALER_MasterPublicKeyP DH_master_public_key;
-
-/**
* Our DB plugin. (global)
*/
struct DONAUDB_Plugin *DH_plugin;
@@ -103,13 +97,6 @@ unsigned int DH_currency_fraction_digits;
char *DH_currency;
/**
- * What is the largest amount we allow a peer to
- * merge into a reserve before always triggering
- * an AML check?
- */
-struct TALER_Amount DH_aml_threshold;
-
-/**
* Our base URL.
*/
char *DH_base_url;
@@ -822,11 +809,11 @@ do_shutdown (void *cls)
MHD_stop_daemon (mhd);
mhd = NULL;
}
- if (NULL != DH_plugin)
- {
- DONAUDB_plugin_unload (DH_plugin);
- DH_plugin = NULL;
- }
+ // if (NULL != DH_plugin)
+ // {
+ // DONAUDB_plugin_unload (DH_plugin);
+ // DH_plugin = NULL;
+ // }
if (NULL != DH_curl_ctx)
{
GNUNET_CURL_fini (DH_curl_ctx);
diff --git a/src/donau/donau-httpd_config.c b/src/donau/donau-httpd_config.c
@@ -39,7 +39,7 @@ DH_handler_config (struct DH_RequestContext *rc,
GNUNET_JSON_pack_string ("currency",
DH_currency),
GNUNET_JSON_pack_string ("name",
- "taler-donau"),
+ "donau"),
GNUNET_JSON_pack_string ("version",
DONAU_PROTOCOL_VERSION));
}
diff --git a/src/donau/donau-httpd_csr.c b/src/donau/donau-httpd_csr.c
@@ -83,15 +83,6 @@ DH_handler_csr_withdraw (struct DH_RequestContext *rc,
rc->connection,
&denom_pub_hash);
}
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_withdraw.abs_time))
- {
- /* This denomination is past the expiration time for withdraws/refreshes*/
- return DH_RESPONSE_reply_expired_denom_pub_hash (
- rc->connection,
- &denom_pub_hash,
- TALER_EC_DONAU_GENERIC_DENOMINATION_EXPIRED,
- "csr-withdraw");
- }
if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
/* This denomination is not yet valid, no need to check
diff --git a/src/donau/donau-httpd_db.c b/src/donau/donau-httpd_db.c
@@ -39,17 +39,17 @@ DH_DB_run_transaction (struct MHD_Connection *connection,
{
if (NULL != mhd_ret)
*mhd_ret = -1; /* set to invalid value, to help detect bugs */
- if (GNUNET_OK !=
- DH_plugin->preflight (DH_plugin->cls))
- {
- GNUNET_break (0);
- if (NULL != mhd_ret)
- *mhd_ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_SETUP_FAILED,
- NULL);
- return GNUNET_SYSERR;
- }
+ // if (GNUNET_OK !=
+ // DH_plugin->preflight (DH_plugin->cls))
+ // {
+ // GNUNET_break (0);
+ // if (NULL != mhd_ret)
+ // *mhd_ret = TALER_MHD_reply_with_error (connection,
+ // MHD_HTTP_INTERNAL_SERVER_ERROR,
+ // TALER_EC_GENERIC_DB_SETUP_FAILED,
+ // NULL);
+ // return GNUNET_SYSERR;
+ // }
GNUNET_assert (mt < DH_MT_REQUEST_COUNT);
DH_METRICS_num_requests[mt]++;
for (unsigned int retries = 0;
@@ -58,43 +58,43 @@ DH_DB_run_transaction (struct MHD_Connection *connection,
{
enum GNUNET_DB_QueryStatus qs;
- if (GNUNET_OK !=
- DH_plugin->start (DH_plugin->cls,
- name))
- {
- GNUNET_break (0);
- if (NULL != mhd_ret)
- *mhd_ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_START_FAILED,
- NULL);
- return GNUNET_SYSERR;
- }
+ // if (GNUNET_OK !=
+ // DH_plugin->start (DH_plugin->cls,
+ // name))
+ // {
+ // GNUNET_break (0);
+ // if (NULL != mhd_ret)
+ // *mhd_ret = TALER_MHD_reply_with_error (connection,
+ // MHD_HTTP_INTERNAL_SERVER_ERROR,
+ // TALER_EC_GENERIC_DB_START_FAILED,
+ // NULL);
+ // return GNUNET_SYSERR;
+ // }
qs = cb (cb_cls,
connection,
mhd_ret);
- if (0 > qs)
- {
- DH_plugin->rollback (DH_plugin->cls);
- if (GNUNET_DB_STATUS_HARD_ERROR == qs)
- return GNUNET_SYSERR;
- }
- else
- {
- qs = DH_plugin->commit (DH_plugin->cls);
- if (GNUNET_DB_STATUS_HARD_ERROR == qs)
- {
- DH_plugin->rollback (DH_plugin->cls);
- if (NULL != mhd_ret)
- *mhd_ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_COMMIT_FAILED,
- NULL);
- return GNUNET_SYSERR;
- }
- if (0 > qs)
- DH_plugin->rollback (DH_plugin->cls);
- }
+ // if (0 > qs)
+ // {
+ // DH_plugin->rollback (DH_plugin->cls);
+ // if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ // return GNUNET_SYSERR;
+ // }
+ // else
+ // {
+ // qs = DH_plugin->commit (DH_plugin->cls);
+ // if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ // {
+ // DH_plugin->rollback (DH_plugin->cls);
+ // if (NULL != mhd_ret)
+ // *mhd_ret = TALER_MHD_reply_with_error (connection,
+ // MHD_HTTP_INTERNAL_SERVER_ERROR,
+ // TALER_EC_GENERIC_DB_COMMIT_FAILED,
+ // NULL);
+ // return GNUNET_SYSERR;
+ // }
+ // if (0 > qs)
+ // DH_plugin->rollback (DH_plugin->cls);
+ // }
if (0 <= qs)
return GNUNET_OK;
DH_METRICS_num_conflict[mt]++;
diff --git a/src/donau/donau-httpd_db.h b/src/donau/donau-httpd_db.h
@@ -22,7 +22,7 @@
#define DONAU_HTTPD_DB_H
#include <microhttpd.h>
-#include "donaudb_plugin.h"
+// #include "donaudb_plugin.h"
#include "donau-httpd_metrics.h"
#include <gnunet/gnunet_mhd_compat.h>
diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
@@ -85,12 +85,12 @@ struct SigningKey
/**
* The donau's (online signing) public key.
*/
- struct DONAU_DonationUnitPublicKey donau_pub;
+ struct DONAU_EddsaPublicKeyP donau_pub;
/**
* Meta data about the signing key, such as validity periods.
*/
- struct DONAUDB_DonationUnitKeyMetaData meta;
+ struct DONAUDB_SignkeyMetaData meta;
};
@@ -294,26 +294,26 @@ add_sign_key_cb (void *cls,
struct SigningKey *sk = value;
(void) pid;
- //if (GNUNET_TIME_absolute_is_future (sk->meta.expire_sign.abs_time))
- //{
+ // if (GNUNET_TIME_absolute_is_future (sk->meta.expire_sign.abs_time))
+ // {
// ctx->min_sk_frequency =
// GNUNET_TIME_relative_min (ctx->min_sk_frequency,
// GNUNET_TIME_absolute_get_difference (
// sk->meta.start.abs_time,
// sk->meta.expire_sign.abs_time));
- //}
+ // }
GNUNET_assert (
0 ==
json_array_append_new (
ctx->signkeys,
GNUNET_JSON_PACK (
- //GNUNET_JSON_pack_timestamp ("stamp_start",
+ // GNUNET_JSON_pack_timestamp ("stamp_start",
// sk->meta.start),
- //GNUNET_JSON_pack_timestamp ("stamp_expire",
+ // GNUNET_JSON_pack_timestamp ("stamp_expire",
// sk->meta.expire_sign),
- //GNUNET_JSON_pack_timestamp ("stamp_end",
+ // GNUNET_JSON_pack_timestamp ("stamp_end",
// sk->meta.expire_legal),
- //GNUNET_JSON_pack_data_auto ("master_sig",
+ // GNUNET_JSON_pack_data_auto ("master_sig",
// &sk->master_sig),
GNUNET_JSON_pack_data_auto ("key",
&sk->donau_pub))));
@@ -321,7 +321,6 @@ add_sign_key_cb (void *cls,
}
-
/**
* Add the headers we want to set for every /keys response.
*
@@ -358,6 +357,7 @@ setup_general_response_headers (void *cls,
"public,max-age=3600"));
}
+
/**
* Update the "/keys" responses in @a ksh, computing the detailed replies.
*
@@ -377,7 +377,7 @@ finish_keys_response (struct DH_KeyStateHandle *ksh)
struct GNUNET_TIME_Timestamp last_cherry_pick_date;
struct GNUNET_CONTAINER_Heap *heap;
struct GNUNET_HashContext *hash_context = NULL;
- struct GNUNET_HashCode grouped_hash_xor = {0};
+ // struct GNUNET_HashCode grouped_hash_xor = {0};
sctx.signkeys = json_array ();
GNUNET_assert (NULL != sctx.signkeys);
@@ -395,10 +395,10 @@ finish_keys_response (struct DH_KeyStateHandle *ksh)
.min_dk_frequency = GNUNET_TIME_UNIT_FOREVER_REL,
};
- //GNUNET_CONTAINER_multihashmap_iterate (ksh->denomkey_map,
+ // GNUNET_CONTAINER_multihashmap_iterate (ksh->denomkey_map,
// &add_denom_key_cb,
// &dkc);
- //ksh->rekey_frequency
+ // ksh->rekey_frequency
// = GNUNET_TIME_relative_min (dkc.min_dk_frequency,
// sctx.min_sk_frequency);
}
@@ -417,7 +417,7 @@ finish_keys_response (struct DH_KeyStateHandle *ksh)
GNUNET_CRYPTO_hash_context_finish (hash_context,
&hc);
- //if (GNUNET_OK !=
+ // if (GNUNET_OK !=
// create_krd (ksh,
// &hc,
// last_cherry_pick_date,
@@ -425,12 +425,12 @@ finish_keys_response (struct DH_KeyStateHandle *ksh)
// recoup,
// grouped_denominations,
// &grouped_hash_xor))
- //{
+ // {
// GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
// "Failed to generate key response data for %s\n",
// GNUNET_TIME_timestamp2s (last_cherry_pick_date));
// goto CLEANUP;
- //}
+ // }
ksh->management_only = false;
}
else
@@ -449,6 +449,7 @@ CLEANUP:
return ret;
}
+
/**
* Free denomination key data.
*
@@ -466,7 +467,7 @@ clear_denomination_cb (void *cls,
(void) cls;
(void) h_donation_unit_pub;
- //TALER_denom_pub_free (&dk->denom_pub);
+ // TALER_denom_pub_free (&dk->denom_pub);
GNUNET_free (dk);
return GNUNET_OK;
}
@@ -493,6 +494,7 @@ clear_signkey_cb (void *cls,
return GNUNET_OK;
}
+
/**
* Clear memory for responses to "/keys" in @a ksh.
*
@@ -514,6 +516,7 @@ clear_response_cache (struct DH_KeyStateHandle *ksh)
0);
}
+
/**
* Synchronize helper state. Polls the key helper for updates.
*
@@ -527,6 +530,7 @@ sync_key_helpers (struct HelperState *hs)
TALER_CRYPTO_helper_esign_poll (hs->esh);
}
+
/**
* Destroy helper state. Does NOT call free() on @a hs, as that
* state is not separately allocated! Dual to #setup_key_helpers().
@@ -536,19 +540,19 @@ sync_key_helpers (struct HelperState *hs)
static void
destroy_key_helpers (struct HelperState *hs)
{
- //GNUNET_CONTAINER_multihashmap_iterate (hs->denom_keys,
+ // GNUNET_CONTAINER_multihashmap_iterate (hs->denom_keys,
// &free_denom_cb,
// hs);
- //GNUNET_CONTAINER_multihashmap_destroy (hs->rsa_keys);
- //hs->rsa_keys = NULL;
- //GNUNET_CONTAINER_multihashmap_destroy (hs->cs_keys);
- //hs->cs_keys = NULL;
- //GNUNET_CONTAINER_multihashmap_destroy (hs->denom_keys);
- //hs->denom_keys = NULL;
- //GNUNET_CONTAINER_multipeermap_iterate (hs->esign_keys,
+ // GNUNET_CONTAINER_multihashmap_destroy (hs->rsa_keys);
+ // hs->rsa_keys = NULL;
+ // GNUNET_CONTAINER_multihashmap_destroy (hs->cs_keys);
+ // hs->cs_keys = NULL;
+ // GNUNET_CONTAINER_multihashmap_destroy (hs->denom_keys);
+ // hs->denom_keys = NULL;
+ // GNUNET_CONTAINER_multipeermap_iterate (hs->esign_keys,
// &free_esign_cb,
// hs);
- //GNUNET_CONTAINER_multipeermap_destroy (hs->esign_keys);
+ // GNUNET_CONTAINER_multipeermap_destroy (hs->esign_keys);
hs->esign_keys = NULL;
if (NULL != hs->rsadh)
{
@@ -567,6 +571,7 @@ destroy_key_helpers (struct HelperState *hs)
}
}
+
/**
* Free resources associated with @a cls, possibly excluding
* the helper data.
@@ -578,16 +583,16 @@ static void
destroy_key_state (struct DH_KeyStateHandle *ksh,
bool free_helper)
{
- struct DH_GlobalFee *gf;
+ // struct DH_GlobalFee *gf;
clear_response_cache (ksh);
- //while (NULL != (gf = ksh->gf_head))
- //{
+ // while (NULL != (gf = ksh->gf_head))
+ // {
// GNUNET_CONTAINER_DLL_remove (ksh->gf_head,
// ksh->gf_tail,
// gf);
// GNUNET_free (gf);
- //}
+ // }
GNUNET_CONTAINER_multihashmap_iterate (ksh->denomkey_map,
&clear_denomination_cb,
ksh);
@@ -596,10 +601,10 @@ destroy_key_state (struct DH_KeyStateHandle *ksh,
&clear_signkey_cb,
ksh);
GNUNET_CONTAINER_multipeermap_destroy (ksh->signkey_map);
- //json_decref (ksh->auditors);
- //ksh->auditors = NULL;
- //json_decref (ksh->global_fees);
- //ksh->global_fees = NULL;
+ // json_decref (ksh->auditors);
+ // ksh->auditors = NULL;
+ // json_decref (ksh->global_fees);
+ // ksh->global_fees = NULL;
if (free_helper)
{
destroy_key_helpers (ksh->helpers);
@@ -613,6 +618,7 @@ destroy_key_state (struct DH_KeyStateHandle *ksh,
GNUNET_free (ksh);
}
+
/**
* Setup helper state.
*
@@ -622,7 +628,7 @@ destroy_key_state (struct DH_KeyStateHandle *ksh,
static enum GNUNET_GenericReturnValue
setup_key_helpers (struct HelperState *hs)
{
- //hs->denom_keys
+ // hs->denom_keys
// = GNUNET_CONTAINER_multihashmap_create (1024,
// GNUNET_YES);
hs->rsa_keys
@@ -634,33 +640,34 @@ setup_key_helpers (struct HelperState *hs)
hs->esign_keys
= GNUNET_CONTAINER_multipeermap_create (32,
GNUNET_NO /* MUST BE NO! */);
- //hs->rsadh = TALER_CRYPTO_helper_rsa_connect (DH_cfg,
+ // hs->rsadh = TALER_CRYPTO_helper_rsa_connect (DH_cfg,
// &helper_rsa_cb,
// hs);
- //if (NULL == hs->rsadh)
- //{
+ // if (NULL == hs->rsadh)
+ // {
// destroy_key_helpers (hs);
// return GNUNET_SYSERR;
- //}
- //hs->csdh = TALER_CRYPTO_helper_cs_connect (DH_cfg,
+ // }
+ // hs->csdh = TALER_CRYPTO_helper_cs_connect (DH_cfg,
// &helper_cs_cb,
// hs);
- //if (NULL == hs->csdh)
- //{
+ // if (NULL == hs->csdh)
+ // {
// destroy_key_helpers (hs);
// return GNUNET_SYSERR;
- //}
- //hs->esh = TALER_CRYPTO_helper_esign_connect (DH_cfg,
+ // }
+ // hs->esh = TALER_CRYPTO_helper_esign_connect (DH_cfg,
// &helper_esign_cb,
// hs);
- //if (NULL == hs->esh)
- //{
+ // if (NULL == hs->esh)
+ // {
// destroy_key_helpers (hs);
// return GNUNET_SYSERR;
- //}
+ // }
return GNUNET_OK;
}
+
/**
* Create a key state.
*
@@ -703,38 +710,38 @@ build_key_state (struct HelperState *hs,
false /* MUST be false! */
);
/* NOTE: fetches master-signed signkeys, but ALSO those that were revoked! */
- GNUNET_break (GNUNET_OK ==
- DH_plugin->preflight (DH_plugin->cls));
- if (qs < 0)
- {
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
- destroy_key_state (ksh,
- true);
- return NULL;
- }
- //qs = DH_plugin->iterate_denominations (DH_plugin->cls,
+ // GNUNET_break (GNUNET_OK ==
+ // DH_plugin->preflight (DH_plugin->cls));
+ // if (qs < 0)
+ // {
+ // GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
+ // GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
+ // destroy_key_state (ksh,
+ // true);
+ // return NULL;
+ // }
+ // qs = DH_plugin->iterate_denominations (DH_plugin->cls,
// &denomination_info_cb,
// ksh);
- //if (qs < 0)
- //{
+ // if (qs < 0)
+ // {
// GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
// GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
// destroy_key_state (ksh,
// true);
// return NULL;
- //}
+ // }
/* NOTE: ONLY fetches non-revoked AND master-signed signkeys! */
- //qs = DH_plugin->iterate_active_signkeys (DH_plugin->cls,
+ // qs = DH_plugin->iterate_active_signkeys (DH_plugin->cls,
// &signkey_info_cb,
// ksh);
- //if (qs < 0)
- //{
+ // if (qs < 0)
+ // {
// GNUNET_break (0);
// destroy_key_state (ksh,
// true);
// return NULL;
- //}
+ // }
if (management_only)
{
@@ -755,13 +762,13 @@ build_key_state (struct HelperState *hs,
return ksh;
}
-
+
void
DH_keys_update_states ()
{
struct GNUNET_DB_EventHeaderP es = {
.size = htons (sizeof (es)),
- //.type = htons (TALER_DBEVENT_DONAU_KEYS_UPDATED),
+ // .type = htons (TALER_DBEVENT_DONAU_KEYS_UPDATED),
};
DH_plugin->event_notify (DH_plugin->cls,
@@ -769,49 +776,52 @@ DH_keys_update_states ()
NULL,
0);
key_generation++;
- //DH_resume_keys_requests (false);
+ // DH_resume_keys_requests (false);
}
+
static struct DH_KeyStateHandle *
keys_get_state (bool management_only)
{
- struct DH_KeyStateHandle *old_ksh;
- struct DH_KeyStateHandle *ksh;
- old_ksh = key_state;
- if (NULL == old_ksh)
- {
- //ksh = build_key_state (NULL, management_only);
- ksh = NULL;
- if (NULL == ksh)
- return NULL;
- key_state = ksh;
- return ksh;
- }
- if ( (old_ksh->key_generation < key_generation) ||
- (GNUNET_TIME_absolute_is_past (old_ksh->signature_expires.abs_time)) )
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Rebuilding /keys, generation upgrade from %llu to %llu\n",
- (unsigned long long) old_ksh->key_generation,
- (unsigned long long) key_generation);
- ksh = build_key_state (old_ksh->helpers,
- management_only);
- key_state = ksh;
- old_ksh->helpers = NULL;
- destroy_key_state (old_ksh,
- false);
- return ksh;
- }
- sync_key_helpers (old_ksh->helpers);
- return old_ksh;
+ struct DH_KeyStateHandle *old_ksh;
+ struct DH_KeyStateHandle *ksh;
+ old_ksh = key_state;
+ if (NULL == old_ksh)
+ {
+ // ksh = build_key_state (NULL, management_only);
+ ksh = NULL;
+ if (NULL == ksh)
+ return NULL;
+ key_state = ksh;
+ return ksh;
+ }
+ if ( (old_ksh->key_generation < key_generation) ||
+ (GNUNET_TIME_absolute_is_past (old_ksh->signature_expires.abs_time)) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Rebuilding /keys, generation upgrade from %llu to %llu\n",
+ (unsigned long long) old_ksh->key_generation,
+ (unsigned long long) key_generation);
+ ksh = build_key_state (old_ksh->helpers,
+ management_only);
+ key_state = ksh;
+ old_ksh->helpers = NULL;
+ destroy_key_state (old_ksh,
+ false);
+ return ksh;
+ }
+ sync_key_helpers (old_ksh->helpers);
+ return old_ksh;
}
+
struct DH_KeyStateHandle *
DH_keys_get_state_for_management_only (void)
{
- return keys_get_state (true);
+ return keys_get_state (true);
}
+
MHD_RESULT
DH_keys_management_get_keys_handler (const struct DH_RequestHandler *rh,
struct MHD_Connection *connection)
@@ -832,65 +842,66 @@ DH_keys_management_get_keys_handler (const struct DH_RequestHandler *rh,
sync_key_helpers (ksh->helpers);
if (NULL == ksh->management_keys_reply)
{
- //struct FutureBuilderContext fbc = {
- // .ksh = ksh,
- // .donation_units = json_array (),
- // .signkeys = json_array ()
- //};
- if ( (GNUNET_is_zero (&donation_unit_rsa_sm_pub)) &&
- (GNUNET_is_zero (&donation_unit_cs_sm_pub)) )
- {
- /* Either IPC failed, or neither helper had any donation_unitinations configured. */
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_GATEWAY,
- TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE,
- NULL);
- }
- if (GNUNET_is_zero (&esign_sm_pub))
- {
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_GATEWAY,
- TALER_EC_EXCHANGE_SIGNKEY_HELPER_UNAVAILABLE,
- NULL);
- }
- //GNUNET_assert (NULL != fbc.donation_units);
- //GNUNET_assert (NULL != fbc.signkeys);
- //GNUNET_CONTAINER_multihashmap_iterate (ksh->helpers->donation_unit_keys,
- // &add_future_donation_unitkey_cb,
- // &fbc);
- //GNUNET_CONTAINER_multipeermap_iterate (ksh->helpers->esign_keys,
- // &add_future_signkey_cb,
- // &fbc);
- reply = GNUNET_JSON_PACK (
- //GNUNET_JSON_pack_array_steal ("future_donation_units",
- // fbc.donation_units),
- //GNUNET_JSON_pack_array_steal ("future_signkeys",
- // fbc.signkeys),
- //GNUNET_JSON_pack_data_auto ("master_pub",
- // &DH_master_public_key),
- GNUNET_JSON_pack_data_auto ("donation_unit_secmod_public_key",
- &donation_unit_rsa_sm_pub),
- GNUNET_JSON_pack_data_auto ("donation_unit_secmod_cs_public_key",
- &donation_unit_cs_sm_pub),
- GNUNET_JSON_pack_data_auto ("signkey_secmod_public_key",
- &esign_sm_pub));
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Returning GET /management/keys response:\n");
- if (NULL == reply)
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE,
- NULL);
- GNUNET_assert (NULL == ksh->management_keys_reply);
- ksh->management_keys_reply = reply;
+ // struct FutureBuilderContext fbc = {
+ // .ksh = ksh,
+ // .donation_units = json_array (),
+ // .signkeys = json_array ()
+ // };
+ if ( (GNUNET_is_zero (&donation_unit_rsa_sm_pub)) &&
+ (GNUNET_is_zero (&donation_unit_cs_sm_pub)) )
+ {
+ /* Either IPC failed, or neither helper had any donation_unitinations configured. */
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_GATEWAY,
+ TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE,
+ NULL);
+ }
+ if (GNUNET_is_zero (&esign_sm_pub))
+ {
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_GATEWAY,
+ TALER_EC_EXCHANGE_SIGNKEY_HELPER_UNAVAILABLE,
+ NULL);
+ }
+ // GNUNET_assert (NULL != fbc.donation_units);
+ // GNUNET_assert (NULL != fbc.signkeys);
+ // GNUNET_CONTAINER_multihashmap_iterate (ksh->helpers->donation_unit_keys,
+ // &add_future_donation_unitkey_cb,
+ // &fbc);
+ // GNUNET_CONTAINER_multipeermap_iterate (ksh->helpers->esign_keys,
+ // &add_future_signkey_cb,
+ // &fbc);
+ reply = GNUNET_JSON_PACK (
+ // GNUNET_JSON_pack_array_steal ("future_donation_units",
+ // fbc.donation_units),
+ // GNUNET_JSON_pack_array_steal ("future_signkeys",
+ // fbc.signkeys),
+ // GNUNET_JSON_pack_data_auto ("master_pub",
+ // &DH_master_public_key),
+ GNUNET_JSON_pack_data_auto ("donation_unit_secmod_public_key",
+ &donation_unit_rsa_sm_pub),
+ GNUNET_JSON_pack_data_auto ("donation_unit_secmod_cs_public_key",
+ &donation_unit_cs_sm_pub),
+ GNUNET_JSON_pack_data_auto ("signkey_secmod_public_key",
+ &esign_sm_pub));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Returning GET /management/keys response:\n");
+ if (NULL == reply)
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE,
+ NULL);
+ GNUNET_assert (NULL == ksh->management_keys_reply);
+ ksh->management_keys_reply = reply;
}
else
{
- reply = ksh->management_keys_reply;
+ reply = ksh->management_keys_reply;
}
return TALER_MHD_reply_json (connection,
reply,
MHD_HTTP_OK);
}
+
/* end of donau-httpd_keys.c */
diff --git a/src/donau/donau-httpd_keys.h b/src/donau/donau-httpd_keys.h
@@ -23,6 +23,7 @@
#include "taler/taler_mhd_lib.h"
// #include "donau-httpd_responses.h"
#include "donau_util.h"
+#include "donaudb_plugin.h"
#ifndef DONAU_HTTPD_KEYS_H
@@ -51,7 +52,7 @@ struct DH_DonationUnitKey
* Meta data about the type of the donation unit, containing the validity
* year and the value of the donation unit.
*/
- // struct DONAUDB_DonationUnitKeyMetaData meta;
+ struct DONAUDB_DonationUnitKeyMetaData meta;
};
diff --git a/src/donau/test_taler_donau_httpd.conf b/src/donau/test_donau_httpd.conf
diff --git a/src/donau/test_taler_donau_httpd.sh b/src/donau/test_donau_httpd.sh
diff --git a/src/donau/test_taler_donau_unix.conf b/src/donau/test_donau_unix.conf
diff --git a/src/donaudb/pg_activate_signing_key.c b/src/donaudb/pg_activate_signing_key.c
@@ -28,7 +28,7 @@
enum GNUNET_DB_QueryStatus
DH_PG_activate_signing_key (
void *cls,
- const struct DONAU_DonauPublicKeyP *donau_pub,
+ const struct DONAU_EddsaPublicKeyP *donau_pub,
const struct DONAUDB_SignkeyMetaData *meta)
{
struct PostgresClosure *pg = cls;
diff --git a/src/donaudb/pg_activate_signing_key.h b/src/donaudb/pg_activate_signing_key.h
@@ -36,7 +36,7 @@
enum GNUNET_DB_QueryStatus
DH_PG_activate_signing_key (
void *cls,
- const struct DONAU_DonauPublicKeyP *donau_pub,
+ const struct DONAU_EddsaPublicKeyP *donau_pub,
const struct DONAUDB_SignkeyMetaData *meta);
#endif
diff --git a/src/donaudb/pg_lookup_signing_key.c b/src/donaudb/pg_lookup_signing_key.c
@@ -29,7 +29,7 @@
enum GNUNET_DB_QueryStatus
DH_PG_lookup_signing_key (
void *cls,
- const struct DONAU_DonauPublicKeyP *donau_pub,
+ const struct DONAU_EddsaPublicKeyP *donau_pub,
struct DONAUDB_SignkeyMetaData *meta)
{
struct PostgresClosure *pg = cls;
diff --git a/src/donaudb/pg_lookup_signing_key.h b/src/donaudb/pg_lookup_signing_key.h
@@ -37,7 +37,7 @@
enum GNUNET_DB_QueryStatus
DH_PG_lookup_signing_key (
void *cls,
- const struct DONAU_DonauPublicKeyP *donau_pub,
+ const struct DONAU_EddsaPublicKeyP *donau_pub,
struct DONAUDB_SignkeyMetaData *meta);
#endif
diff --git a/src/donaudb/test_donaudb.c b/src/donaudb/test_donaudb.c
@@ -65,50 +65,6 @@ static int result;
*/
static struct DONAUDB_Plugin *plugin;
-
-/**
- * Callback that should never be called.
- */
-static void
-dead_prepare_cb (void *cls,
- uint64_t rowid,
- const char *wire_method,
- const char *buf,
- size_t buf_size)
-{
- (void) cls;
- (void) rowid;
- (void) wire_method;
- (void) buf;
- (void) buf_size;
- GNUNET_assert (0);
-}
-
-
-/**
- * Callback that is called with wire prepare data
- * and then marks it as finished.
- */
-static void
-mark_prepare_cb (void *cls,
- uint64_t rowid,
- const char *wire_method,
- const char *buf,
- size_t buf_size)
-{
- (void) cls;
- GNUNET_assert (11 == buf_size);
- GNUNET_assert (0 == strcasecmp (wire_method,
- "testcase"));
- GNUNET_assert (0 == memcmp (buf,
- "hello world",
- buf_size));
- GNUNET_break (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
- plugin->wire_prepare_data_mark_finished (plugin->cls,
- rowid));
-}
-
-
int
main (int argc,
char *const argv[])
diff --git a/src/include/donau_service.h b/src/include/donau_service.h
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file include/taler_donau_service.h
+ * @file include/donau_service.h
* @brief C interface of libtalerdonau, a C library to use donau's HTTP API
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
* @author Christian Grothoff
@@ -790,12 +790,12 @@ struct CharitySummary
/**
* Max donation amout for this charitiy and year.
*/
- struct TALER_Amount max_per_year;
+ struct TALER_Amount max_per_year;
/**
* Current donation amount for this charity and year.
*/
- struct TALER_Amount receipts_to_date;
+ struct TALER_Amount receipts_to_date;
};
diff --git a/src/include/donaudb_lib.h b/src/include/donaudb_lib.h
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with
COPYING.If not, see <http: // www.gnu.org/licenses/>
*/
/**
- *@file include/taler_donaudb_lib.h
+ *@file include/donaudb_lib.h
* @brief IO operations for the donau's private keys
* @author Florian Dold
* @author Benedikt Mueller
@@ -47,154 +47,4 @@ DONAUDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg);
void
DONAUDB_plugin_unload (struct DONAUDB_Plugin *plugin);
-/**
- * Information about an account from the configuration.
- */
-struct DONAUDB_AccountInfo
-{
- /**
- * Authentication data. Only parsed if
- * #DONAUDB_ALO_AUTHDATA was set.
- */
- const struct TALER_BANK_AuthenticationData *auth;
-
- /**
- * Section in the configuration file that specifies the
- * account. Must start with "donau-account-".
- */
- const char *section_name;
-
- /**
- * Name of the wire method used by this account.
- */
- const char *method;
-
- /**
- * true if this account is enabed to be debited
- * by the donau-aggregator.
- */
- bool debit_enabled;
-
- /**
- * true if this account is enabed to be credited by wallets
- * and needs to be watched by the donau-wirewatch.
- * Also, the account will only be included in /wire if credit
- * is enabled.
- */
- bool credit_enabled;
-};
-
-struct DONAUDB_TransactionList;
-/**
- * Calculate the total value of all transactions performed.
- * Stores @a off plus the cost of all transactions in @a tl
- * in @a ret.
- *
- * @param tl transaction list to process
- * @param off offset to use as the starting value
- * @param[out] ret where the resulting total is to be stored
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
- */
-enum GNUNET_GenericReturnValue
-DONAUDB_calculate_transaction_list_totals (
- struct DONAUDB_TransactionList *tl,
- const struct TALER_Amount *off,
- struct TALER_Amount *ret);
-
-
-/**
- * Function called with information about a wire account.
- *
- * @param cls closure
- * @param ai account information
- */
-typedef void
-(*DONAUDB_AccountCallback)(
- void *cls,
- const struct DONAUDB_AccountInfo *ai);
-
-
-/**
- * Return information about all accounts that
- * were loaded by #DONAUDB_load_accounts().
- *
- * @param cb callback to invoke
- * @param cb_cls closure for @a cb
- */
-void
-DONAUDB_find_accounts (DONAUDB_AccountCallback cb,
- void *cb_cls);
-
-
-/**
- * Find the wire plugin for the given payto:// URL.
- * Only useful after the accounts have been loaded
- * using #DONAUDB_load_accounts().
- *
- * @param method wire method we need an account for
- * @return NULL on error
- */
-const struct DONAUDB_AccountInfo *
-DONAUDB_find_account_by_method (const char *method);
-
-
-/**
- * Find the wire plugin for the given payto:// URL
- * Only useful after the accounts have been loaded
- * using #DONAUDB_load_accounts().
- *
- * @param url wire address we need an account for
- * @return NULL on error
- */
-const struct DONAUDB_AccountInfo *
-DONAUDB_find_account_by_payto_uri (const char *url);
-
-
-/**
- * Options for #DONAUDB_load_accounts()
- */
-enum DONAUDB_AccountLoaderOptions
-{
- DONAUDB_ALO_NONE = 0,
-
- /**
- * Load accounts enabled for DEBITs.
- */
- DONAUDB_ALO_DEBIT = 1,
-
- /**
- * Load accounts enabled for CREDITs.
- */
- DONAUDB_ALO_CREDIT = 2,
-
- /**
- * Load authentication data from the
- * "taler-accountcredentials-" section
- * to access the account at the bank.
- */
- DONAUDB_ALO_AUTHDATA = 4
-};
-
-
-/**
- * Load account information opf the donau from
- * @a cfg.
- *
- * @param cfg configuration to load from
- * @param options loader options
- * @return #GNUNET_OK on success, #GNUNET_NO if no accounts are configured
- */
-enum GNUNET_GenericReturnValue
-DONAUDB_load_accounts (
- const struct GNUNET_CONFIGURATION_Handle *cfg,
- enum DONAUDB_AccountLoaderOptions options);
-
-
-/**
- * Free resources allocated by
- * #DONAUDB_load_accounts().
- */
-void
-DONAUDB_unload_accounts (void);
-
#endif
diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c
@@ -33,7 +33,6 @@
#include <microhttpd.h>
#include "taler/taler_bank_service.h"
#include "taler/taler_fakebank_lib.h"
-#include "taler/taler_testing_lib.h"
/**
* Configuration file we use. One (big) configuration is used
@@ -44,7 +43,7 @@ static char *config_file;
/**
* Our credentials.
*/
-static struct TALER_TESTING_Credentials cred;
+static struct DONAU_TESTING_Credentials cred;
/**
* Some tests behave differently when using CS as we cannot
@@ -64,7 +63,7 @@ static bool uses_cs;
*/
static void
run (void *cls,
- struct TALER_TESTING_Interpreter *is)
+ struct DONAU_TESTING_Interpreter *is)
{
// tests
}
@@ -87,7 +86,7 @@ main (int argc,
cipher);
GNUNET_free (cipher);
}
- return TALER_TESTING_main (argv,
+ return DONAU_TESTING_main (argv,
"INFO",
config_file,
"donau-account-2",
diff --git a/src/testing/test_donau_api.conf b/src/testing/test_donau_api.conf
@@ -9,15 +9,12 @@ TALER_TEST_HOME = test_donau_api_home/
CURRENCY = EUR
CURRENCY_ROUND_UNIT = EUR:0.01
-[bank]
-HTTP_PORT = 8082
-
[donau]
TERMS_ETAG = tos
PRIVACY_ETAG = 0
-PORT = 8081
+PORT = 8080
DB = postgres
-BASE_URL = "http://localhost:8081/"
+BASE_URL = "http://localhost:8080/"
SERVE = tcp
EXPIRE_IDLE_SLEEP_INTERVAL ="1 s"
MAX_KEYS_CACHING = forever
diff --git a/src/testing/testing_api_misc.c b/src/testing/testing_api_misc.c
@@ -28,7 +28,7 @@
bool
-TALER_TESTING_has_in_name (const char *prog,
+DONAU_TESTING_has_in_name (const char *prog,
const char *marker)
{
size_t name_pos;
@@ -52,126 +52,6 @@ TALER_TESTING_has_in_name (const char *prog,
}
-enum GNUNET_GenericReturnValue
-TALER_TESTING_get_credentials (
- const char *cfg_file,
- const char *donau_account_section,
- enum TALER_TESTING_BankSystem bs,
- struct TALER_TESTING_Credentials *ua)
-{
- unsigned long long port;
- char *donau_payto_uri;
-
- ua->cfg = GNUNET_CONFIGURATION_create ();
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_load (ua->cfg,
- cfg_file))
- {
- GNUNET_break (0);
- GNUNET_CONFIGURATION_destroy (ua->cfg);
- return GNUNET_SYSERR;
- }
- if (0 !=
- strncasecmp (donau_account_section,
- "donau-account-",
- strlen ("donau-account-")))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (ua->cfg,
- donau_account_section,
- "PAYTO_URI",
- &donau_payto_uri))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- donau_account_section,
- "PAYTO_URI");
- return GNUNET_SYSERR;
- }
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (ua->cfg,
- "bank",
- "HTTP_PORT",
- &port))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "bank",
- "HTTP_PORT");
- return GNUNET_SYSERR;
- }
- {
- char *csn;
-
- GNUNET_asprintf (&csn,
- "donau-accountcredentials-%s",
- &donau_account_section[strlen ("donau-account-")]);
- if (GNUNET_OK !=
- TALER_BANK_auth_parse_cfg (ua->cfg,
- csn,
- &ua->ba))
- {
- GNUNET_break (0);
- GNUNET_free (csn);
- return GNUNET_SYSERR;
- }
- GNUNET_free (csn);
- }
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (ua->cfg,
- "donau",
- "BASE_URL",
- &ua->donau_url))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "donau",
- "BASE_URL");
- return GNUNET_SYSERR;
- }
-
- switch (bs)
- {
- case TALER_TESTING_BS_FAKEBANK:
- ua->donau_payto
- = donau_payto_uri;
- ua->user42_payto
- = GNUNET_strdup ("payto://x-taler-bank/localhost/42?receiver-name=42");
- ua->user43_payto
- = GNUNET_strdup ("payto://x-taler-bank/localhost/43?receiver-name=43");
- break;
- case TALER_TESTING_BS_IBAN:
- ua->donau_payto
- = donau_payto_uri;
- ua->user42_payto
- = GNUNET_strdup (
- "payto://iban/SANDBOXX/FR7630006000011234567890189?receiver-name=User42");
- ua->user43_payto
- = GNUNET_strdup (
- "payto://iban/SANDBOXX/GB33BUKB20201555555555?receiver-name=User43");
- break;
- }
- return GNUNET_OK;
-}
-
-
-json_t *
-TALER_TESTING_make_wire_details (const char *payto)
-{
- struct TALER_WireSaltP salt;
-
- /* salt must be constant for aggregation tests! */
- memset (&salt,
- 47,
- sizeof (salt));
- return GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("payto_uri",
- payto),
- GNUNET_JSON_pack_data_auto ("salt",
- &salt));
-}
-
-
/**
* Remove @a option directory from @a section in @a cfg.
*
@@ -206,7 +86,7 @@ remove_dir (const struct GNUNET_CONFIGURATION_Handle *cfg,
enum GNUNET_GenericReturnValue
-TALER_TESTING_cleanup_files_cfg (
+DONAU_TESTING_cleanup_files_cfg (
void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
@@ -247,7 +127,7 @@ TALER_TESTING_cleanup_files_cfg (
const struct DONAU_DenomPublicKey *
-TALER_TESTING_find_pk (
+DONAU_TESTING_find_pk (
const struct DONAU_Keys *keys,
const struct TALER_Amount *amount,
bool age_restricted)
@@ -308,7 +188,7 @@ TALER_TESTING_find_pk (
int
-TALER_TESTING_wait_httpd_ready (const char *base_url)
+DONAU_TESTING_wait_httpd_ready (const char *base_url)
{
char *wget_cmd;
unsigned int iter;
@@ -340,7 +220,7 @@ TALER_TESTING_wait_httpd_ready (const char *base_url)
enum GNUNET_GenericReturnValue
-TALER_TESTING_url_port_free (const char *url)
+DONAU_TESTING_url_port_free (const char *url)
{
const char *port;
long pnum;