donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 42d1148d1d26bc0eabddcc43e5810423d24ffc0a
parent 423e85135d963dc85240b83bf963d320745f979b
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Tue,  9 Jan 2024 11:49:17 +0100

Merge remote-tracking branch 'refs/remotes/origin/master'

Diffstat:
Msrc/donau/donau-httpd.c | 17+++++++++++++++++
Msrc/donau/donau-httpd_get-charity.c | 11++++++++---
Msrc/donau/donau.conf | 18++++++++++++------
Msrc/donau/test_donau_httpd.conf | 2--
Msrc/donaudb/0002-donation_units.sql | 2+-
Msrc/donaudb/0002-donau_charities.sql | 2+-
Msrc/donaudb/0002-donau_history.sql | 2+-
Msrc/donaudb/pg_lookup_charity.c | 2+-
Msrc/donaudb/pg_lookup_charity.h | 2+-
Msrc/include/donaudb_plugin.h | 2+-
10 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c @@ -759,6 +759,23 @@ donau_serve_process_config (void) return GNUNET_SYSERR; } + for (unsigned int i = 0; i<MAX_DB_RETRIES; i++) + { + DH_plugin = DONAUDB_plugin_load (DH_cfg); + if (NULL != DH_plugin) + break; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to connect to DB, will try again %u times\n", + MAX_DB_RETRIES - i); + sleep (1); + } + if (NULL == DH_plugin) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to initialize DB subsystem. Giving up.\n"); + return GNUNET_SYSERR; + } + return GNUNET_OK; } diff --git a/src/donau/donau-httpd_get-charity.c b/src/donau/donau-httpd_get-charity.c @@ -42,10 +42,14 @@ DH_handler_charity_get ( struct DH_RequestContext *rc, const char *const args[]) { - unsigned long charity_id; + unsigned long long charity_id; + char dummy; if ( (NULL == args[0]) || - (1 != sscanf (args[0], "%lu", &charity_id))) + (1 != sscanf (args[0], + "%llu%c", + &charity_id, + &dummy)) ) { GNUNET_break_op (0); return TALER_MHD_reply_with_error (rc->connection, @@ -100,7 +104,8 @@ DH_handler_charity_get ( GNUNET_JSON_pack_data_auto ("name", &meta.charity_name)); - // GNUNET_free (meta); + GNUNET_free (meta.charity_url); + GNUNET_free (meta.charity_name); return result; } } diff --git a/src/donau/donau.conf b/src/donau/donau.conf @@ -12,12 +12,6 @@ # capitals (like at gas stations) when present. CURRENCY_FRACTION_DIGITS = 2 -# Specifies a program (binary) to run on KYC attribute data to decide -# whether we should immediately flag an account for AML review. -# The KYC attribute data will be passed on standard-input. -# Return non-zero to trigger AML review of the new user. -KYC_AML_TRIGGER = true - # Attribute encryption key for storing attributes encrypted # in the database. Should be a high-entropy nonce. ATTRIBUTE_ENCRYPTION_KEY = SET_ME_PLEASE @@ -76,3 +70,15 @@ CLOSER_IDLE_SLEEP_INTERVAL = 60 s # against the donau's database. Otherwise, the # aggregation logic will break badly! ROUTER_SHARD_SIZE = 2147483648 + +# Directory with our terms of service. +TERMS_DIR = $TALER_DATA_HOME/terms/ + +# Etag / filename for the terms of service. +TERMS_ETAG = donau-tos-v0 + +# Directory with our privacy policy. +PRIVACY_DIR = $TALER_DATA_HOME/terms/ + +# Etag / filename for the privacy policy. +PRIVACY_ETAG = donau-pp-v0 diff --git a/src/donau/test_donau_httpd.conf b/src/donau/test_donau_httpd.conf @@ -13,8 +13,6 @@ TINY_AMOUNT = EUR:0.01 [donau] -AML_THRESHOLD = EUR:1000000 - # Directory with our terms of service. TERMS_DIR = ../../contrib/tos diff --git a/src/donaudb/0002-donation_units.sql b/src/donaudb/0002-donation_units.sql @@ -17,7 +17,7 @@ CREATE TABLE donation_units (donation_unit_serial BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE ,donation_unit_hash BYTEA PRIMARY KEY CHECK (LENGTH(donation_unit_hash)=64) - ,donation_unit_pub BYTEA NOT NULL + ,donation_unit_pub BYTEA UNIQUE NOT NULL ,validity_year INT4 NOT NULL ,donation_unit taler_amount NOT NULL ); diff --git a/src/donaudb/0002-donau_charities.sql b/src/donaudb/0002-donau_charities.sql @@ -16,7 +16,7 @@ CREATE TABLE charities (charity_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE - ,charity_pub BYTEA PRIMARY KEY CHECK (LENGTH(donau_pub)=32) + ,charity_pub BYTEA PRIMARY KEY CHECK (LENGTH(charity_pub)=32) ,charity_name TEXT NOT NULL ,charity_url TEXT NOT NULL ,max_per_year taler_amount NOT NULL diff --git a/src/donaudb/0002-donau_history.sql b/src/donaudb/0002-donau_history.sql @@ -15,7 +15,7 @@ -- CREATE TABLE history - (charity_id BIGINT KEY REFERENCES charities (charity_id) ON DELETE CASCADE + (charity_id BIGINT PRIMARY KEY REFERENCES charities (charity_id) ON DELETE CASCADE ,final_amount taler_amount NOT NULL ,donation_year INT8 NOT NULL ); diff --git a/src/donaudb/pg_lookup_charity.c b/src/donaudb/pg_lookup_charity.c @@ -28,7 +28,7 @@ enum GNUNET_DB_QueryStatus DH_PG_lookup_charity ( void *cls, - unsigned long charity_id, + uint64_t charity_id, struct DONAUDB_CharityMetaData *meta) { struct PostgresClosure *pg = cls; diff --git a/src/donaudb/pg_lookup_charity.h b/src/donaudb/pg_lookup_charity.h @@ -34,7 +34,7 @@ enum GNUNET_DB_QueryStatus DH_PG_lookup_charity ( void *cls, - unsigned long charity_id, + uint64_t charity_id, struct DONAUDB_CharityMetaData *meta); #endif diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h @@ -351,7 +351,7 @@ struct DONAUDB_Plugin enum GNUNET_DB_QueryStatus (*lookup_charity)( void *cls, - unsigned long charity_id, + uint64_t charity_id, struct DONAUDB_CharityMetaData *meta); /**