#include "gnunet_gnsrecord_lib.h"
#include "gnunet_identity_service.h"
#include "gnunet_namestore_service.h"
-#include "gnunet_reclaim_attribute_lib.h"
+#include "gnunet_reclaim_lib.h"
#include "gnunet_reclaim_service.h"
#include "gnunet_rest_lib.h"
#include "gnunet_rest_plugin.h"
cleanup_handle (struct RequestHandle *handle)
{
struct EgoEntry *ego_entry;
- struct EgoEntry *ego_tmp;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
if (NULL != handle->timeout_task)
GNUNET_RECLAIM_get_attestations_stop (handle->attest_it);
if (NULL != handle->ticket_it)
GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it);
+ if (NULL != handle->idp_op)
+ GNUNET_RECLAIM_cancel (handle->idp_op);
if (NULL != handle->idp)
GNUNET_RECLAIM_disconnect (handle->idp);
GNUNET_free_non_null (handle->url);
json_decref (handle->oidc->response);
GNUNET_free (handle->oidc);
}
- GNUNET_RECLAIM_attribute_list_destroy (handle->attr_list);
- GNUNET_RECLAIM_attestation_list_destroy (handle->attests_list);
+ if (NULL!=handle->attr_list)
+ GNUNET_RECLAIM_attribute_list_destroy (handle->attr_list);
+ if (NULL!=handle->attests_list)
+ GNUNET_RECLAIM_attestation_list_destroy (handle->attests_list);
- for (ego_entry = handle->ego_head; NULL != ego_entry;)
+ while (NULL != (ego_entry = handle->ego_head))
{
- ego_tmp = ego_entry;
- ego_entry = ego_entry->next;
- GNUNET_free (ego_tmp->identifier);
- GNUNET_free (ego_tmp->keystring);
- GNUNET_free (ego_tmp);
+ GNUNET_CONTAINER_DLL_remove (handle->ego_head,
+ handle->ego_tail,
+ ego_entry);
+ GNUNET_free_non_null (ego_entry->identifier);
+ GNUNET_free_non_null (ego_entry->keystring);
+ GNUNET_free (ego_entry);
}
GNUNET_free (handle);
}
ticket_str =
GNUNET_STRINGS_data_to_string_alloc (&handle->ticket,
sizeof(struct GNUNET_RECLAIM_Ticket));
- // TODO change if more attributes are needed (see max_age)
code_string = OIDC_build_authz_code (&handle->priv_key,
&handle->ticket,
handle->attr_list,
}
}
handle->oidc->scope = get_url_parameter_copy (handle, OIDC_SCOPE_KEY);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Scope: %s\n",GNUNET_strdup (
- handle->oidc->scope));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Scope: %s\n", handle->oidc->scope);
if (NULL == handle->tld)
GNUNET_CONFIGURATION_iterate_section_values (cfg, "gns", tld_iter, handle);
if (NULL == handle->tld)
struct RequestHandle *handle = cls;
const struct EgoEntry *ego_entry;
struct GNUNET_TIME_Relative expiration_time;
- struct GNUNET_RECLAIM_AttributeList *cl;
- struct GNUNET_RECLAIM_AttestationList *al;
+ struct GNUNET_RECLAIM_AttributeList *cl = NULL;
+ struct GNUNET_RECLAIM_AttestationList *al = NULL;
struct GNUNET_RECLAIM_Ticket ticket;
struct GNUNET_CRYPTO_EcdsaPublicKey cid;
const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
const struct GNUNET_RECLAIM_Attestation *attest)
{
struct RequestHandle *handle = cls;
+ handle->idp_op = NULL;
+
if (NULL == identity)
{
GNUNET_SCHEDULER_add_now (&return_userinfo_response, handle);
for (ego_entry = handle->ego_head; NULL != ego_entry;
ego_entry = ego_entry->next)
{
- if (ego_entry->ego == ego)
- break;
- }
- if (NULL != ego_entry)
+ if (ego_entry->ego != ego)
+ continue;
GNUNET_CONTAINER_DLL_remove (handle->ego_head,
handle->ego_tail,
ego_entry);
+ GNUNET_free (ego_entry->identifier);
+ GNUNET_free (ego_entry->keystring);
+ GNUNET_free (ego_entry);
+ return;
+ }
}
}
handle->oidc = GNUNET_new (struct OIDC_Variables);
if (NULL == OIDC_cookie_jar_map)
- OIDC_cookie_jar_map = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
+ OIDC_cookie_jar_map = GNUNET_CONTAINER_multihashmap_create (10,
+ GNUNET_NO);
if (NULL == OIDC_access_token_map)
OIDC_access_token_map =
GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
/**
- * Entry point for the plugin.
- *
- * @param cls Config info
- * @return NULL on error, otherwise the plugin context
- */
+ * Entry point for the plugin.
+ *
+ * @param cls Config info
+ * @return NULL on error, otherwise the plugin context
+ */
void *
libgnunet_plugin_rest_openid_connect_init (void *cls)
{
cfg = cls;
if (NULL != plugin.cfg)
- return NULL; /* can only initialize once! */
+ return NULL; /* can only initialize once! */
memset (&plugin, 0, sizeof(struct Plugin));
plugin.cfg = cfg;
api = GNUNET_new (struct GNUNET_REST_Plugin);
/**
- * Exit point from the plugin.
- *
- * @param cls the plugin context (as returned by "init")
- * @return always NULL
- */
+ * Exit point from the plugin.
+ *
+ * @param cls the plugin context (as returned by "init")
+ * @return always NULL
+ */
void *
libgnunet_plugin_rest_openid_connect_done (void *cls)
{
hashmap_it =
GNUNET_CONTAINER_multihashmap_iterator_create (OIDC_cookie_jar_map);
while (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_iterator_next (hashmap_it, NULL, value))
+ GNUNET_CONTAINER_multihashmap_iterator_next (hashmap_it, NULL,
+ value))
GNUNET_free_non_null (value);
GNUNET_CONTAINER_multihashmap_iterator_destroy (hashmap_it);
GNUNET_CONTAINER_multihashmap_destroy (OIDC_cookie_jar_map);
hashmap_it =
GNUNET_CONTAINER_multihashmap_iterator_create (OIDC_access_token_map);
while (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_iterator_next (hashmap_it, NULL, value))
+ GNUNET_CONTAINER_multihashmap_iterator_next (hashmap_it, NULL,
+ value))
GNUNET_free_non_null (value);
GNUNET_CONTAINER_multihashmap_destroy (OIDC_access_token_map);
GNUNET_CONTAINER_multihashmap_iterator_destroy (hashmap_it);