diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-03-28 11:06:00 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-03-28 11:06:00 +0100 |
commit | c626ccac51dc968725b2ead1ecb0cebedd9987fc (patch) | |
tree | 3acda45b9071865598d2b2670bf6b4bc3f29a57f | |
parent | eae1896a4bfc02b5d7586f81bbedfea69b29acc8 (diff) |
second round of renamefest
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/include/Makefile.am | 1 | ||||
-rw-r--r-- | src/include/taler_mintdb_lib.h (renamed from src/mint/key_io.h) | 26 | ||||
-rw-r--r-- | src/include/taler_mintdb_plugin.h | 5 | ||||
-rw-r--r-- | src/mint-lib/Makefile.am (renamed from src/lib/Makefile.am) | 0 | ||||
-rw-r--r-- | src/mint-lib/mint_api.c (renamed from src/lib/mint_api.c) | 0 | ||||
-rw-r--r-- | src/mint-lib/test_mint_api.c (renamed from src/lib/test_mint_api.c) | 0 | ||||
-rw-r--r-- | src/mint-tools/Makefile.am | 63 | ||||
-rw-r--r-- | src/mint-tools/taler-mint-dbinit.c (renamed from src/mint/taler-mint-dbinit.c) | 15 | ||||
-rw-r--r-- | src/mint-tools/taler-mint-keycheck.c (renamed from src/mint/taler-mint-keycheck.c) | 2 | ||||
-rw-r--r-- | src/mint-tools/taler-mint-keyup.c (renamed from src/mint/taler-mint-keyup.c) | 2 | ||||
-rw-r--r-- | src/mint-tools/taler-mint-reservemod.c (renamed from src/mint/taler-mint-reservemod.c) | 2 | ||||
-rw-r--r-- | src/mint/Makefile.am | 128 | ||||
-rw-r--r-- | src/mint/plugin.h | 50 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd.c | 12 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd.h | 5 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_db.c | 128 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_db.h | 1 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_deposit.c | 1 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_keystate.h | 2 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_mhd.c | 1 | ||||
-rw-r--r-- | src/mintdb/Makefile.am | 68 | ||||
-rw-r--r-- | src/mintdb/mintdb_keyio.c (renamed from src/mint/key_io.c) | 4 | ||||
-rw-r--r-- | src/mintdb/mintdb_plugin.c (renamed from src/mint/plugin.c) | 36 | ||||
-rw-r--r-- | src/mintdb/plugin_mintdb_common.c (renamed from src/mint/plugin_mintdb_common.c) | 0 | ||||
-rw-r--r-- | src/mintdb/plugin_mintdb_postgres.c (renamed from src/mint/plugin_mintdb_postgres.c) | 1 | ||||
-rw-r--r-- | src/mintdb/test_mintdb.c (renamed from src/mint/test_mint_db.c) | 0 | ||||
-rw-r--r-- | src/mintdb/test_mintdb_deposits.c (renamed from src/mint/test_mint_deposits.c) | 0 | ||||
-rw-r--r-- | src/mintdb/test_mintdb_keyio.c (renamed from src/mint/test_mint_common.c) | 0 |
30 files changed, 277 insertions, 282 deletions
diff --git a/configure.ac b/configure.ac index f69bcefd2..abc23c1f2 100644 --- a/configure.ac +++ b/configure.ac @@ -174,7 +174,9 @@ AC_CONFIG_FILES([Makefile src/include/Makefile src/util/Makefile src/pq/Makefile + src/mintdb/Makefile src/mint/Makefile - src/lib/Makefile + src/mint-tools/Makefile + src/mint-lib/Makefile ]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 0315beadc..a2d3ebcd9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,3 @@ # This Makefile.am is in the public domain AM_CPPFLAGS = -I$(top_srcdir)/src/include -SUBDIRS = include util pq mint lib +SUBDIRS = include util pq mintdb mint mint-tools mint-lib diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 4d4c6771e..5bb4cfa20 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -8,6 +8,7 @@ talerinclude_HEADERS = \ taler_json_lib.h \ taler_util.h \ taler_mint_service.h \ + taler_mintdb_lib.h \ taler_mintdb_plugin.h \ taler_pq_lib.h \ taler_signatures.h diff --git a/src/mint/key_io.h b/src/include/taler_mintdb_lib.h index 0ff968976..cceec3307 100644 --- a/src/mint/key_io.h +++ b/src/include/taler_mintdb_lib.h @@ -14,14 +14,14 @@ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ /** - * @file mint/key_io.h + * @file include/taler_mintdb_lib.h * @brief IO operations for the mint's private keys * @author Florian Dold * @author Benedikt Mueller * @author Christian Grothoff */ -#ifndef KEY_IO_H -#define KEY_IO_H +#ifndef TALER_MINTDB_LIB_H +#define TALER_MINTDB_LIB_H #include <gnunet/gnunet_util_lib.h> #include "taler_signatures.h" @@ -184,4 +184,24 @@ TALER_MINT_read_denom_key (const char *filename, struct TALER_DenominationKeyIssueInformation *dki); +/** + * Initialize the plugin. + * + * @param cfg configuration to use + * @return NULL on failure + */ +struct TALER_MINTDB_Plugin * +TALER_MINT_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg); + + +/** + * Shutdown the plugin. + * + * @param plugin plugin to unload + */ +void +TALER_MINT_plugin_unload (struct TALER_MINTDB_Plugin *plugin); + + + #endif diff --git a/src/include/taler_mintdb_plugin.h b/src/include/taler_mintdb_plugin.h index 8c9f4af23..7cd3e9202 100644 --- a/src/include/taler_mintdb_plugin.h +++ b/src/include/taler_mintdb_plugin.h @@ -479,9 +479,10 @@ struct TALER_MINTDB_Plugin void *cls; /** - * Name of the library which generated this plugin + * Name of the library which generated this plugin. Set by the + * plugin loader. */ - const char *library_name; + char *library_name; /** * Get the thread-local database-handle. diff --git a/src/lib/Makefile.am b/src/mint-lib/Makefile.am index f91ca32c1..f91ca32c1 100644 --- a/src/lib/Makefile.am +++ b/src/mint-lib/Makefile.am diff --git a/src/lib/mint_api.c b/src/mint-lib/mint_api.c index 019793b78..019793b78 100644 --- a/src/lib/mint_api.c +++ b/src/mint-lib/mint_api.c diff --git a/src/lib/test_mint_api.c b/src/mint-lib/test_mint_api.c index a068dde93..a068dde93 100644 --- a/src/lib/test_mint_api.c +++ b/src/mint-lib/test_mint_api.c diff --git a/src/mint-tools/Makefile.am b/src/mint-tools/Makefile.am new file mode 100644 index 000000000..7ae6f355a --- /dev/null +++ b/src/mint-tools/Makefile.am @@ -0,0 +1,63 @@ +# This Makefile.am is in the public domain +AM_CPPFLAGS = -I$(top_srcdir)/src/include + +bin_PROGRAMS = \ + taler-mint-keyup \ + taler-mint-keycheck \ + taler-mint-reservemod \ + taler-mint-dbinit + +taler_mint_keyup_SOURCES = \ + taler-mint-keyup.c + +taler_mint_keyup_LDADD = \ + $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/util/libtalerutil.la \ + $(top_builddir)/src/pq/libtalerpq.la \ + $(top_builddir)/src/mint/libtalermint_common.la \ + -lgnunetutil +taler_mint_keyup_LDFLAGS = $(POSTGRESQL_LDFLAGS) + + +taler_mint_keycheck_SOURCES = \ + taler-mint-keycheck.c + +taler_mint_keycheck_LDADD = \ + $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/util/libtalerutil.la \ + $(top_builddir)/src/pq/libtalerpq.la \ + $(top_builddir)/src/mint/libtalermint_common.la \ + -lgnunetutil +taler_mint_keycheck_LDFLAGS = $(POSTGRESQL_LDFLAGS) + +taler_mint_reservemod_SOURCES = \ + taler-mint-reservemod.c +taler_mint_reservemod_LDADD = \ + $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/util/libtalerutil.la \ + $(top_builddir)/src/pq/libtalerpq.la \ + $(top_builddir)/src/mint/libtalermint_common.la \ + -lpq \ + -lgnunetutil +taler_mint_reservemod_LDFLAGS = \ + $(POSTGRESQL_LDFLAGS) +taler_mint_reservemod_CPPFLAGS = \ + -I$(top_srcdir)/src/include \ + -I$(top_srcdir)/src/pq/ \ + $(POSTGRESQL_CPPFLAGS) + +taler_mint_dbinit_SOURCES = \ + taler-mint-dbinit.c +taler_mint_dbinit_LDADD = \ + $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/util/libtalerutil.la \ + $(top_builddir)/src/pq/libtalerpq.la \ + $(top_builddir)/src/mint/libtalermint_common.la \ + -lpq \ + -lgnunetutil +taler_mint_dbinit_LDFLAGS = \ + $(POSTGRESQL_LDFLAGS) +taler_mint_dbinit_CPPFLAGS = \ + -I$(top_srcdir)/src/include \ + -I$(top_srcdir)/src/pq/ \ + $(POSTGRESQL_CPPFLAGS) diff --git a/src/mint/taler-mint-dbinit.c b/src/mint-tools/taler-mint-dbinit.c index 8056b7df0..ec08369b8 100644 --- a/src/mint/taler-mint-dbinit.c +++ b/src/mint-tools/taler-mint-dbinit.c @@ -23,7 +23,7 @@ #include <libpq-fe.h> #include "taler_util.h" #include "taler_mintdb_plugin.h" -#include "plugin.h" +#include "taler_mintdb_lib.h" /** * Mint directory with the keys. @@ -35,6 +35,11 @@ static char *mint_base_dir; */ static struct GNUNET_CONFIGURATION_Handle *cfg; +/** + * Our DB plugin. + */ +static struct TALER_MINTDB_Plugin *plugin; + /** * The main function of the database initialization tool. @@ -78,8 +83,8 @@ main (int argc, "Failed to load mint configuration.\n"); return 1; } - if (GNUNET_OK != - TALER_MINT_plugin_load (cfg)) + if (NULL == + (plugin = TALER_MINT_plugin_load (cfg))) { fprintf (stderr, "Failed to initialize database plugin.\n"); @@ -91,10 +96,10 @@ main (int argc, { fprintf (stderr, "Failed to initialize database.\n"); - TALER_MINT_plugin_unload (); + TALER_MINT_plugin_unload (plugin); return 1; } - TALER_MINT_plugin_unload (); + TALER_MINT_plugin_unload (plugin); return 0; } diff --git a/src/mint/taler-mint-keycheck.c b/src/mint-tools/taler-mint-keycheck.c index 4e8885fd3..b18ebdf7a 100644 --- a/src/mint/taler-mint-keycheck.c +++ b/src/mint-tools/taler-mint-keycheck.c @@ -24,7 +24,7 @@ */ #include <platform.h> #include <gnunet/gnunet_util_lib.h> -#include "key_io.h" +#include "taler_mintdb_lib.h" /** * Mint directory with the keys. diff --git a/src/mint/taler-mint-keyup.c b/src/mint-tools/taler-mint-keyup.c index ab457426c..8ffe7d165 100644 --- a/src/mint/taler-mint-keyup.c +++ b/src/mint-tools/taler-mint-keyup.c @@ -24,7 +24,7 @@ #include <platform.h> #include <gnunet/gnunet_util_lib.h> #include "taler_util.h" -#include "key_io.h" +#include "taler_mintdb_lib.h" /** * When generating filenames from a cryptographic hash, we do not use diff --git a/src/mint/taler-mint-reservemod.c b/src/mint-tools/taler-mint-reservemod.c index 125748704..3261f47cf 100644 --- a/src/mint/taler-mint-reservemod.c +++ b/src/mint-tools/taler-mint-reservemod.c @@ -25,7 +25,7 @@ #include "taler_util.h" #include "taler_signatures.h" #include "taler_mintdb_plugin.h" -#include "taler_pq_lib.h" +#include "taler_mintdb_lib.h" /** diff --git a/src/mint/Makefile.am b/src/mint/Makefile.am index f8e5696ff..538020e9e 100644 --- a/src/mint/Makefile.am +++ b/src/mint/Makefile.am @@ -1,82 +1,8 @@ # This Makefile.am is in the public domain -AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/pq/ $(POSTGRESQL_CPPFLAGS) - -plugindir = $(libdir)/taler - -plugin_LTLIBRARIES = \ - libtaler_plugin_mintdb_postgres.la - -EXTRA_DIST = plugin_mintdb_common.c - -libtaler_plugin_mintdb_postgres_la_SOURCES = \ - plugin_mintdb_postgres.c -libtaler_plugin_mintdb_postgres_la_LIBADD = \ - $(LTLIBINTL) -libtaler_plugin_mintdb_postgres_la_LDFLAGS = \ - $(TALER_PLUGIN_LDFLAGS) \ - -lpq \ - -lgnunetutil - -lib_LTLIBRARIES = \ - libtalermint_common.la - -libtalermint_common_la_SOURCES = \ - key_io.c key_io.h \ - plugin.c plugin.h - -libtalermint_common_la_LIBADD = \ - $(top_builddir)/src/util/libtalerutil.la \ - -lgnunetutil - -libtalermint_common_la_LDFLAGS = \ - $(POSTGRESQL_LDFLAGS) \ - -version-info 0:0:0 \ - -no-undefined - +AM_CPPFLAGS = -I$(top_srcdir)/src/include bin_PROGRAMS = \ - taler-mint-keyup \ - taler-mint-keycheck \ - taler-mint-reservemod \ - taler-mint-httpd \ - taler-mint-dbinit - -taler_mint_keyup_SOURCES = \ - taler-mint-keyup.c - -taler_mint_keyup_LDADD = \ - $(LIBGCRYPT_LIBS) \ - $(top_builddir)/src/util/libtalerutil.la \ - $(top_builddir)/src/pq/libtalerpq.la \ - $(top_builddir)/src/mint/libtalermint_common.la \ - -lpq \ - -lgnunetutil -taler_mint_keyup_LDFLAGS = $(POSTGRESQL_LDFLAGS) - - -taler_mint_keycheck_SOURCES = \ - taler-mint-keycheck.c - -taler_mint_keycheck_LDADD = \ - $(LIBGCRYPT_LIBS) \ - $(top_builddir)/src/util/libtalerutil.la \ - $(top_builddir)/src/pq/libtalerpq.la \ - $(top_builddir)/src/mint/libtalermint_common.la \ - -lgnunetutil \ - -lpq -taler_mint_keycheck_LDFLAGS = $(POSTGRESQL_LDFLAGS) - -taler_mint_reservemod_SOURCES = \ - taler-mint-reservemod.c -taler_mint_reservemod_LDADD = \ - $(LIBGCRYPT_LIBS) \ - $(top_builddir)/src/util/libtalerutil.la \ - $(top_builddir)/src/pq/libtalerpq.la \ - $(top_builddir)/src/mint/libtalermint_common.la \ - -lpq \ - -lgnunetutil -taler_mint_reservemod_LDFLAGS = \ - $(POSTGRESQL_LDFLAGS) + taler-mint-httpd taler_mint_httpd_SOURCES = \ taler-mint-httpd.c \ @@ -92,56 +18,8 @@ taler_mint_httpd_LDADD = \ $(LIBGCRYPT_LIBS) \ $(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/pq/libtalerpq.la \ - $(top_builddir)/src/mint/libtalermint_common.la \ - -lpq \ + $(top_builddir)/src/mintdb/libtalermintdb.la \ -lmicrohttpd \ -ljansson \ -lgnunetutil \ -lpthread -taler_mint_httpd_LDFLAGS = \ - $(POSTGRESQL_LDFLAGS) - - -taler_mint_dbinit_SOURCES = \ - taler-mint-dbinit.c -taler_mint_dbinit_LDADD = \ - $(LIBGCRYPT_LIBS) \ - $(top_builddir)/src/util/libtalerutil.la \ - $(top_builddir)/src/pq/libtalerpq.la \ - $(top_builddir)/src/mint/libtalermint_common.la \ - -lpq \ - -lgnunetutil -taler_mint_dbinit_LDFLAGS = $(POSTGRESQL_LDFLAGS) - -check_PROGRAMS = \ - test-mint-deposits \ - test-mint-common \ - test-mint-db-postgres - -test_mint_deposits_SOURCES = \ - test_mint_deposits.c -test_mint_deposits_LDADD = \ - libtalermint_common.la \ - $(top_srcdir)/src/util/libtalerutil.la \ - $(top_srcdir)/src/pq/libtalerpq.la \ - -lgnunetutil \ - -ljansson \ - -lpq - -test_mint_common_SOURCES = \ - test_mint_common.c -test_mint_common_LDADD = \ - libtalermint_common.la \ - $(top_srcdir)/src/util/libtalerutil.la \ - $(top_srcdir)/src/pq/libtalerpq.la \ - -lgnunetutil - -test_mint_db_postgres_SOURCES = \ - test_mint_db.c -test_mint_db_postgres_LDADD = \ - libtalermint_common.la \ - $(top_srcdir)/src/util/libtalerutil.la \ - $(top_srcdir)/src/pq/libtalerpq.la \ - -lgnunetutil -ljansson -EXTRA_test_mint_db_postgres_DEPENDENCIES = \ - libtaler_plugin_mintdb_postgres.la diff --git a/src/mint/plugin.h b/src/mint/plugin.h deleted file mode 100644 index 0dfb866da..000000000 --- a/src/mint/plugin.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2015 Christian Grothoff (and other contributing authors) - - 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 MERCHANTABILITY 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, If not, see <http://www.gnu.org/licenses/> -*/ -/** - * @file mint/plugin.h - * @brief Logic to load database plugins - * @author Christian Grothoff - */ -#ifndef PLUGIN_H -#define PLUGIN_H - -#include <gnunet/gnunet_util_lib.h> -#include "taler_mintdb_plugin.h" - -/** - * Global variable with the plugin (once loaded). - */ -extern struct TALER_MINTDB_Plugin *plugin; - - -/** - * Initialize the plugin. - * - * @param cfg configuration to use - * @return #GNUNET_OK on success - */ -int -TALER_MINT_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg); - - -/** - * Shutdown the plugin. - */ -void -TALER_MINT_plugin_unload (void); - - -#endif diff --git a/src/mint/taler-mint-httpd.c b/src/mint/taler-mint-httpd.c index 13c77b033..a86735963 100644 --- a/src/mint/taler-mint-httpd.c +++ b/src/mint/taler-mint-httpd.c @@ -25,7 +25,6 @@ #include <gnunet/gnunet_util_lib.h> #include <jansson.h> #include <microhttpd.h> -#include <libpq-fe.h> #include <pthread.h> #include "taler_signatures.h" #include "taler_util.h" @@ -36,7 +35,6 @@ #include "taler-mint-httpd_refresh.h" #include "taler-mint-httpd_keystate.h" #include "taler_mintdb_plugin.h" -#include "plugin.h" /** @@ -61,6 +59,11 @@ struct GNUNET_CRYPTO_EddsaPublicKey TMH_master_public_key; char *TMH_expected_wire_format = "sepa"; /** + * Our DB plugin. + */ +struct TALER_MINTDB_Plugin *TMH_plugin; + +/** * The HTTP Daemon. */ static struct MHD_Daemon *mydaemon; @@ -260,8 +263,8 @@ mint_serve_process_config (const char *mint_directory) } GNUNET_free (TMH_master_public_key_str); - if (GNUNET_OK != - TALER_MINT_plugin_load (cfg)) + if (NULL == + (TMH_plugin = TALER_MINT_plugin_load (cfg))) { fprintf (stderr, "failed to initialize DB subsystem\n"); @@ -355,5 +358,6 @@ main (int argc, char *const *argv) ret = TMH_KS_loop (); MHD_stop_daemon (mydaemon); + TALER_MINT_plugin_unload (TMH_plugin); return (GNUNET_OK == ret) ? 0 : 1; } diff --git a/src/mint/taler-mint-httpd.h b/src/mint/taler-mint-httpd.h index 92ce54b84..11f2f3658 100644 --- a/src/mint/taler-mint-httpd.h +++ b/src/mint/taler-mint-httpd.h @@ -59,6 +59,11 @@ extern struct GNUNET_CRYPTO_EddsaPublicKey TMH_master_public_key; */ extern struct GNUNET_CRYPTO_EddsaPrivateKey TMH_mint_private_signing_key; +/** + * Our DB plugin. + */ +extern struct TALER_MINTDB_Plugin *TMH_plugin; + /** * Struct describing an URL and the handler for it. diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c index 2fdd87188..13fde7240 100644 --- a/src/mint/taler-mint-httpd_db.c +++ b/src/mint/taler-mint-httpd_db.c @@ -26,7 +26,7 @@ #include "taler-mint-httpd_responses.h" #include "taler_util.h" #include "taler-mint-httpd_keystate.h" -#include "plugin.h" +#include "taler_mintdb_lib.h" /** @@ -109,14 +109,14 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, struct TALER_DenominationKeyIssueInformation *dki; int ret; - if (NULL == (session = plugin->get_session (plugin->cls, + if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, GNUNET_NO))) { GNUNET_break (0); return TMH_RESPONSE_reply_internal_db_error (connection); } if (GNUNET_YES == - plugin->have_deposit (plugin->cls, + TMH_plugin->have_deposit (TMH_plugin->cls, session, deposit)) { @@ -136,7 +136,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, TMH_KS_release (mks); if (GNUNET_OK != - plugin->start (plugin->cls, + TMH_plugin->start (TMH_plugin->cls, session)) { GNUNET_break (0); @@ -145,7 +145,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, /* fee for THIS transaction */ spent = deposit->amount_with_fee; /* add cost of all previous transactions */ - tl = plugin->get_coin_transactions (plugin->cls, + tl = TMH_plugin->get_coin_transactions (TMH_plugin->cls, session, &deposit->coin.coin_pub); if (GNUNET_OK != @@ -153,7 +153,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, &spent, &spent)) { - plugin->free_coin_transaction_list (plugin->cls, + TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, tl); return TMH_RESPONSE_reply_internal_db_error (connection); } @@ -162,30 +162,30 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, if (0 < TALER_amount_cmp (&spent, &value)) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); ret = TMH_RESPONSE_reply_deposit_insufficient_funds (connection, tl); - plugin->free_coin_transaction_list (plugin->cls, + TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, tl); return ret; } - plugin->free_coin_transaction_list (plugin->cls, + TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, tl); if (GNUNET_OK != - plugin->insert_deposit (plugin->cls, + TMH_plugin->insert_deposit (TMH_plugin->cls, session, deposit)) { TALER_LOG_WARNING ("Failed to store /deposit information in database\n"); - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); return TMH_RESPONSE_reply_internal_db_error (connection); } if (GNUNET_OK != - plugin->commit (plugin->cls, + TMH_plugin->commit (TMH_plugin->cls, session)) { TALER_LOG_WARNING ("/deposit transaction commit failed\n"); @@ -217,13 +217,13 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection, struct ReserveHistory *rh; int res; - if (NULL == (session = plugin->get_session (plugin->cls, + if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, GNUNET_NO))) { GNUNET_break (0); return TMH_RESPONSE_reply_internal_db_error (connection); } - rh = plugin->get_reserve_history (plugin->cls, + rh = TMH_plugin->get_reserve_history (TMH_plugin->cls, session, reserve_pub); if (NULL == rh) @@ -233,7 +233,7 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection, "error", "Reserve not found"); res = TMH_RESPONSE_reply_withdraw_status_success (connection, rh); - plugin->free_reserve_history (plugin->cls, + TMH_plugin->free_reserve_history (TMH_plugin->cls, rh); return res; } @@ -282,13 +282,13 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, blinded_msg_len, &h_blind); - if (NULL == (session = plugin->get_session (plugin->cls, + if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, GNUNET_NO))) { GNUNET_break (0); return TMH_RESPONSE_reply_internal_db_error (connection); } - res = plugin->get_collectable_blindcoin (plugin->cls, + res = TMH_plugin->get_collectable_blindcoin (TMH_plugin->cls, session, &h_blind, &collectable); @@ -323,7 +323,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, "Denomination not found"); } if (GNUNET_OK != - plugin->start (plugin->cls, + TMH_plugin->start (TMH_plugin->cls, session)) { GNUNET_break (0); @@ -331,12 +331,12 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, return TMH_RESPONSE_reply_internal_db_error (connection); } - rh = plugin->get_reserve_history (plugin->cls, + rh = TMH_plugin->get_reserve_history (TMH_plugin->cls, session, reserve); if (NULL == rh) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); TMH_KS_release (key_state); return TMH_RESPONSE_reply_json_pack (connection, @@ -357,7 +357,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, &value, &fee_withdraw)) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); TMH_KS_release (key_state); return TMH_RESPONSE_reply_internal_db_error (connection); @@ -378,7 +378,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, &deposit_total, &pos->details.bank->amount)) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); TMH_KS_release (key_state); return TMH_RESPONSE_reply_internal_db_error (connection); @@ -398,7 +398,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, &withdraw_total, &value)) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); TMH_KS_release (key_state); return TMH_RESPONSE_reply_internal_db_error (connection); @@ -416,15 +416,15 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, &balance)) { TMH_KS_release (key_state); - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); res = TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (connection, rh); - plugin->free_reserve_history (plugin->cls, + TMH_plugin->free_reserve_history (TMH_plugin->cls, rh); return res; } - plugin->free_reserve_history (plugin->cls, + TMH_plugin->free_reserve_history (TMH_plugin->cls, rh); /* Balance is good, sign the coin! */ @@ -435,7 +435,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, if (NULL == sig) { GNUNET_break (0); - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); return TMH_RESPONSE_reply_internal_error (connection, "Internal error"); @@ -448,7 +448,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, &collectable.h_coin_envelope); collectable.reserve_sig = *signature; if (GNUNET_OK != - plugin->insert_collectable_blindcoin (plugin->cls, + TMH_plugin->insert_collectable_blindcoin (TMH_plugin->cls, session, &h_blind, amount_required, @@ -456,12 +456,12 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, { GNUNET_break (0); GNUNET_CRYPTO_rsa_signature_free (sig); - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); return TMH_RESPONSE_reply_internal_db_error (connection); } if (GNUNET_OK != - plugin->commit (plugin->cls, + TMH_plugin->commit (TMH_plugin->cls, session)) { TALER_LOG_WARNING ("/withdraw/sign transaction commit failed\n"); @@ -523,7 +523,7 @@ refresh_accept_melts (struct MHD_Connection *connection, /* fee for THIS transaction; the melt amount includes the fee! */ spent = coin_details->melt_amount_with_fee; /* add historic transaction costs of this coin */ - tl = plugin->get_coin_transactions (plugin->cls, + tl = TMH_plugin->get_coin_transactions (TMH_plugin->cls, session, &coin_public_info->coin_pub); if (GNUNET_OK != @@ -532,7 +532,7 @@ refresh_accept_melts (struct MHD_Connection *connection, &spent)) { GNUNET_break (0); - plugin->free_coin_transaction_list (plugin->cls, + TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, tl); return TMH_RESPONSE_reply_internal_db_error (connection); } @@ -553,11 +553,11 @@ refresh_accept_melts (struct MHD_Connection *connection, coin_details->melt_amount_with_fee, coin_residual)) ? GNUNET_NO : GNUNET_SYSERR; - plugin->free_coin_transaction_list (plugin->cls, + TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, tl); return res; } - plugin->free_coin_transaction_list (plugin->cls, + TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, tl); melt.coin = *coin_public_info; @@ -565,7 +565,7 @@ refresh_accept_melts (struct MHD_Connection *connection, melt.session_hash = *session_hash; melt.amount_with_fee = coin_details->melt_amount_with_fee; if (GNUNET_OK != - plugin->insert_refresh_melt (plugin->cls, + TMH_plugin->insert_refresh_melt (TMH_plugin->cls, session, oldcoin_index, &melt)) @@ -617,26 +617,26 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, int res; unsigned int i; - if (NULL == (session = plugin->get_session (plugin->cls, + if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, GNUNET_NO))) { GNUNET_break (0); return TMH_RESPONSE_reply_internal_db_error (connection); } if (GNUNET_OK != - plugin->start (plugin->cls, + TMH_plugin->start (TMH_plugin->cls, session)) { GNUNET_break (0); return TMH_RESPONSE_reply_internal_db_error (connection); } - res = plugin->get_refresh_session (plugin->cls, + res = TMH_plugin->get_refresh_session (TMH_plugin->cls, session, session_hash, &refresh_session); if (GNUNET_YES == res) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); res = TMH_RESPONSE_reply_refresh_melt_success (connection, session_hash, @@ -645,7 +645,7 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, } if (GNUNET_SYSERR == res) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); return TMH_RESPONSE_reply_internal_db_error (connection); } @@ -664,7 +664,7 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, i))) { TMH_KS_release (key_state); - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; } @@ -673,13 +673,13 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, /* store requested new denominations */ if (GNUNET_OK != - plugin->insert_refresh_order (plugin->cls, + TMH_plugin->insert_refresh_order (TMH_plugin->cls, session, session_hash, num_new_denoms, denom_pubs)) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); return TMH_RESPONSE_reply_internal_db_error (connection); } @@ -687,14 +687,14 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, for (i = 0; i < TALER_CNC_KAPPA; i++) { if (GNUNET_OK != - plugin->insert_refresh_commit_coins (plugin->cls, + TMH_plugin->insert_refresh_commit_coins (TMH_plugin->cls, session, session_hash, i, num_new_denoms, commit_coin[i])) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); return TMH_RESPONSE_reply_internal_db_error (connection); } @@ -702,14 +702,14 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, for (i = 0; i < TALER_CNC_KAPPA; i++) { if (GNUNET_OK != - plugin->insert_refresh_commit_links (plugin->cls, + TMH_plugin->insert_refresh_commit_links (TMH_plugin->cls, session, session_hash, i, coin_count, commit_link[i])) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); return TMH_RESPONSE_reply_internal_db_error (connection); } @@ -723,12 +723,12 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, TALER_CNC_KAPPA); if (GNUNET_OK != - (res = plugin->create_refresh_session (plugin->cls, + (res = TMH_plugin->create_refresh_session (TMH_plugin->cls, session, session_hash, &refresh_session))) { - plugin->rollback (plugin->cls, + TMH_plugin->rollback (TMH_plugin->cls, session); return TMH_RESPONSE_reply_internal_db_error (connection); } @@ -736,7 +736,7 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, if (GNUNET_OK != - plugin->commit (plugin->cls, + TMH_plugin->commit (TMH_plugin->cls, session)) { TALER_LOG_WARNING ("/refresh/melt transaction commit failed\n"); @@ -789,7 +789,7 @@ check_commitment (struct MHD_Connection *connection, commit_links = GNUNET_malloc (num_oldcoins * sizeof (struct RefreshCommitLink)); if (GNUNET_OK != - plugin->get_refresh_commit_links (plugin->cls, + TMH_plugin->get_refresh_commit_links (TMH_plugin->cls, session, session_hash, off, @@ -888,7 +888,7 @@ check_commitment (struct MHD_Connection *connection, sizeof (struct RefreshCommitCoin)); if (GNUNET_OK != - plugin->get_refresh_commit_coins (plugin->cls, + TMH_plugin->get_refresh_commit_coins (TMH_plugin->cls, session, session_hash, off, @@ -1008,7 +1008,7 @@ refresh_mint_coin (struct MHD_Connection *connection, return ev_sig; } if (GNUNET_OK != - plugin->insert_refresh_collectable (plugin->cls, + TMH_plugin->insert_refresh_collectable (TMH_plugin->cls, session, session_hash, coin_off, @@ -1054,14 +1054,14 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, unsigned int j; unsigned int off; - if (NULL == (session = plugin->get_session (plugin->cls, + if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, GNUNET_NO))) { GNUNET_break (0); return TMH_RESPONSE_reply_internal_db_error (connection); } - res = plugin->get_refresh_session (plugin->cls, + res = TMH_plugin->get_refresh_session (TMH_plugin->cls, session, session_hash, &refresh_session); @@ -1081,7 +1081,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, for (j=0;j<refresh_session.num_oldcoins;j++) { if (GNUNET_OK != - plugin->get_refresh_melt (plugin->cls, + TMH_plugin->get_refresh_melt (TMH_plugin->cls, session, session_hash, j, @@ -1095,7 +1095,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, denom_pubs = GNUNET_malloc (refresh_session.num_newcoins * sizeof (struct TALER_DenominationPublicKey)); if (GNUNET_OK != - plugin->get_refresh_order (plugin->cls, + TMH_plugin->get_refresh_order (TMH_plugin->cls, session, session_hash, refresh_session.num_newcoins, @@ -1136,7 +1136,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, /* Client request OK, start transaction */ if (GNUNET_OK != - plugin->start (plugin->cls, + TMH_plugin->start (TMH_plugin->cls, session)) { GNUNET_break (0); @@ -1149,7 +1149,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, commit_coins = GNUNET_malloc (refresh_session.num_newcoins * sizeof (struct RefreshCommitCoin)); if (GNUNET_OK != - plugin->get_refresh_commit_coins (plugin->cls, + TMH_plugin->get_refresh_commit_coins (TMH_plugin->cls, session, session_hash, refresh_session.noreveal_index, @@ -1195,7 +1195,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, GNUNET_free (commit_coins); if (GNUNET_OK != - plugin->commit (plugin->cls, + TMH_plugin->commit (TMH_plugin->cls, session)) { TALER_LOG_WARNING ("/refresh/reveal transaction commit failed\n"); @@ -1234,13 +1234,13 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection, struct TALER_EncryptedLinkSecretP shared_secret_enc; struct LinkDataList *ldl; - if (NULL == (session = plugin->get_session (plugin->cls, + if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, GNUNET_NO))) { GNUNET_break (0); return TMH_RESPONSE_reply_internal_db_error (connection); } - res = plugin->get_transfer (plugin->cls, + res = TMH_plugin->get_transfer (TMH_plugin->cls, session, coin_pub, &transfer_pub, @@ -1260,7 +1260,7 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection, } GNUNET_assert (GNUNET_OK == res); - ldl = plugin->get_link_data_list (plugin->cls, + ldl = TMH_plugin->get_link_data_list (TMH_plugin->cls, session, coin_pub); if (NULL == ldl) @@ -1275,7 +1275,7 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection, &transfer_pub, &shared_secret_enc, ldl); - plugin->free_link_data_list (plugin->cls, + TMH_plugin->free_link_data_list (TMH_plugin->cls, ldl); return res; } diff --git a/src/mint/taler-mint-httpd_db.h b/src/mint/taler-mint-httpd_db.h index 44d11ffc9..3e8a7df7f 100644 --- a/src/mint/taler-mint-httpd_db.h +++ b/src/mint/taler-mint-httpd_db.h @@ -21,7 +21,6 @@ #ifndef TALER_MINT_HTTPD_DB_H #define TALER_MINT_HTTPD_DB_H -#include <libpq-fe.h> #include <microhttpd.h> #include <gnunet/gnunet_util_lib.h> #include "taler_util.h" diff --git a/src/mint/taler-mint-httpd_deposit.c b/src/mint/taler-mint-httpd_deposit.c index a1d64be45..ee2d24845 100644 --- a/src/mint/taler-mint-httpd_deposit.c +++ b/src/mint/taler-mint-httpd_deposit.c @@ -30,7 +30,6 @@ #include <gnunet/gnunet_util_lib.h> #include <jansson.h> #include <microhttpd.h> -#include <libpq-fe.h> #include <pthread.h> #include "taler_mintdb_plugin.h" #include "taler_signatures.h" diff --git a/src/mint/taler-mint-httpd_keystate.h b/src/mint/taler-mint-httpd_keystate.h index 4946ec1a3..26c9ccad6 100644 --- a/src/mint/taler-mint-httpd_keystate.h +++ b/src/mint/taler-mint-httpd_keystate.h @@ -26,7 +26,7 @@ #include <gnunet/gnunet_util_lib.h> #include <microhttpd.h> #include "taler-mint-httpd.h" -#include "key_io.h" +#include "taler_mintdb_lib.h" /** diff --git a/src/mint/taler-mint-httpd_mhd.c b/src/mint/taler-mint-httpd_mhd.c index 934a2f9d2..a12158731 100644 --- a/src/mint/taler-mint-httpd_mhd.c +++ b/src/mint/taler-mint-httpd_mhd.c @@ -27,7 +27,6 @@ #include <gnunet/gnunet_util_lib.h> #include <jansson.h> #include <microhttpd.h> -#include <libpq-fe.h> #include <pthread.h> #include "taler-mint-httpd_responses.h" #include "taler-mint-httpd.h" diff --git a/src/mintdb/Makefile.am b/src/mintdb/Makefile.am new file mode 100644 index 000000000..ceaa2e210 --- /dev/null +++ b/src/mintdb/Makefile.am @@ -0,0 +1,68 @@ +# This Makefile.am is in the public domain +AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/pq/ $(POSTGRESQL_CPPFLAGS) + +plugindir = $(libdir)/taler + +plugin_LTLIBRARIES = \ + libtaler_plugin_mintdb_postgres.la + +EXTRA_DIST = plugin_mintdb_common.c + +libtaler_plugin_mintdb_postgres_la_SOURCES = \ + plugin_mintdb_postgres.c +libtaler_plugin_mintdb_postgres_la_LIBADD = \ + $(LTLIBINTL) +libtaler_plugin_mintdb_postgres_la_LDFLAGS = \ + $(TALER_PLUGIN_LDFLAGS) \ + -lpq \ + -lgnunetutil + +lib_LTLIBRARIES = \ + libtalermintdb.la + +libtalermintdb_la_SOURCES = \ + mintdb_keyio.c \ + mintdb_plugin.c + +libtalermintdb_la_LIBADD = \ + $(top_builddir)/src/util/libtalerutil.la \ + -lgnunetutil + +libtalermintdb_la_LDFLAGS = \ + $(POSTGRESQL_LDFLAGS) \ + -version-info 0:0:0 \ + -no-undefined + + +check_PROGRAMS = \ + test-mintdb-deposits \ + test-mintdb-keyio \ + test-mintdb-postgres + +test_mintdb_deposits_SOURCES = \ + test_mintdb_deposits.c +test_mintdb_deposits_LDADD = \ + libtalermintdb.la \ + $(top_srcdir)/src/util/libtalerutil.la \ + $(top_srcdir)/src/pq/libtalerpq.la \ + -lgnunetutil \ + -ljansson \ + -lpq + +test_mintdb_keyio_SOURCES = \ + test_mintdb_keyio.c +test_mintdb_keyio_LDADD = \ + libtalermintdb.la \ + $(top_srcdir)/src/util/libtalerutil.la \ + $(top_srcdir)/src/pq/libtalerpq.la \ + -lgnunetutil + +test_mintdb_postgres_SOURCES = \ + test_mintdb.c +test_mintdb_postgres_LDADD = \ + libtalermintdb.la \ + $(top_srcdir)/src/util/libtalerutil.la \ + $(top_srcdir)/src/pq/libtalerpq.la \ + -lgnunetutil -ljansson +EXTRA_test_mintdb_postgres_DEPENDENCIES = \ + libtaler_plugin_mintdb_postgres.la diff --git a/src/mint/key_io.c b/src/mintdb/mintdb_keyio.c index 02d888d5d..321b890c3 100644 --- a/src/mint/key_io.c +++ b/src/mintdb/mintdb_keyio.c @@ -14,7 +14,7 @@ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ /** - * @file mint/key_io.c + * @file mintdb/mintdb_keyio.c * @brief I/O operations for the Mint's private keys * @author Florian Dold * @author Benedikt Mueller @@ -22,7 +22,7 @@ * @author Christian Grothoff */ #include "platform.h" -#include "key_io.h" +#include "taler_mintdb_lib.h" /** diff --git a/src/mint/plugin.c b/src/mintdb/mintdb_plugin.c index 147d4c4c7..b109ff3d1 100644 --- a/src/mint/plugin.c +++ b/src/mintdb/mintdb_plugin.c @@ -14,21 +14,17 @@ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ /** - * @file mint/plugin.c + * @file mintdb/mintdb_plugin.c * @brief Logic to load database plugin * @author Christian Grothoff */ #include "platform.h" -#include "plugin.h" +#include "taler_mintdb_lib.h" +#include "taler_mintdb_plugin.h" #include <ltdl.h> /** - * Global variable with the plugin (once loaded). - */ -struct TALER_MINTDB_Plugin *plugin; - -/** * Libtool search path before we started. */ static char *old_dlsearchpath; @@ -40,15 +36,14 @@ static char *old_dlsearchpath; * @param cfg configuration to use * @return #GNUNET_OK on success */ -int +struct TALER_MINTDB_Plugin * TALER_MINT_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg) { char *plugin_name; char *lib_name; struct GNUNET_CONFIGURATION_Handle *cfg_dup; + struct TALER_MINTDB_Plugin *plugin; - if (NULL != plugin) - return GNUNET_OK; if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, "mint", @@ -58,7 +53,7 @@ TALER_MINT_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg) GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "mint", "db"); - return GNUNET_SYSERR; + return NULL; } (void) GNUNET_asprintf (&lib_name, "libtaler_plugin_mintdb_%s", @@ -66,24 +61,31 @@ TALER_MINT_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg) GNUNET_free (plugin_name); cfg_dup = GNUNET_CONFIGURATION_dup (cfg); plugin = GNUNET_PLUGIN_load (lib_name, cfg_dup); + if (NULL != plugin) + plugin->library_name = lib_name; + else + GNUNET_free (lib_name); GNUNET_CONFIGURATION_destroy (cfg_dup); - GNUNET_free (lib_name); - if (NULL == plugin) - return GNUNET_SYSERR; - return GNUNET_OK; + return plugin; } /** * Shutdown the plugin. + * + * @param plugin the plugin to unload */ void -TALER_MINT_plugin_unload () +TALER_MINT_plugin_unload (struct TALER_MINTDB_Plugin *plugin) { + char *lib_name; + if (NULL == plugin) return; - GNUNET_assert (NULL == GNUNET_PLUGIN_unload (plugin->library_name, + lib_name = plugin->library_name; + GNUNET_assert (NULL == GNUNET_PLUGIN_unload (lib_name, plugin)); + GNUNET_free (lib_name); } diff --git a/src/mint/plugin_mintdb_common.c b/src/mintdb/plugin_mintdb_common.c index a95cf4be2..a95cf4be2 100644 --- a/src/mint/plugin_mintdb_common.c +++ b/src/mintdb/plugin_mintdb_common.c diff --git a/src/mint/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c index 9846d1720..fa2c19db0 100644 --- a/src/mint/plugin_mintdb_postgres.c +++ b/src/mintdb/plugin_mintdb_postgres.c @@ -2299,7 +2299,6 @@ libtaler_plugin_mintdb_postgres_init (void *cls) } plugin = GNUNET_new (struct TALER_MINTDB_Plugin); plugin->cls = pg; - plugin->library_name = "libtaler_plugin_mintdb_postgres"; plugin->get_session = &postgres_get_session; plugin->drop_temporary = &postgres_drop_temporary; plugin->create_tables = &postgres_create_tables; diff --git a/src/mint/test_mint_db.c b/src/mintdb/test_mintdb.c index a82094075..a82094075 100644 --- a/src/mint/test_mint_db.c +++ b/src/mintdb/test_mintdb.c diff --git a/src/mint/test_mint_deposits.c b/src/mintdb/test_mintdb_deposits.c index dbe12e88d..dbe12e88d 100644 --- a/src/mint/test_mint_deposits.c +++ b/src/mintdb/test_mintdb_deposits.c diff --git a/src/mint/test_mint_common.c b/src/mintdb/test_mintdb_keyio.c index 83df25046..83df25046 100644 --- a/src/mint/test_mint_common.c +++ b/src/mintdb/test_mintdb_keyio.c |