commit 562e98b23e0476816d12015e418016f7e881bf78
parent 9b6896eb076c689e17950c2bc5eea0c2110bbbd2
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Thu, 9 Jul 2026 22:11:05 +0200
DCE
Diffstat:
2 files changed, 4 insertions(+), 124 deletions(-)
diff --git a/src/challenger/challenger-httpd_common.c b/src/challenger/challenger-httpd_common.c
@@ -190,109 +190,11 @@ CH_reply_with_oauth_error (
}
-enum MHD_Result
-TALER_MHD_redirect_with_oauth_status (
- struct MHD_Connection *connection,
- const char *client_redirect_uri,
- const char *state,
- const char *oauth_error,
- const char *oauth_error_description,
- const char *oauth_error_uri)
-{
- struct MHD_Response *response;
- unsigned int http_status;
-
- if (0 == CH_get_output_type (connection))
- {
- char *url;
- char *enc_err;
- char *enc_state;
- char *enc_desc = NULL;
- char *enc_uri = NULL;
-
- response = MHD_create_response_from_buffer (strlen (oauth_error),
- (void *) oauth_error,
- MHD_RESPMEM_PERSISTENT);
- if (NULL == response)
- {
- GNUNET_break (0);
- return MHD_NO;
- }
- TALER_MHD_add_global_headers (response,
- false);
- GNUNET_break (MHD_YES ==
- MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_TYPE,
- "text/plain"));
- enc_err = TALER_urlencode (oauth_error);
- enc_state = TALER_urlencode (state);
- if (NULL != oauth_error_description)
- enc_desc = TALER_urlencode (oauth_error_description);
- if (NULL != oauth_error_uri)
- enc_uri = TALER_urlencode (oauth_error_uri);
- url = TALER_url_join (
- client_redirect_uri,
- "",
- "state", enc_state,
- "error", enc_err,
- "error_description", enc_desc,
- "error_uri", enc_uri,
- NULL);
- GNUNET_free (enc_err);
- GNUNET_free (enc_state);
- GNUNET_free (enc_desc);
- GNUNET_free (enc_uri);
- if (MHD_NO ==
- MHD_add_response_header (response,
- MHD_HTTP_HEADER_LOCATION,
- url))
- {
- GNUNET_break (0);
- MHD_destroy_response (response);
- GNUNET_free (url);
- return MHD_NO;
- }
- http_status = MHD_HTTP_FOUND;
- GNUNET_free (url);
- }
- else
- {
- json_t *args;
-
- args = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("state",
- state),
- GNUNET_JSON_pack_string ("error",
- oauth_error),
- GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_string ("description",
- oauth_error_description)),
- GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_string ("uri",
- oauth_error_uri)));
-
- response = TALER_MHD_make_json_steal (args);
- TALER_MHD_add_global_headers (response,
- false);
- http_status = MHD_HTTP_TOO_MANY_REQUESTS;
- }
-
- {
- enum MHD_Result ret;
-
- ret = MHD_queue_response (connection,
- http_status,
- response);
- MHD_destroy_response (response);
- return ret;
- }
-}
-
-
enum GNUNET_GenericReturnValue
-CH_build_full_redirect_url (const struct CHALLENGER_ValidationNonceP *nonce,
- struct MHD_Connection *connection,
- char **url)
+CH_build_full_redirect_url (
+ const struct CHALLENGER_ValidationNonceP *nonce,
+ struct MHD_Connection *connection,
+ char **url)
{
char *client_secret;
json_t *address;
diff --git a/src/challenger/challenger-httpd_common.h b/src/challenger/challenger-httpd_common.h
@@ -114,26 +114,4 @@ CH_reply_with_oauth_error (
const char *detail);
-/**
- * Redirect the client on @a connection to the given
- * @a client_redirect_uri providing the given OAuth2.0
- * error details.
- *
- * @param connection HTTP request to handle
- * @param client_redirect_uri base URI where to redirect
- * @param state client state to pass to server
- * @param oauth_error error status to return (e.g. "invalid_scope")
- * @param oauth_error_description longer description to return, optional, can be NULL
- * @param oauth_error_uri URI with additional information about the error, optional, can be NULL
- * @return MHD response queueing status
- */
-enum MHD_Result
-TALER_MHD_redirect_with_oauth_status (
- struct MHD_Connection *connection,
- const char *client_redirect_uri,
- const char *state,
- const char *oauth_error,
- const char *oauth_error_description,
- const char *oauth_error_uri);
-
#endif