aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-08-06 19:12:17 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-08-06 19:12:17 +0200
commit8c48060e129877767f58a8403deba8a4beaeea24 (patch)
tree79cbe944d851c7c7536b63641eb36cb96a87b4b5 /src/reclaim
parentb12644f83637c2508a11927490ae0b94d8ee4095 (diff)
downloadgnunet-8c48060e129877767f58a8403deba8a4beaeea24.tar.gz
gnunet-8c48060e129877767f58a8403deba8a4beaeea24.zip
-fix rest plugin issues
Diffstat (limited to 'src/reclaim')
-rw-r--r--src/reclaim/oidc_helper.c2
-rw-r--r--src/reclaim/plugin_rest_openid_connect.c27
-rw-r--r--src/reclaim/plugin_rest_reclaim.c7
3 files changed, 18 insertions, 18 deletions
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c
index 9b5938c43..d0345108e 100644
--- a/src/reclaim/oidc_helper.c
+++ b/src/reclaim/oidc_helper.c
@@ -621,6 +621,7 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
621 621
622 // cmp code_challenge code_verifier 622 // cmp code_challenge code_verifier
623 code_challenge_len = ntohl (params->code_challenge_len); 623 code_challenge_len = ntohl (params->code_challenge_len);
624 code_challenge = ((char *) &params[1]);
624 if (0 != code_challenge_len) /* Only check if this code requires a CV */ 625 if (0 != code_challenge_len) /* Only check if this code requires a CV */
625 { 626 {
626 if (NULL == code_verifier) 627 if (NULL == code_verifier)
@@ -639,7 +640,6 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
639 // encode code verifier 640 // encode code verifier
640 GNUNET_STRINGS_base64url_encode (code_verifier_hash, 256 / 8, 641 GNUNET_STRINGS_base64url_encode (code_verifier_hash, 256 / 8,
641 &expected_code_challenge); 642 &expected_code_challenge);
642 code_challenge = ((char *) &params[1]);
643 GNUNET_free (code_verifier_hash); 643 GNUNET_free (code_verifier_hash);
644 if (0 != 644 if (0 !=
645 strncmp (expected_code_challenge, code_challenge, code_challenge_len)) 645 strncmp (expected_code_challenge, code_challenge, code_challenge_len))
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c
index 3221c1cce..db138c26b 100644
--- a/src/reclaim/plugin_rest_openid_connect.c
+++ b/src/reclaim/plugin_rest_openid_connect.c
@@ -1971,7 +1971,6 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1971 struct GNUNET_RECLAIM_AttestationList *al = NULL; 1971 struct GNUNET_RECLAIM_AttestationList *al = NULL;
1972 struct GNUNET_RECLAIM_Ticket ticket; 1972 struct GNUNET_RECLAIM_Ticket ticket;
1973 struct GNUNET_CRYPTO_EcdsaPublicKey cid; 1973 struct GNUNET_CRYPTO_EcdsaPublicKey cid;
1974 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
1975 struct GNUNET_HashCode cache_key; 1974 struct GNUNET_HashCode cache_key;
1976 struct MHD_Response *resp; 1975 struct MHD_Response *resp;
1977 char *grant_type; 1976 char *grant_type;
@@ -2043,7 +2042,6 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2043 GNUNET_SCHEDULER_add_now (&do_error, handle); 2042 GNUNET_SCHEDULER_add_now (&do_error, handle);
2044 return; 2043 return;
2045 } 2044 }
2046 privkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
2047 2045
2048 // REQUIRED code verifier 2046 // REQUIRED code verifier
2049 code_verifier = get_url_parameter_copy (handle, OIDC_CODE_VERIFIER_KEY); 2047 code_verifier = get_url_parameter_copy (handle, OIDC_CODE_VERIFIER_KEY);
@@ -2590,6 +2588,12 @@ libgnunet_plugin_rest_openid_connect_init (void *cls)
2590 return api; 2588 return api;
2591} 2589}
2592 2590
2591static int
2592cleanup_hashmap (void *cls, const struct GNUNET_HashCode *key, void *value)
2593{
2594 GNUNET_free (value);
2595 return GNUNET_YES;
2596}
2593 2597
2594/** 2598/**
2595 * Exit point from the plugin. 2599 * Exit point from the plugin.
@@ -2606,18 +2610,13 @@ libgnunet_plugin_rest_openid_connect_done (void *cls)
2606 2610
2607 plugin->cfg = NULL; 2611 plugin->cfg = NULL;
2608 2612
2609 struct GNUNET_CONTAINER_MultiHashMapIterator *hashmap_it; 2613 if (NULL != OIDC_cookie_jar_map)
2610 void *value = NULL; 2614 {
2611 hashmap_it = 2615 GNUNET_CONTAINER_multihashmap_iterate (OIDC_cookie_jar_map,
2612 GNUNET_CONTAINER_multihashmap_iterator_create (OIDC_cookie_jar_map); 2616 &cleanup_hashmap,
2613 while (GNUNET_YES == 2617 NULL);
2614 GNUNET_CONTAINER_multihashmap_iterator_next (hashmap_it, NULL, 2618 GNUNET_CONTAINER_multihashmap_destroy (OIDC_cookie_jar_map);
2615 value)) 2619 }
2616 GNUNET_free (value);
2617 GNUNET_CONTAINER_multihashmap_iterator_destroy (hashmap_it);
2618 GNUNET_CONTAINER_multihashmap_destroy (OIDC_cookie_jar_map);
2619
2620 GNUNET_CONTAINER_multihashmap_iterator_destroy (hashmap_it);
2621 GNUNET_free (allow_methods); 2620 GNUNET_free (allow_methods);
2622 if (NULL != gns_handle) 2621 if (NULL != gns_handle)
2623 GNUNET_GNS_disconnect (gns_handle); 2622 GNUNET_GNS_disconnect (gns_handle);
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c
index c2d14825e..0aeb0647a 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -1422,12 +1422,14 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
1422 handle->timeout = GNUNET_TIME_UNIT_FOREVER_REL; 1422 handle->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
1423 handle->proc_cls = proc_cls; 1423 handle->proc_cls = proc_cls;
1424 handle->proc = proc; 1424 handle->proc = proc;
1425 state = ID_REST_STATE_INIT;
1426 handle->rest_handle = rest_handle; 1425 handle->rest_handle = rest_handle;
1427 1426
1428 handle->url = GNUNET_strdup (rest_handle->url); 1427 handle->url = GNUNET_strdup (rest_handle->url);
1429 if (handle->url[strlen (handle->url) - 1] == '/') 1428 if (handle->url[strlen (handle->url) - 1] == '/')
1430 handle->url[strlen (handle->url) - 1] = '\0'; 1429 handle->url[strlen (handle->url) - 1] = '\0';
1430 handle->timeout_task =
1431 GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_timeout, handle);
1432
1431 if (GNUNET_NO == 1433 if (GNUNET_NO ==
1432 GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle)) 1434 GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle))
1433 { 1435 {
@@ -1435,8 +1437,6 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
1435 return GNUNET_NO; 1437 return GNUNET_NO;
1436 } 1438 }
1437 1439
1438 handle->timeout_task =
1439 GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_timeout, handle);
1440 return GNUNET_YES; 1440 return GNUNET_YES;
1441} 1441}
1442 1442
@@ -1470,6 +1470,7 @@ libgnunet_plugin_rest_reclaim_init (void *cls)
1470 MHD_HTTP_METHOD_DELETE, 1470 MHD_HTTP_METHOD_DELETE,
1471 MHD_HTTP_METHOD_OPTIONS); 1471 MHD_HTTP_METHOD_OPTIONS);
1472 identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, NULL); 1472 identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, NULL);
1473 state = ID_REST_STATE_INIT;
1473 idp = GNUNET_RECLAIM_connect (cfg); 1474 idp = GNUNET_RECLAIM_connect (cfg);
1474 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1475 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1475 _ ("Identity Provider REST API initialized\n")); 1476 _ ("Identity Provider REST API initialized\n"));