[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: -fix rest plugin issues
From: |
gnunet |
Subject: |
[gnunet] branch master updated: -fix rest plugin issues |
Date: |
Thu, 06 Aug 2020 19:18:25 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 8c48060e1 -fix rest plugin issues
8c48060e1 is described below
commit 8c48060e129877767f58a8403deba8a4beaeea24
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Thu Aug 6 19:12:17 2020 +0200
-fix rest plugin issues
---
src/gns/plugin_rest_gns.c | 8 ++++----
src/identity/plugin_rest_identity.c | 1 +
src/namestore/plugin_rest_namestore.c | 1 +
src/peerinfo-tool/plugin_rest_peerinfo.c | 2 ++
src/reclaim/oidc_helper.c | 2 +-
src/reclaim/plugin_rest_openid_connect.c | 27 +++++++++++++--------------
src/reclaim/plugin_rest_reclaim.c | 7 ++++---
src/rest/gnunet-rest-server.c | 2 +-
src/rest/plugin_rest_config.c | 8 ++++----
9 files changed, 31 insertions(+), 27 deletions(-)
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index a3006ce23..1d560515c 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -405,8 +405,6 @@ libgnunet_plugin_rest_gns_init (void *cls)
struct GNUNET_REST_Plugin *api;
cfg = cls;
- if (NULL != plugin.cfg)
- return NULL; /* can only initialize once! */
memset (&plugin, 0, sizeof(struct Plugin));
plugin.cfg = cfg;
api = GNUNET_new (struct GNUNET_REST_Plugin);
@@ -437,12 +435,14 @@ void *
libgnunet_plugin_rest_gns_done (void *cls)
{
struct GNUNET_REST_Plugin *api = cls;
- struct Plugin *plugin = api->cls;
+ struct Plugin *plugin;
- plugin->cfg = NULL;
if (NULL != gns)
GNUNET_GNS_disconnect (gns);
+ plugin = api->cls;
+
+ plugin->cfg = NULL;
GNUNET_free (allow_methods);
GNUNET_free (api);
diff --git a/src/identity/plugin_rest_identity.c
b/src/identity/plugin_rest_identity.c
index 6859396d6..5e7d719f0 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -1353,6 +1353,7 @@ libgnunet_plugin_rest_identity_init (void *cls)
MHD_HTTP_METHOD_PUT,
MHD_HTTP_METHOD_DELETE,
MHD_HTTP_METHOD_OPTIONS);
+ state = ID_REST_STATE_INIT;
identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Identity REST API initialized\n"));
diff --git a/src/namestore/plugin_rest_namestore.c
b/src/namestore/plugin_rest_namestore.c
index c993518ea..0d52b5625 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -1065,6 +1065,7 @@ libgnunet_plugin_rest_namestore_init (void *cls)
api->cls = &plugin;
api->name = GNUNET_REST_API_NS_NAMESTORE;
api->process_request = &rest_process_request;
+ state = ID_REST_STATE_INIT;
GNUNET_asprintf (&allow_methods,
"%s, %s, %s, %s, %s",
MHD_HTTP_METHOD_GET,
diff --git a/src/peerinfo-tool/plugin_rest_peerinfo.c
b/src/peerinfo-tool/plugin_rest_peerinfo.c
index 1d7461b1a..669330b39 100644
--- a/src/peerinfo-tool/plugin_rest_peerinfo.c
+++ b/src/peerinfo-tool/plugin_rest_peerinfo.c
@@ -800,6 +800,8 @@ libgnunet_plugin_rest_peerinfo_done (void *cls)
struct Plugin *plugin = api->cls;
plugin->cfg = NULL;
+ if (NULL != peerinfo_handle)
+ GNUNET_PEERINFO_disconnect (peerinfo_handle);
GNUNET_free (allow_methods);
GNUNET_free (api);
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,
// cmp code_challenge code_verifier
code_challenge_len = ntohl (params->code_challenge_len);
+ code_challenge = ((char *) ¶ms[1]);
if (0 != code_challenge_len) /* Only check if this code requires a CV */
{
if (NULL == code_verifier)
@@ -639,7 +640,6 @@ OIDC_parse_authz_code (const struct
GNUNET_CRYPTO_EcdsaPublicKey *audience,
// encode code verifier
GNUNET_STRINGS_base64url_encode (code_verifier_hash, 256 / 8,
&expected_code_challenge);
- code_challenge = ((char *) ¶ms[1]);
GNUNET_free (code_verifier_hash);
if (0 !=
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,
struct GNUNET_RECLAIM_AttestationList *al = NULL;
struct GNUNET_RECLAIM_Ticket ticket;
struct GNUNET_CRYPTO_EcdsaPublicKey cid;
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
struct GNUNET_HashCode cache_key;
struct MHD_Response *resp;
char *grant_type;
@@ -2043,7 +2042,6 @@ token_endpoint (struct GNUNET_REST_RequestHandle
*con_handle,
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- privkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
// REQUIRED code verifier
code_verifier = get_url_parameter_copy (handle, OIDC_CODE_VERIFIER_KEY);
@@ -2590,6 +2588,12 @@ libgnunet_plugin_rest_openid_connect_init (void *cls)
return api;
}
+static int
+cleanup_hashmap (void *cls, const struct GNUNET_HashCode *key, void *value)
+{
+ GNUNET_free (value);
+ return GNUNET_YES;
+}
/**
* Exit point from the plugin.
@@ -2606,18 +2610,13 @@ libgnunet_plugin_rest_openid_connect_done (void *cls)
plugin->cfg = NULL;
- struct GNUNET_CONTAINER_MultiHashMapIterator *hashmap_it;
- void *value = NULL;
- hashmap_it =
- GNUNET_CONTAINER_multihashmap_iterator_create (OIDC_cookie_jar_map);
- while (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_iterator_next (hashmap_it, NULL,
- value))
- GNUNET_free (value);
- GNUNET_CONTAINER_multihashmap_iterator_destroy (hashmap_it);
- GNUNET_CONTAINER_multihashmap_destroy (OIDC_cookie_jar_map);
-
- GNUNET_CONTAINER_multihashmap_iterator_destroy (hashmap_it);
+ if (NULL != OIDC_cookie_jar_map)
+ {
+ GNUNET_CONTAINER_multihashmap_iterate (OIDC_cookie_jar_map,
+ &cleanup_hashmap,
+ NULL);
+ GNUNET_CONTAINER_multihashmap_destroy (OIDC_cookie_jar_map);
+ }
GNUNET_free (allow_methods);
if (NULL != gns_handle)
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,
handle->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
handle->proc_cls = proc_cls;
handle->proc = proc;
- state = ID_REST_STATE_INIT;
handle->rest_handle = rest_handle;
handle->url = GNUNET_strdup (rest_handle->url);
if (handle->url[strlen (handle->url) - 1] == '/')
handle->url[strlen (handle->url) - 1] = '\0';
+ handle->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_timeout, handle);
+
if (GNUNET_NO ==
GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle))
{
@@ -1435,8 +1437,6 @@ rest_identity_process_request (struct
GNUNET_REST_RequestHandle *rest_handle,
return GNUNET_NO;
}
- handle->timeout_task =
- GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_timeout, handle);
return GNUNET_YES;
}
@@ -1470,6 +1470,7 @@ libgnunet_plugin_rest_reclaim_init (void *cls)
MHD_HTTP_METHOD_DELETE,
MHD_HTTP_METHOD_OPTIONS);
identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, NULL);
+ state = ID_REST_STATE_INIT;
idp = GNUNET_RECLAIM_connect (cfg);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
_ ("Identity Provider REST API initialized\n"));
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c
index 8a1c7e32f..e6e03b16d 100644
--- a/src/rest/gnunet-rest-server.c
+++ b/src/rest/gnunet-rest-server.c
@@ -937,7 +937,7 @@ do_shutdown (void *cls)
GNUNET_CONTAINER_DLL_remove (plugins_head,
plugins_tail,
ple);
- GNUNET_PLUGIN_unload (ple->libname, NULL);
+ GNUNET_PLUGIN_unload (ple->libname, ple->plugin);
GNUNET_free (ple->libname);
GNUNET_free (ple);
}
diff --git a/src/rest/plugin_rest_config.c b/src/rest/plugin_rest_config.c
index d9ae57acd..e5d0fffb0 100644
--- a/src/rest/plugin_rest_config.c
+++ b/src/rest/plugin_rest_config.c
@@ -392,15 +392,13 @@ libgnunet_plugin_rest_config_init (void *cls)
cfg = cls;
struct GNUNET_REST_Plugin *api;
- if (NULL != plugin.cfg)
- return NULL; /* can only initialize once! */
memset (&plugin, 0, sizeof(struct Plugin));
plugin.cfg = cfg;
api = GNUNET_new (struct GNUNET_REST_Plugin);
api->cls = &plugin;
api->name = GNUNET_REST_API_NS_CONFIG;
api->process_request = &rest_config_process_request;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("CONFIG REST API initialized\n"));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("CONFIG REST API initialized\n"));
return api;
}
@@ -415,7 +413,9 @@ void *
libgnunet_plugin_rest_config_done (void *cls)
{
struct GNUNET_REST_Plugin *api = cls;
- struct Plugin *plugin = api->cls;
+ struct Plugin *plugin;
+
+ plugin = api->cls;
plugin->cfg = NULL;
GNUNET_free (api);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: -fix rest plugin issues,
gnunet <=