challenger

OAuth 2.0-based authentication service that validates user can receive messages at a certain address
Log | Files | Refs | Submodules | README | LICENSE

commit 66c37e3005caf4ce4048a84aafc6c7319fdd2f92
parent cc2425b142c96841bcf78afb3bcc6a2b61799981
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun,  7 May 2023 01:31:59 +0200

-fix dist

Diffstat:
MMakefile.am | 3+--
Msrc/challenger/challenger-admin.c | 2++
Msrc/challenger/challenger-httpd.c | 3+++
Msrc/challenger/challenger-httpd_auth.c | 11++++++++---
Msrc/challenger/challenger-httpd_challenge.c | 6+++---
Msrc/challenger/challenger-httpd_common.c | 2+-
Msrc/challenger/challenger-httpd_info.c | 4+++-
Msrc/challenger/challenger-httpd_login.c | 4+++-
Msrc/challenger/challenger-httpd_setup.c | 2++
Msrc/challenger/challenger-httpd_solve.c | 4++--
Msrc/challengerdb/Makefile.am | 2+-
Msrc/challengerdb/challenger-dbinit.c | 3+++
Dsrc/challengerdb/pg_validate_challenge_open.c | 55-------------------------------------------------------
Dsrc/challengerdb/pg_validate_challenge_open.h | 45---------------------------------------------
Msrc/challengerdb/plugin_challengerdb_postgres.c | 1-
Msrc/include/Makefile.am | 1+
16 files changed, 33 insertions(+), 115 deletions(-)

diff --git a/Makefile.am b/Makefile.am @@ -19,5 +19,4 @@ endif ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = \ AUTHORS \ - COPYING.AGPL \ - Doxyfile + COPYING.AGPL diff --git a/src/challenger/challenger-admin.c b/src/challenger/challenger-admin.c @@ -58,6 +58,8 @@ run (void *cls, const char *url = args[0]; struct CHALLENGER_DatabasePlugin *plugin; + (void) cls; + (void) cfgfile; if (NULL == url) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, diff --git a/src/challenger/challenger-httpd.c b/src/challenger/challenger-httpd.c @@ -521,6 +521,9 @@ run (void *cls, enum TALER_MHD_GlobalOptions go; uint16_t port; + (void) cls; + (void) args; + (void) cfgfile; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting challenger-httpd\n"); if (GNUNET_OK != diff --git a/src/challenger/challenger-httpd_auth.c b/src/challenger/challenger-httpd_auth.c @@ -158,6 +158,11 @@ post_iter (void *cls, char **ptr = NULL; size_t slen; + (void) kind; + (void) filename; + (void) content_type; + (void) transfer_encoding; + (void) off; for (unsigned int i = 0; NULL != map[i].name; i++) if (0 == strcmp (key, map[i].name)) @@ -292,7 +297,7 @@ CH_handler_auth (struct CH_HandlerContext *hc, "client_check"); case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (0); - return GNUNET_NO; + return MHD_NO; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: GNUNET_break_op (0); return TALER_MHD_reply_with_error (hc->connection, @@ -353,7 +358,7 @@ CH_handler_auth (struct CH_HandlerContext *hc, "validation_get"); case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (0); - return GNUNET_NO; + return MHD_NO; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: GNUNET_break_op (0); return TALER_MHD_reply_with_error (hc->connection, @@ -411,7 +416,7 @@ CH_handler_auth (struct CH_HandlerContext *hc, "auth_add_grant"); case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (0); - return GNUNET_NO; + return MHD_NO; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: GNUNET_break (0); return TALER_MHD_reply_with_error (hc->connection, diff --git a/src/challenger/challenger-httpd_challenge.c b/src/challenger/challenger-httpd_challenge.c @@ -313,8 +313,8 @@ send_tan (struct ChallengeContext *bc) : GNUNET_SYSERR; return; } - off += ret; - left -= ret; + off += (size_t) ret; + left -= (size_t) ret; } GNUNET_DISK_file_close (pipe_stdin); } @@ -489,7 +489,7 @@ CH_handler_challenge (struct CH_HandlerContext *hc, "set-address-and-pin"); case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (0); - return GNUNET_NO; + return MHD_NO; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_TEMPLATING_reply_error (hc->connection, "validation-unknown", diff --git a/src/challenger/challenger-httpd_common.c b/src/challenger/challenger-httpd_common.c @@ -109,7 +109,7 @@ CH_code_to_nonce (const char *code, } if (GNUNET_OK != GNUNET_STRINGS_string_to_data (code, - dash - code, + (size_t) (dash - code), nonce, sizeof (*nonce))) { diff --git a/src/challenger/challenger-httpd_info.c b/src/challenger/challenger-httpd_info.c @@ -39,6 +39,8 @@ CH_handler_info (struct CH_HandlerContext *hc, const char *token; struct CHALLENGER_AccessTokenP grant; + (void) upload_data; + (void) upload_data_size; auth = MHD_lookup_connection_value (hc->connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_AUTHORIZATION); @@ -96,7 +98,7 @@ CH_handler_info (struct CH_HandlerContext *hc, "info_get_grant"); case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (0); - return GNUNET_NO; + return MHD_NO; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (hc->connection, MHD_HTTP_NOT_FOUND, diff --git a/src/challenger/challenger-httpd_login.c b/src/challenger/challenger-httpd_login.c @@ -37,6 +37,8 @@ CH_handler_login (struct CH_HandlerContext *hc, const char *scope; struct CHALLENGER_ValidationNonceP nonce; + (void) upload_data; + (void) upload_data_size; if (GNUNET_OK != GNUNET_STRINGS_string_to_data (hc->path, strlen (hc->path), @@ -151,7 +153,7 @@ CH_handler_login (struct CH_HandlerContext *hc, "login_start"); case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (0); - return GNUNET_NO; + return MHD_NO; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_TEMPLATING_reply_error (hc->connection, "validation-unknown", diff --git a/src/challenger/challenger-httpd_setup.c b/src/challenger/challenger-httpd_setup.c @@ -33,6 +33,8 @@ CH_handler_setup (struct CH_HandlerContext *hc, unsigned long long client_id; const char *client_secret; + (void) upload_data; + (void) upload_data_size; { char dummy; diff --git a/src/challenger/challenger-httpd_solve.c b/src/challenger/challenger-httpd_solve.c @@ -208,7 +208,7 @@ CH_handler_solve (struct CH_HandlerContext *hc, "validate_solve_pin"); case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (0); - return GNUNET_NO; + return MHD_NO; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_TEMPLATING_reply_error (hc->connection, "validation-unknown", @@ -258,7 +258,7 @@ CH_handler_solve (struct CH_HandlerContext *hc, "validation_get"); case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (0); - return GNUNET_NO; + return MHD_NO; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_TEMPLATING_reply_error (hc->connection, "validation-unknown", diff --git a/src/challengerdb/Makefile.am b/src/challengerdb/Makefile.am @@ -67,7 +67,7 @@ libchallenger_plugin_db_postgres_la_SOURCES = \ pg_challenge_set_address_and_pin.h pg_challenge_set_address_and_pin.c \ pg_validate_solve_pin.h pg_validate_solve_pin.c \ pg_validation_get.h pg_validation_get.c \ - plugin_challengerdb_postgres.c + plugin_challengerdb_postgres.c pg_helper.h libchallenger_plugin_db_postgres_la_LIBADD = \ $(LTLIBINTL) libchallenger_plugin_db_postgres_la_LDFLAGS = \ diff --git a/src/challengerdb/challenger-dbinit.c b/src/challengerdb/challenger-dbinit.c @@ -56,6 +56,9 @@ run (void *cls, { struct CHALLENGER_DatabasePlugin *plugin; + (void) cls; + (void) args; + (void) cfgfile; if (NULL == (plugin = CHALLENGER_DB_plugin_load (cfg))) { diff --git a/src/challengerdb/pg_validate_challenge_open.c b/src/challengerdb/pg_validate_challenge_open.c @@ -1,55 +0,0 @@ -/* - This file is part of Challenger - Copyright (C) 2023 Taler Systems SA - - Challenger 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. - - Challenger 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 - Challenger; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ -/** - * @file challengerdb/pg_validate_challenge_open.c - * @brief Implementation of the validate_challenge_open function for Postgres - * @author Christian Grothoff - */ -#include "platform.h" -#include <taler/taler_error_codes.h> -#include <taler/taler_dbevents.h> -#include <taler/taler_pq_lib.h> -#include "pg_validate_challenge_open.h" -#include "pg_helper.h" - - -enum GNUNET_DB_QueryStatus -CH_PG_validate_challenge_open (void *cls, - const struct CHALLENGER_ValidationNonceP *nonce, - bool *is_open) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (nonce), - GNUNET_PQ_query_param_end - }; - struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_bool ("is_open", - is_open), - GNUNET_PQ_result_spec_end - }; - - PREPARE (pg, - "validate_test_open", - "SELECT FROM validations " - " address IS NOT NULL AS is_open" - " WHERE nonce=$1" - " AND auth_attempts_left > 0;"); - return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, - "validate_test_open", - params, - rs); -} diff --git a/src/challengerdb/pg_validate_challenge_open.h b/src/challengerdb/pg_validate_challenge_open.h @@ -1,45 +0,0 @@ -/* - This file is part of Challenger - Copyright (C) 2023 Taler Systems SA - - Challenger 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. - - Challenger 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 - Challenger; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ -/** - * @file challengerdb/pg_validate_challenge_open.h - * @brief implementation of the validate_challenge_open function for Postgres - * @author Christian Grothoff - */ -#ifndef PG_VALIDATE_CHALLENGE_OPEN_H -#define PG_VALIDATE_CHALLENGE_OPEN_H - -#include <taler/taler_util.h> -#include <taler/taler_json_lib.h> -#include "challenger_database_plugin.h" - - -/** - * Check if challenge is pending to validate an address. - * - * @param cls - * @param nonce unique nonce to use to identify the validation - * @param[out] is_open set to true if a challenge was sent - * @return transaction status: - * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if the nonce was found - * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if we do not know the nonce - * #GNUNET_DB_STATUS_HARD_ERROR on failure - */ -enum GNUNET_DB_QueryStatus -CH_PG_validate_challenge_open (void *cls, - const struct CHALLENGER_ValidationNonceP *nonce, - bool *is_open); - -#endif diff --git a/src/challengerdb/plugin_challengerdb_postgres.c b/src/challengerdb/plugin_challengerdb_postgres.c @@ -34,7 +34,6 @@ #include "pg_setup_nonce.h" #include "pg_login_start.h" #include "pg_challenge_set_address_and_pin.h" -#include "pg_validate_challenge_open.h" #include "pg_validate_solve_pin.h" #include "pg_validation_get.h" diff --git a/src/include/Makefile.am b/src/include/Makefile.am @@ -5,5 +5,6 @@ EXTRA_DIST = \ challengerincludedir = $(includedir)/challenger challengerinclude_HEADERS = \ + challenger_util.h \ challenger_database_lib.h \ challenger_database_plugin.h