exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 61e8d2fbfa1a546aa0af13cacaa05c34ce80a931
parent 87009e98a5f1cae4156fa86013876873d0cd2fa2
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 23 Aug 2024 22:32:57 +0200

add option to disable authentication

Diffstat:
Msrc/auditor/taler-auditor-httpd.c | 14+++++++++++++-
Msrc/auditor/taler-auditor-httpd_balances-get.c | 53++++++++++++++++++++++-------------------------------
Msrc/include/taler_auditordb_plugin.h | 10----------
3 files changed, 35 insertions(+), 42 deletions(-)

diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c @@ -198,6 +198,11 @@ static unsigned int connection_timeout = 30; static int global_ret; /** + * Disables authentication checks. + */ +static int disable_auth; + +/** * Port to run the daemon on. */ static uint16_t serve_port; @@ -855,6 +860,9 @@ handle_mhd_request (void *cls, rh->method)) ) { match = rh; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Matched %s\n", + rh->url); break; } } @@ -864,7 +872,7 @@ handle_mhd_request (void *cls, GNUNET_break_op (0); goto not_found; } - if (match->requires_auth) + if (match->requires_auth && (0 == disable_auth) ) { const char *auth; @@ -1214,6 +1222,10 @@ main (int argc, "connection-close", "force HTTP connections to be closed after each request", &auditor_connection_close), + GNUNET_GETOPT_option_flag ('n', + "no-authentication", + "disable authentication checks", + &disable_auth), GNUNET_GETOPT_option_uint ('t', "timeout", "SECONDS", diff --git a/src/auditor/taler-auditor-httpd_balances-get.c b/src/auditor/taler-auditor-httpd_balances-get.c @@ -13,8 +13,6 @@ 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/> */ - - #include "platform.h" #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_json_lib.h> @@ -27,13 +25,13 @@ #include "taler-auditor-httpd_balances-get.h" /** -* Add balances to the list. -* -* @param[in,out] cls a `json_t *` array to extend -* @param serial_id location of the @a dc in the database -* @param dc struct of inconsistencies -* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating -*/ + * Add balance to the list. + * + * @param[in,out] cls a `json_t *` array to extend + * @param serial_id location of the @a dc in the database + * @param dc struct of inconsistencies + * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating + */ static enum GNUNET_GenericReturnValue process_balances ( void *cls, @@ -44,12 +42,12 @@ process_balances ( json_t *obj; obj = GNUNET_JSON_PACK ( - - GNUNET_JSON_pack_uint64 ("row_id", serial_id), - GNUNET_JSON_pack_string ("balance_key", dc->balance_key), - TALER_JSON_pack_amount ("balance_value", &dc->balance_value) - - + GNUNET_JSON_pack_uint64 ("row_id", + serial_id), + GNUNET_JSON_pack_string ("balance_key", + dc->balance_key), + TALER_JSON_pack_amount ("balance_value", + &dc->balance_value) ); GNUNET_break (0 == json_array_append_new (list, @@ -71,6 +69,9 @@ TAH_BALANCES_handler_get ( { json_t *ja; enum GNUNET_DB_QueryStatus qs; + int64_t limit = -20; + uint64_t offset; + const char *balance_key; (void) rh; (void) connection_cls; @@ -85,12 +86,6 @@ TAH_BALANCES_handler_get ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - ja = json_array (); - GNUNET_break (NULL != ja); - - int64_t limit = -20; - uint64_t offset; - TALER_MHD_parse_request_snumber (connection, "limit", &limit); @@ -99,26 +94,22 @@ TAH_BALANCES_handler_get ( offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, "offset", &offset); - - bool return_suppressed = false; - - const char *balance_key = MHD_lookup_connection_value (connection, - MHD_GET_ARGUMENT_KIND, - "balance_key"); - + balance_key + = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, + "balance_key"); + ja = json_array (); + GNUNET_break (NULL != ja); qs = TAH_plugin->get_balances ( TAH_plugin->cls, limit, offset, - return_suppressed, balance_key, &process_balances, ja); - if (0 > qs) { GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h @@ -1934,16 +1934,6 @@ struct TALER_AUDITORDB_Plugin void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); - enum GNUNET_DB_QueryStatus - (*get_balances)( - void *cls, - int64_t limit, - uint64_t offset, - bool return_suppressed, - const char *balance_key, - TALER_AUDITORDB_BalancesCallback cb, - void *cb_cls); - /** * Insert information about a reserve. There must not be an * existing record for the reserve.