challenger

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

commit 8e90d4f613c0347922dbe1eb73f5ef9287bf1743
parent 0f641329a9681509235cd679f3e775041a344d94
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 26 Apr 2023 23:28:14 +0200

-fix FTBFS

Diffstat:
Msrc/challenger/challenger-httpd.c | 14+++++++++-----
Msrc/challenger/challenger-httpd_common.c | 13+++++++++----
Msrc/challenger/challenger-httpd_setup.c | 13+++++++------
3 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/src/challenger/challenger-httpd.c b/src/challenger/challenger-httpd.c @@ -75,6 +75,10 @@ static struct MHD_Daemon *mhd; */ struct CHALLENGER_DatabasePlugin *db; +/** + * How long is an individual validation request valid? + */ +struct GNUNET_TIME_Relative CH_validation_duration; /** * A client has requested the given url using the given method @@ -268,7 +272,7 @@ url_handler (void *cls, GNUNET_SCHEDULER_begin_async_scope (&hc->async_scope_id); } GNUNET_assert (NULL != hc->rh); - hc->path = &url[strlen (rh->url)]; + hc->path = &url[strlen (hc->rh->url)]; return hc->rh->handler (hc, upload_data, upload_data_size); @@ -492,10 +496,10 @@ run (void *cls, go |= TALER_MHD_GO_FORCE_CONNECTION_CLOSE; if (GNUNET_OK != - GNUNET_CONFIGURATION_get_relative_time (config, - "CHALLENGER", - "VALIDATION_DURATION", - &CH_validation_duration)) + GNUNET_CONFIGURATION_get_value_time (config, + "CHALLENGER", + "VALIDATION_DURATION", + &CH_validation_duration)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "CHALLENGER", diff --git a/src/challenger/challenger-httpd_common.c b/src/challenger/challenger-httpd_common.c @@ -18,26 +18,31 @@ * @brief common helper functions * @author Christian Grothoff */ +#include "platform.h" #include "challenger-httpd_common.h" +#define RFC_8959_PREFIX "secret-token:" + const char * CH_get_client_secret (struct MHD_Connection *connection) { - const char *auth; const char *bearer = "Bearer "; - const char *tok = *auth; + const char *auth; + const char *tok; auth = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_AUTHORIZATION); - if (0 != strncmp (tok, + if (NULL == auth) + return NULL; + if (0 != strncmp (auth, bearer, strlen (bearer))) { return NULL; } - tok = tok + strlen (bearer); + tok = auth + strlen (bearer); while (' ' == *tok) tok++; if (0 != strncasecmp (tok, diff --git a/src/challenger/challenger-httpd_setup.c b/src/challenger/challenger-httpd_setup.c @@ -48,7 +48,7 @@ CH_handler_setup (struct CH_HandlerContext *hc, hc->path); } } - client_secret = CH_get_client_secret (connection); + client_secret = CH_get_client_secret (hc->connection); if (NULL == client_secret) { GNUNET_break_op (0); @@ -97,6 +97,7 @@ CH_handler_setup (struct CH_HandlerContext *hc, &nonce, sizeof (nonce)); qs = db->validation_setup (db->cls, + client_id, &nonce, expiration_time); switch (qs) @@ -117,10 +118,10 @@ CH_handler_setup (struct CH_HandlerContext *hc, case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: break; } + return TALER_MHD_REPLY_JSON_PACK ( + hc->connection, + MHD_HTTP_OK, + GNUNET_JSON_pack_data_auto ("nonce", + &nonce)); } - return TALER_MHD_REPLY_JSON_PACK ( - hc->connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_data_auto ("nonce", - &nonce)); }