From ffcadbff8c678c495af05428de21761cf3956f3b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 7 Mar 2020 00:28:07 +0100 Subject: code cleanup (comments, scoping, naming, indentation) --- src/exchangedb/exchangedb_accounts.c | 10 +- src/exchangedb/exchangedb_auditorkeys.c | 137 +++++---- src/exchangedb/exchangedb_denomkeys.c | 254 ++++++++++------- src/exchangedb/exchangedb_plugin.c | 6 +- src/exchangedb/exchangedb_signkeys.c | 52 ++-- src/exchangedb/exchangedb_transactions.c | 10 +- src/exchangedb/plugin_exchangedb_postgres.c | 427 +++++++++++++--------------- 7 files changed, 476 insertions(+), 420 deletions(-) (limited to 'src/exchangedb') diff --git a/src/exchangedb/exchangedb_accounts.c b/src/exchangedb/exchangedb_accounts.c index 0081c3283..2943adb24 100644 --- a/src/exchangedb/exchangedb_accounts.c +++ b/src/exchangedb/exchangedb_accounts.c @@ -45,12 +45,12 @@ struct FindAccountContext /** - * Check if @a section begins with "exchange-wire-", and if - * so if the "ENABLE" option is set to "YES". If both are - * true, call the callback from the context with the - * rest of the section name. + * Check if @a section begins with "exchange-account-", and if so if the + * "PAYTO_URI" is given. If not, a warning is printed, otherwise we also check + * if "ENABLE_CREDIT" or "ENABLE_DEBIT" options are set to "YES" and then call + * the callback in @a cls with all of the information gathered. * - * @param cls our `struct FindEnabledWireContext` + * @param cls our `struct FindAccountContext` * @param section name of a section in the configuration */ static void diff --git a/src/exchangedb/exchangedb_auditorkeys.c b/src/exchangedb/exchangedb_auditorkeys.c index fabd5278f..4adf89811 100644 --- a/src/exchangedb/exchangedb_auditorkeys.c +++ b/src/exchangedb/exchangedb_auditorkeys.c @@ -97,24 +97,34 @@ auditor_iter (void *cls, const struct TALER_AuditorSignatureP *sigs; const struct TALER_DenominationKeyValidityPS *dki; const char *auditor_url; - unsigned int dki_len; + uint32_t dki_len; size_t url_len; int iret; - if (GNUNET_OK != GNUNET_DISK_file_size (filename, - &size, - GNUNET_YES, - GNUNET_YES)) + if (GNUNET_OK != + GNUNET_DISK_file_size (filename, + &size, + GNUNET_YES, + GNUNET_YES)) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Skipping inaccessable auditor information file `%s'\n", filename); return GNUNET_OK; } if (size < sizeof (struct AuditorFileHeaderP)) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Unrecognized size for file `%s', skipping\n", + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "File size (%llu bytes) too small for file `%s' to contain auditor data. Skipping it.\n", + (unsigned long long) size, + filename); + return GNUNET_OK; + } + if (size >= GNUNET_MAX_MALLOC_CHECKED) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "File size (%llu bytes) too large for file `%s' to contain auditor data. Skipping it.\n", + (unsigned long long) size, filename); return GNUNET_OK; } @@ -140,35 +150,33 @@ auditor_iter (void *cls, GNUNET_free (af); return GNUNET_OK; } - if ( (size - sizeof (struct AuditorFileHeaderP)) / dki_len < + size -= sizeof (struct AuditorFileHeaderP); + if ( (size / dki_len) <= (sizeof (struct TALER_DenominationKeyValidityPS) + sizeof (struct TALER_AuditorSignatureP)) ) { GNUNET_break_op (0); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Malformed key file %s\n", - filename); + "Malformed auditor data file %s (file too short for %u keys)\n", + filename, + (unsigned int) dki_len); GNUNET_free (af); return GNUNET_OK; } - url_len = size - - sizeof (struct AuditorFileHeaderP) - - dki_len * (sizeof (struct TALER_DenominationKeyValidityPS) - + sizeof (struct TALER_AuditorSignatureP)); + url_len = size - dki_len * (sizeof (struct TALER_DenominationKeyValidityPS) + + sizeof (struct TALER_AuditorSignatureP)); sigs = (const struct TALER_AuditorSignatureP *) &af[1]; dki = (const struct TALER_DenominationKeyValidityPS *) &sigs[dki_len]; auditor_url = (const char *) &dki[dki_len]; - if ( (0 == url_len) || - ('\0' != auditor_url[url_len - 1]) ) + if ('\0' != auditor_url[url_len - 1]) { GNUNET_break_op (0); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Malformed key file %s\n", + "Malformed auditor data file %s (no 0-terminator)\n", filename); GNUNET_free (af); return GNUNET_OK; } - /* Ignoring return value to not interrupt the iteration */ if (GNUNET_OK != (iret = aic->it (aic->it_cls, &af->apub, @@ -242,64 +250,93 @@ TALER_EXCHANGEDB_auditor_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure. */ int -TALER_EXCHANGEDB_auditor_write (const char *filename, - const struct TALER_AuditorPublicKeyP *apub, - const char *auditor_url, - const struct TALER_AuditorSignatureP *asigs, - const struct TALER_MasterPublicKeyP *mpub, - unsigned int dki_len, - const struct - TALER_DenominationKeyValidityPS *dki) +TALER_EXCHANGEDB_auditor_write ( + const char *filename, + const struct TALER_AuditorPublicKeyP *apub, + const char *auditor_url, + const struct TALER_AuditorSignatureP *asigs, + const struct TALER_MasterPublicKeyP *mpub, + uint32_t dki_len, + const struct TALER_DenominationKeyValidityPS *dki) { - struct AuditorFileHeaderP af; struct GNUNET_DISK_FileHandle *fh; ssize_t wrote; size_t wsize; - int ret; int eno; - af.apub = *apub; - af.mpub = *mpub; - af.dki_len = htonl ((uint32_t) dki_len); - ret = GNUNET_SYSERR; + if (GNUNET_OK != + GNUNET_DISK_directory_create_for_file (filename)) + { + eno = errno; + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "mkdir (for file)", + filename); + errno = eno; + return GNUNET_SYSERR; + } if (NULL == (fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_TRUNCATE, GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE))) - goto cleanup; - wsize = sizeof (struct AuditorFileHeaderP); - if (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh, - &af, - wsize))) - goto cleanup; - if (wrote != (ssize_t) wsize) - goto cleanup; + { + eno = errno; + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "open", + filename); + errno = eno; + return GNUNET_SYSERR; + } + { + struct AuditorFileHeaderP af = { + .apub = *apub, + .mpub = *mpub, + .dki_len = htonl (dki_len) + }; + + wsize = sizeof (struct AuditorFileHeaderP); + if ( (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh, + &af, + wsize))) || + (wrote != (ssize_t) wsize) ) + goto cleanup; + } wsize = dki_len * sizeof (struct TALER_AuditorSignatureP); - if (((ssize_t) wsize) == + if (((ssize_t) wsize) != GNUNET_DISK_file_write (fh, asigs, wsize)) - ret = GNUNET_OK; + goto cleanup; wsize = dki_len * sizeof (struct TALER_DenominationKeyValidityPS); - if (((ssize_t) wsize) == + if (((ssize_t) wsize) != GNUNET_DISK_file_write (fh, dki, wsize)) - ret = GNUNET_OK; + goto cleanup; wsize = strlen (auditor_url) + 1; - if (((ssize_t) wsize) == + if (((ssize_t) wsize) != GNUNET_DISK_file_write (fh, auditor_url, wsize)) - ret = GNUNET_OK; + goto cleanup; + GNUNET_assert (GNUNET_OK == + GNUNET_DISK_file_close (fh)); + return GNUNET_OK; cleanup: eno = errno; - if (NULL != fh) - (void) GNUNET_DISK_file_close (fh); + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "write", + filename); + GNUNET_break (GNUNET_OK == + GNUNET_DISK_file_close (fh)); + /* try to remove the file, as it must be malformed */ + if (0 != unlink (filename)) + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "unlink", + filename); errno = eno; - return ret; + return GNUNET_SYSERR; } diff --git a/src/exchangedb/exchangedb_denomkeys.c b/src/exchangedb/exchangedb_denomkeys.c index 01b04198f..03daab300 100644 --- a/src/exchangedb/exchangedb_denomkeys.c +++ b/src/exchangedb/exchangedb_denomkeys.c @@ -58,39 +58,42 @@ GNUNET_NETWORK_STRUCT_END * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure. */ int -TALER_EXCHANGEDB_denomination_key_revoke (const char *revocation_dir, - const struct - GNUNET_HashCode *denom_hash, - const struct - TALER_MasterPrivateKeyP *mpriv) +TALER_EXCHANGEDB_denomination_key_revoke ( + const char *revocation_dir, + const struct GNUNET_HashCode *denom_hash, + const struct TALER_MasterPrivateKeyP *mpriv) { - struct TALER_MasterDenominationKeyRevocationPS rm; char *fn; int ret; struct RevocationFileP rd; + { + struct TALER_MasterDenominationKeyRevocationPS rm = { + .purpose.purpose = htonl ( + TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED), + .purpose.size = htonl (sizeof (rm)), + .h_denom_pub = *denom_hash + }; + + GNUNET_assert (GNUNET_OK == + GNUNET_CRYPTO_eddsa_sign (&mpriv->eddsa_priv, + &rm.purpose, + &rd.msig.eddsa_signature)); + } GNUNET_asprintf (&fn, "%s" DIR_SEPARATOR_STR "%s.rev", revocation_dir, GNUNET_h2s_full (denom_hash)); - rm.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED); - rm.purpose.size = htonl (sizeof (rm)); - rm.h_denom_pub = *denom_hash; - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&mpriv->eddsa_priv, - &rm.purpose, - &rd.msig.eddsa_signature)); rd.denom_hash = *denom_hash; - if (sizeof (rd) != - GNUNET_DISK_fn_write (fn, - &rd, - sizeof (rd), - GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE)) - ret = GNUNET_SYSERR; - else - ret = GNUNET_OK; + ret = (sizeof (rd) != + GNUNET_DISK_fn_write (fn, + &rd, + sizeof (rd), + GNUNET_DISK_PERM_USER_READ + | GNUNET_DISK_PERM_USER_WRITE)) + ? GNUNET_SYSERR + : GNUNET_OK; GNUNET_free (fn); return ret; } @@ -105,10 +108,9 @@ TALER_EXCHANGEDB_denomination_key_revoke (const char *revocation_dir, * #GNUNET_SYSERR upon failure */ int -TALER_EXCHANGEDB_denomination_key_read (const char *filename, - struct - TALER_EXCHANGEDB_DenominationKey - *dki) +TALER_EXCHANGEDB_denomination_key_read ( + const char *filename, + struct TALER_EXCHANGEDB_DenominationKey *dki) { uint64_t size; size_t offset; @@ -129,9 +131,20 @@ TALER_EXCHANGEDB_denomination_key_read (const char *filename, offset = sizeof (struct TALER_EXCHANGEDB_DenominationKeyInformationP); if (size <= offset) { - GNUNET_break (0); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "File size (%llu bytes) too small for file `%s' to contain denomination key data. Skipping it.\n", + (unsigned long long) size, + filename); return GNUNET_SYSERR; } + if (size >= GNUNET_MAX_MALLOC_CHECKED) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "File size (%llu bytes) too large for file `%s' to contain denomination key data. Skipping it.\n", + (unsigned long long) size, + filename); + return GNUNET_OK; + } data = GNUNET_malloc (size); if (((ssize_t) size) != GNUNET_DISK_fn_read (filename, @@ -160,16 +173,19 @@ TALER_EXCHANGEDB_denomination_key_read (const char *filename, offset); GNUNET_free (data); if (0 == GNUNET_TIME_absolute_get_remaining - (GNUNET_TIME_absolute_ntoh ( - dki->issue.properties.expire_withdraw)).rel_value_us) + (GNUNET_TIME_absolute_ntoh + (dki->issue.properties.expire_withdraw)).rel_value_us) { + /* key expired for withdrawal, remove private key to + minimize chance of compromise */ if (0 != unlink (filename)) { GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "unlink", filename); - return GNUNET_OK; /* yes, we had an error, but the file content - was fine and is being returned */ + /* yes, we had an error, but the file content + was fine and is being returned */ + return GNUNET_OK; } } return GNUNET_OK; @@ -184,26 +200,25 @@ TALER_EXCHANGEDB_denomination_key_read (const char *filename, * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure. */ int -TALER_EXCHANGEDB_denomination_key_write (const char *filename, - const struct - TALER_EXCHANGEDB_DenominationKey - *dki) +TALER_EXCHANGEDB_denomination_key_write ( + const char *filename, + const struct TALER_EXCHANGEDB_DenominationKey *dki) { - char *priv_enc; - size_t priv_enc_size; struct GNUNET_DISK_FileHandle *fh; ssize_t wrote; size_t wsize; - int ret; + int eno; - fh = NULL; - priv_enc_size - = GNUNET_CRYPTO_rsa_private_key_encode (dki->denom_priv.rsa_private_key, - &priv_enc); - ret = GNUNET_SYSERR; if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (filename)) + { + eno = errno; + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "mkdir (for file)", + filename); + errno = eno; return GNUNET_SYSERR; + } if (NULL == (fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE @@ -211,27 +226,53 @@ TALER_EXCHANGEDB_denomination_key_write (const char *filename, | GNUNET_DISK_OPEN_FAILIFEXISTS, GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE))) - goto cleanup; + { + eno = errno; + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "open", + filename); + errno = eno; + return GNUNET_SYSERR; + } wsize = sizeof (struct TALER_EXCHANGEDB_DenominationKeyInformationP); - if (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh, - &dki->issue, - wsize))) - goto cleanup; - if (wrote != (ssize_t) wsize) - goto cleanup; - if (GNUNET_SYSERR == - (wrote = GNUNET_DISK_file_write (fh, - priv_enc, - priv_enc_size))) + if ( (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh, + &dki->issue, + wsize))) || + (wrote != (ssize_t) wsize) ) goto cleanup; - if (wrote != (ssize_t) priv_enc_size) - goto cleanup; - ret = GNUNET_OK; + { + char *priv_enc; + size_t priv_enc_size; + + priv_enc_size + = GNUNET_CRYPTO_rsa_private_key_encode (dki->denom_priv.rsa_private_key, + &priv_enc); + wrote = GNUNET_DISK_file_write (fh, + priv_enc, + priv_enc_size); + GNUNET_free (priv_enc); + if ( (GNUNET_SYSERR == wrote) || + (wrote != (ssize_t) priv_enc_size) ) + goto cleanup; + } + GNUNET_assert (GNUNET_OK == + GNUNET_DISK_file_close (fh)); + return GNUNET_OK; + cleanup: - GNUNET_free_non_null (priv_enc); - if (NULL != fh) - (void) GNUNET_DISK_file_close (fh); - return ret; + eno = errno; + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "write", + filename); + GNUNET_break (GNUNET_OK == + GNUNET_DISK_file_close (fh)); + /* try to remove the file, as it must be malformed */ + if (0 != unlink (filename)) + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "unlink", + filename); + errno = eno; + return GNUNET_SYSERR; } @@ -337,21 +378,22 @@ denomkeys_iterate_topdir_iter (void *cls, * as maybe none of the files were well-formed) */ int -TALER_EXCHANGEDB_denomination_keys_iterate (const char *exchange_base_dir, - TALER_EXCHANGEDB_DenominationKeyIterator - it, - void *it_cls) +TALER_EXCHANGEDB_denomination_keys_iterate ( + const char *exchange_base_dir, + TALER_EXCHANGEDB_DenominationKeyIterator it, + void *it_cls) { + struct DenomkeysIterateContext dic = { + .it = it, + .it_cls = it_cls + }; char *dir; - struct DenomkeysIterateContext dic; int ret; GNUNET_asprintf (&dir, "%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_DENOMINATION_KEYS, exchange_base_dir); - dic.it = it; - dic.it_cls = it_cls; ret = GNUNET_DISK_directory_scan (dir, &denomkeys_iterate_topdir_iter, &dic); @@ -401,42 +443,57 @@ revocations_iterate_cb (void *cls, { struct RevocationsIterateContext *ric = cls; struct RevocationFileP rf; - struct TALER_MasterDenominationKeyRevocationPS rm; + ssize_t rd; /* Check if revocation is valid... */ - if (sizeof (rf) != - GNUNET_DISK_fn_read (filename, - &rf, - sizeof (rf))) + rd = GNUNET_DISK_fn_read (filename, + &rf, + sizeof (rf)); + if (GNUNET_SYSERR == rd) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _ ( - "Invalid revocation file `%s' found and ignored (bad size)\n"), - filename); + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, + "read", + filename); return GNUNET_OK; } - rm.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED); - rm.purpose.size = htonl (sizeof (rm)); - rm.h_denom_pub = rf.denom_hash; - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify ( - TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED, - &rm.purpose, - &rf.msig.eddsa_signature, - &ric->master_pub->eddsa_pub)) + if (sizeof (rf) != (size_t) rd) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _ ( - "Invalid revocation file `%s' found and ignored (bad signature)\n"), - filename); + "Invalid revocation file `%s' found and ignored (bad size: %llu)\n", + filename, + (unsigned long long) rd); return GNUNET_OK; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Denomination key `%s' was revoked!\n", - GNUNET_h2s (&rm.h_denom_pub)); - return ric->it (ric->it_cls, - &rm.h_denom_pub, - &rf.msig); + + { + struct TALER_MasterDenominationKeyRevocationPS rm = { + .purpose.purpose = htonl ( + TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED), + .purpose.size = htonl (sizeof (rm)), + .h_denom_pub = rf.denom_hash + }; + + if (GNUNET_OK != + GNUNET_CRYPTO_eddsa_verify ( + TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED, + &rm.purpose, + &rf.msig.eddsa_signature, + &ric->master_pub->eddsa_pub)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _ ( + "Invalid revocation file `%s' found and ignored (bad signature)\n"), + filename); + return GNUNET_OK; + } + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Denomination key `%s' was revoked!\n", + GNUNET_h2s (&rm.h_denom_pub)); + return ric->it (ric->it_cls, + &rm.h_denom_pub, + &rf.msig); + } } @@ -467,8 +524,11 @@ TALER_EXCHANGEDB_revocations_iterate (const char *revocation_dir, if (GNUNET_OK != GNUNET_DISK_directory_create (revocation_dir)) - return 0; /* directory doesn't exist and we couldn't even create it, - clearly means there are no revocations there */ + { + /* directory doesn't exist and we couldn't even create it, + clearly means there are no revocations there */ + return 0; + } return GNUNET_DISK_directory_scan (revocation_dir, &revocations_iterate_cb, &ric); diff --git a/src/exchangedb/exchangedb_plugin.c b/src/exchangedb/exchangedb_plugin.c index f4c2eea99..21bb032f3 100644 --- a/src/exchangedb/exchangedb_plugin.c +++ b/src/exchangedb/exchangedb_plugin.c @@ -48,9 +48,9 @@ TALER_EXCHANGEDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg) "db"); return NULL; } - (void) GNUNET_asprintf (&lib_name, - "libtaler_plugin_exchangedb_%s", - plugin_name); + GNUNET_asprintf (&lib_name, + "libtaler_plugin_exchangedb_%s", + plugin_name); GNUNET_free (plugin_name); plugin = GNUNET_PLUGIN_load (lib_name, (void *) cfg); diff --git a/src/exchangedb/exchangedb_signkeys.c b/src/exchangedb/exchangedb_signkeys.c index 71ebb5526..beafa1dda 100644 --- a/src/exchangedb/exchangedb_signkeys.c +++ b/src/exchangedb/exchangedb_signkeys.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014, 2015, 2016 Taler Systems SA + Copyright (C) 2014, 2015, 2016, 2020 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 @@ -112,15 +112,16 @@ TALER_EXCHANGEDB_signing_keys_iterate (const char *exchange_base_dir, TALER_EXCHANGEDB_SigningKeyIterator it, void *it_cls) { + struct SignkeysIterateContext skc = { + .it = it, + .it_cls = it_cls + }; char *signkey_dir; - struct SignkeysIterateContext skc; int ret; GNUNET_asprintf (&signkey_dir, "%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_SIGNING_KEYS, exchange_base_dir); - skc.it = it; - skc.it_cls = it_cls; ret = GNUNET_DISK_directory_scan (signkey_dir, &signkeys_iterate_dir_iter, &skc); @@ -129,30 +130,6 @@ TALER_EXCHANGEDB_signing_keys_iterate (const char *exchange_base_dir, } -/** - * Obtain the name of the directory we use to store signing - * keys created at time @a start. - * - * @param exchange_directory base director where we store key material - * @param start time at which we create the signing key - * @return name of the directory we should use, basically "$EXCHANGEDIR/$TIME/"; - * (valid until next call to this function) - */ -static char * -get_signkey_file (const char *exchange_directory, - struct GNUNET_TIME_Absolute start) -{ - char *fn; - - GNUNET_asprintf (&fn, - "%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_SIGNING_KEYS - DIR_SEPARATOR_STR "%llu", - exchange_directory, - (unsigned long long) start.abs_value_us); - return fn; -} - - /** * Exports a signing key to the given file. * @@ -171,18 +148,31 @@ TALER_EXCHANGEDB_signing_key_write (const char *exchange_base_dir, char *skf; ssize_t nwrite; - skf = get_signkey_file (exchange_base_dir, - start); + GNUNET_asprintf (&skf, + "%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_SIGNING_KEYS + DIR_SEPARATOR_STR "%llu", + exchange_base_dir, + (unsigned long long) start.abs_value_us); if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (skf)) + { + int eno; + + eno = errno; + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "mkdir (for file)", + skf); + errno = eno; return GNUNET_SYSERR; + } nwrite = GNUNET_DISK_fn_write (skf, ski, sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP), GNUNET_DISK_PERM_USER_WRITE | GNUNET_DISK_PERM_USER_READ); - if (sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP) != nwrite) + if (sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP) != + (size_t) nwrite) { GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", diff --git a/src/exchangedb/exchangedb_transactions.c b/src/exchangedb/exchangedb_transactions.c index 79acdb4a0..8c14de6c1 100644 --- a/src/exchangedb/exchangedb_transactions.c +++ b/src/exchangedb/exchangedb_transactions.c @@ -33,12 +33,10 @@ * @return #GNUNET_OK on success, #GNUNET_SYSERR on errors */ int -TALER_EXCHANGEDB_calculate_transaction_list_totals (struct - TALER_EXCHANGEDB_TransactionList - *tl, - const struct - TALER_Amount *off, - struct TALER_Amount *ret) +TALER_EXCHANGEDB_calculate_transaction_list_totals ( + struct TALER_EXCHANGEDB_TransactionList *tl, + const struct TALER_Amount *off, + struct TALER_Amount *ret) { struct TALER_Amount spent = *off; struct TALER_Amount refunded; diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 848fe932c..dfa05fb8c 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -1570,13 +1570,11 @@ postgres_preflight (void *cls, * @return status of the query */ static enum GNUNET_DB_QueryStatus -postgres_insert_denomination_info (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - TALER_DenominationPublicKey *denom_pub, - const struct - TALER_EXCHANGEDB_DenominationKeyInformationP - *issue) +postgres_insert_denomination_info ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_DenominationPublicKey *denom_pub, + const struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (&issue->properties.denom_hash), @@ -1626,12 +1624,11 @@ postgres_insert_denomination_info (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_get_denomination_info (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct GNUNET_HashCode *denom_pub_hash, - struct - TALER_EXCHANGEDB_DenominationKeyInformationP * - issue) +postgres_get_denomination_info ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct GNUNET_HashCode *denom_pub_hash, + struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue) { struct PostgresClosure *pg = cls; enum GNUNET_DB_QueryStatus qs; @@ -2015,11 +2012,11 @@ postgres_reserves_in_insert (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_get_latest_reserve_in_reference (void *cls, - struct TALER_EXCHANGEDB_Session * - session, - const char *exchange_account_name, - uint64_t *wire_reference) +postgres_get_latest_reserve_in_reference ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const char *exchange_account_name, + uint64_t *wire_reference) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (exchange_account_name), @@ -2052,11 +2049,11 @@ postgres_get_latest_reserve_in_reference (void *cls, * @return statement execution status */ static enum GNUNET_DB_QueryStatus -postgres_get_withdraw_info (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct GNUNET_HashCode *h_blind, - struct TALER_EXCHANGEDB_CollectableBlindcoin * - collectable) +postgres_get_withdraw_info ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct GNUNET_HashCode *h_blind, + struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam no_params[] = { @@ -2106,11 +2103,10 @@ postgres_get_withdraw_info (void *cls, * @return query execution status */ static enum GNUNET_DB_QueryStatus -postgres_insert_withdraw_info (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - TALER_EXCHANGEDB_CollectableBlindcoin * - collectable) +postgres_insert_withdraw_info ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable) { struct PostgresClosure *pg = cls; struct TALER_EXCHANGEDB_Reserve reserve; @@ -2949,14 +2945,14 @@ match_deposit_cb (void *cls, * number of rows processed, 0 if none exist */ static enum GNUNET_DB_QueryStatus -postgres_iterate_matching_deposits (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct GNUNET_HashCode *h_wire, - const struct - TALER_MerchantPublicKeyP *merchant_pub, - TALER_EXCHANGEDB_DepositIterator deposit_cb, - void *deposit_cb_cls, - uint32_t limit) +postgres_iterate_matching_deposits ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantPublicKeyP *merchant_pub, + TALER_EXCHANGEDB_DepositIterator deposit_cb, + void *deposit_cb_cls, + uint32_t limit) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -3040,11 +3036,11 @@ postgres_get_known_coin (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_get_coin_denomination (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - TALER_CoinSpendPublicKeyP *coin_pub, - struct GNUNET_HashCode *denom_hash) +postgres_get_coin_denomination ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + struct GNUNET_HashCode *denom_hash) { struct PostgresClosure *pc = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -3347,16 +3343,14 @@ get_refunds_cb (void *cls, * @return query result status */ static enum GNUNET_DB_QueryStatus -postgres_select_refunds_by_coin (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - TALER_CoinSpendPublicKeyP *coin_pub, - const struct - TALER_MerchantPublicKeyP *merchant_pub, - const struct GNUNET_HashCode *h_contract, - TALER_EXCHANGEDB_RefundCoinCallback - cb, - void *cb_cls) +postgres_select_refunds_by_coin ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_MerchantPublicKeyP *merchant_pub, + const struct GNUNET_HashCode *h_contract, + TALER_EXCHANGEDB_RefundCoinCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; enum GNUNET_DB_QueryStatus qs; @@ -3481,10 +3475,10 @@ postgres_get_melt_index (void *cls, * @return query status for the transaction */ static enum GNUNET_DB_QueryStatus -postgres_insert_melt (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - TALER_EXCHANGEDB_Refresh *refresh_session) +postgres_insert_melt ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_EXCHANGEDB_Refresh *refresh_session) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (&refresh_session->rc), @@ -3518,15 +3512,15 @@ postgres_insert_melt (void *cls, * @return query status for the transaction */ static enum GNUNET_DB_QueryStatus -postgres_insert_refresh_reveal (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct TALER_RefreshCommitmentP *rc, - uint32_t num_rrcs, - const struct - TALER_EXCHANGEDB_RefreshRevealedCoin *rrcs, - unsigned int num_tprivs, - const struct TALER_TransferPrivateKeyP *tprivs, - const struct TALER_TransferPublicKeyP *tp) +postgres_insert_refresh_reveal ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_RefreshCommitmentP *rc, + uint32_t num_rrcs, + const struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrcs, + unsigned int num_tprivs, + const struct TALER_TransferPrivateKeyP *tprivs, + const struct TALER_TransferPublicKeyP *tp) { (void) cls; if (TALER_CNC_KAPPA != num_tprivs + 1) @@ -4415,12 +4409,12 @@ struct Work * @return database transaction status */ static enum GNUNET_DB_QueryStatus -postgres_get_coin_transactions (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - TALER_CoinSpendPublicKeyP *coin_pub, - int include_recoup, - struct TALER_EXCHANGEDB_TransactionList **tlp) +postgres_get_coin_transactions ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + int include_recoup, + struct TALER_EXCHANGEDB_TransactionList **tlp) { struct PostgresClosure *pg = cls; static const struct Work work_op[] = { @@ -4609,12 +4603,12 @@ handle_wt_result (void *cls, * @return query status of the transaction */ static enum GNUNET_DB_QueryStatus -postgres_lookup_wire_transfer (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - TALER_WireTransferIdentifierRawP *wtid, - TALER_EXCHANGEDB_AggregationDataCallback cb, - void *cb_cls) +postgres_lookup_wire_transfer ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_WireTransferIdentifierRawP *wtid, + TALER_EXCHANGEDB_AggregationDataCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -4656,18 +4650,15 @@ postgres_lookup_wire_transfer (void *cls, * @return transaction status code - */ static enum GNUNET_DB_QueryStatus -postgres_lookup_transfer_by_deposit (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - GNUNET_HashCode *h_contract_terms, - const struct GNUNET_HashCode *h_wire, - const struct - TALER_CoinSpendPublicKeyP *coin_pub, - const struct - TALER_MerchantPublicKeyP *merchant_pub, - TALER_EXCHANGEDB_WireTransferByCoinCallback - cb, - void *cb_cls) +postgres_lookup_transfer_by_deposit ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct GNUNET_HashCode *h_contract_terms, + const struct GNUNET_HashCode *h_wire, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_MerchantPublicKeyP *merchant_pub, + TALER_EXCHANGEDB_WireTransferByCoinCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; enum GNUNET_DB_QueryStatus qs; @@ -4761,11 +4752,11 @@ postgres_lookup_transfer_by_deposit (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_insert_aggregation_tracking (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - TALER_WireTransferIdentifierRawP *wtid, - unsigned long long deposit_serial_id) +postgres_insert_aggregation_tracking ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_WireTransferIdentifierRawP *wtid, + unsigned long long deposit_serial_id) { uint64_t rid = deposit_serial_id; struct GNUNET_PQ_QueryParam params[] = { @@ -5055,16 +5046,15 @@ postgres_get_expired_reserves (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_insert_reserve_closed (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - TALER_ReservePublicKeyP *reserve_pub, - struct GNUNET_TIME_Absolute execution_date, - const char *receiver_account, - const struct - TALER_WireTransferIdentifierRawP *wtid, - const struct TALER_Amount *amount_with_fee, - const struct TALER_Amount *closing_fee) +postgres_insert_reserve_closed ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_ReservePublicKeyP *reserve_pub, + struct GNUNET_TIME_Absolute execution_date, + const char *receiver_account, + const struct TALER_WireTransferIdentifierRawP *wtid, + const struct TALER_Amount *amount_with_fee, + const struct TALER_Amount *closing_fee) { struct TALER_EXCHANGEDB_Reserve reserve; struct GNUNET_PQ_QueryParam params[] = { @@ -5280,14 +5270,14 @@ postgres_start_deferred_wire_out (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_store_wire_transfer_out (void *cls, - struct TALER_EXCHANGEDB_Session *session, - struct GNUNET_TIME_Absolute date, - const struct - TALER_WireTransferIdentifierRawP *wtid, - const json_t *wire_account, - const char *exchange_account_section, - const struct TALER_Amount *amount) +postgres_store_wire_transfer_out ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + struct GNUNET_TIME_Absolute date, + const struct TALER_WireTransferIdentifierRawP *wtid, + const json_t *wire_account, + const char *exchange_account_section, + const struct TALER_Amount *amount) { struct GNUNET_PQ_QueryParam params[] = { TALER_PQ_query_param_absolute_time (&date), @@ -5521,12 +5511,12 @@ deposit_serial_helper_cb (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_deposits_above_serial_id (void *cls, - struct TALER_EXCHANGEDB_Session * - session, - uint64_t serial_id, - TALER_EXCHANGEDB_DepositCallback cb, - void *cb_cls) +postgres_select_deposits_above_serial_id ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + uint64_t serial_id, + TALER_EXCHANGEDB_DepositCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -5660,13 +5650,12 @@ refreshs_serial_helper_cb (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_refreshes_above_serial_id (void *cls, - struct TALER_EXCHANGEDB_Session * - session, - uint64_t serial_id, - TALER_EXCHANGEDB_RefreshesCallback - cb, - void *cb_cls) +postgres_select_refreshes_above_serial_id ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + uint64_t serial_id, + TALER_EXCHANGEDB_RefreshesCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -5799,12 +5788,12 @@ refunds_serial_helper_cb (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_refunds_above_serial_id (void *cls, - struct TALER_EXCHANGEDB_Session * - session, - uint64_t serial_id, - TALER_EXCHANGEDB_RefundCallback cb, - void *cb_cls) +postgres_select_refunds_above_serial_id ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + uint64_t serial_id, + TALER_EXCHANGEDB_RefundCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -5934,13 +5923,12 @@ reserves_in_serial_helper_cb (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_reserves_in_above_serial_id (void *cls, - struct TALER_EXCHANGEDB_Session * - session, - uint64_t serial_id, - TALER_EXCHANGEDB_ReserveInCallback - cb, - void *cb_cls) +postgres_select_reserves_in_above_serial_id ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + uint64_t serial_id, + TALER_EXCHANGEDB_ReserveInCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -5979,15 +5967,13 @@ postgres_select_reserves_in_above_serial_id (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_reserves_in_above_serial_id_by_account (void *cls, - struct - TALER_EXCHANGEDB_Session - *session, - const char *account_name, - uint64_t serial_id, - TALER_EXCHANGEDB_ReserveInCallback - cb, - void *cb_cls) +postgres_select_reserves_in_above_serial_id_by_account ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const char *account_name, + uint64_t serial_id, + TALER_EXCHANGEDB_ReserveInCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -6122,13 +6108,12 @@ reserves_out_serial_helper_cb (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_withdrawals_above_serial_id (void *cls, - struct TALER_EXCHANGEDB_Session * - session, - uint64_t serial_id, - TALER_EXCHANGEDB_WithdrawCallback - cb, - void *cb_cls) +postgres_select_withdrawals_above_serial_id ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + uint64_t serial_id, + TALER_EXCHANGEDB_WithdrawCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -6254,13 +6239,12 @@ wire_out_serial_helper_cb (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_wire_out_above_serial_id (void *cls, - struct TALER_EXCHANGEDB_Session * - session, - uint64_t serial_id, - TALER_EXCHANGEDB_WireTransferOutCallback - cb, - void *cb_cls) +postgres_select_wire_out_above_serial_id ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + uint64_t serial_id, + TALER_EXCHANGEDB_WireTransferOutCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -6299,15 +6283,13 @@ postgres_select_wire_out_above_serial_id (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_wire_out_above_serial_id_by_account (void *cls, - struct - TALER_EXCHANGEDB_Session * - session, - const char *account_name, - uint64_t serial_id, - TALER_EXCHANGEDB_WireTransferOutCallback - cb, - void *cb_cls) +postgres_select_wire_out_above_serial_id_by_account ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const char *account_name, + uint64_t serial_id, + TALER_EXCHANGEDB_WireTransferOutCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -6453,12 +6435,12 @@ recoup_serial_helper_cb (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_recoup_above_serial_id (void *cls, - struct TALER_EXCHANGEDB_Session * - session, - uint64_t serial_id, - TALER_EXCHANGEDB_RecoupCallback cb, - void *cb_cls) +postgres_select_recoup_above_serial_id ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + uint64_t serial_id, + TALER_EXCHANGEDB_RecoupCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -6603,13 +6585,12 @@ recoup_refresh_serial_helper_cb (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_recoup_refresh_above_serial_id (void *cls, - struct TALER_EXCHANGEDB_Session - *session, - uint64_t serial_id, - TALER_EXCHANGEDB_RecoupRefreshCallback - cb, - void *cb_cls) +postgres_select_recoup_refresh_above_serial_id ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + uint64_t serial_id, + TALER_EXCHANGEDB_RecoupRefreshCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -6743,13 +6724,12 @@ reserve_closed_serial_helper_cb (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_select_reserve_closed_above_serial_id (void *cls, - struct TALER_EXCHANGEDB_Session - *session, - uint64_t serial_id, - TALER_EXCHANGEDB_ReserveClosedCallback - cb, - void *cb_cls) +postgres_select_reserve_closed_above_serial_id ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + uint64_t serial_id, + TALER_EXCHANGEDB_ReserveClosedCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -6793,18 +6773,16 @@ postgres_select_reserve_closed_above_serial_id (void *cls, * @return transaction result status */ static enum GNUNET_DB_QueryStatus -postgres_insert_recoup_request (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - TALER_ReservePublicKeyP *reserve_pub, - const struct TALER_CoinPublicInfo *coin, - const struct - TALER_CoinSpendSignatureP *coin_sig, - const struct - TALER_DenominationBlindingKeyP *coin_blind, - const struct TALER_Amount *amount, - const struct GNUNET_HashCode *h_blind_ev, - struct GNUNET_TIME_Absolute timestamp) +postgres_insert_recoup_request ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_ReservePublicKeyP *reserve_pub, + const struct TALER_CoinPublicInfo *coin, + const struct TALER_CoinSpendSignatureP *coin_sig, + const struct TALER_DenominationBlindingKeyP *coin_blind, + const struct TALER_Amount *amount, + const struct GNUNET_HashCode *h_blind_ev, + struct GNUNET_TIME_Absolute timestamp) { struct PostgresClosure *pg = cls; struct GNUNET_TIME_Absolute expiry; @@ -6888,20 +6866,15 @@ postgres_insert_recoup_request (void *cls, * @return transaction result status */ static enum GNUNET_DB_QueryStatus -postgres_insert_recoup_refresh_request (void *cls, - struct TALER_EXCHANGEDB_Session * - session, - const struct - TALER_CoinPublicInfo *coin, - const struct - TALER_CoinSpendSignatureP *coin_sig, - const struct - TALER_DenominationBlindingKeyP * - coin_blind, - const struct TALER_Amount *amount, - const struct - GNUNET_HashCode *h_blind_ev, - struct GNUNET_TIME_Absolute timestamp) +postgres_insert_recoup_refresh_request ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_CoinPublicInfo *coin, + const struct TALER_CoinSpendSignatureP *coin_sig, + const struct TALER_DenominationBlindingKeyP *coin_blind, + const struct TALER_Amount *amount, + const struct GNUNET_HashCode *h_blind_ev, + struct GNUNET_TIME_Absolute timestamp) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (&coin->coin_pub), @@ -7007,13 +6980,11 @@ postgres_get_old_coin_by_h_blind (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_insert_denomination_revocation (void *cls, - struct TALER_EXCHANGEDB_Session * - session, - const struct - GNUNET_HashCode *denom_pub_hash, - const struct - TALER_MasterSignatureP *master_sig) +postgres_insert_denomination_revocation ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct GNUNET_HashCode *denom_pub_hash, + const struct TALER_MasterSignatureP *master_sig) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (denom_pub_hash), @@ -7040,12 +7011,12 @@ postgres_insert_denomination_revocation (void *cls, * @return transaction status code */ static enum GNUNET_DB_QueryStatus -postgres_get_denomination_revocation (void *cls, - struct TALER_EXCHANGEDB_Session *session, - const struct - GNUNET_HashCode *denom_pub_hash, - struct TALER_MasterSignatureP *master_sig, - uint64_t *rowid) +postgres_get_denomination_revocation ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct GNUNET_HashCode *denom_pub_hash, + struct TALER_MasterSignatureP *master_sig, + uint64_t *rowid) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (denom_pub_hash), -- cgit v1.2.3