diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-06-22 20:19:43 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-06-22 20:19:43 +0200 |
commit | 599c31dff16d2e85898cd6d69c65e338e2c54447 (patch) | |
tree | 57295c132ea0f4ad327a41335644338608f2d899 | |
parent | 84303b044db07e351e99c0338260ecea23012ec6 (diff) | |
download | gnunet-599c31dff16d2e85898cd6d69c65e338e2c54447.tar.gz gnunet-599c31dff16d2e85898cd6d69c65e338e2c54447.zip |
-also clear cache on lookup success
-rw-r--r-- | src/reclaim/plugin_rest_openid_connect.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c index 769ce553f..8eb30aded 100644 --- a/src/reclaim/plugin_rest_openid_connect.c +++ b/src/reclaim/plugin_rest_openid_connect.c | |||
@@ -2448,13 +2448,32 @@ consume_ticket (void *cls, | |||
2448 | struct GNUNET_RECLAIM_AttributeListEntry *ale; | 2448 | struct GNUNET_RECLAIM_AttributeListEntry *ale; |
2449 | struct GNUNET_RECLAIM_PresentationListEntry *atle; | 2449 | struct GNUNET_RECLAIM_PresentationListEntry *atle; |
2450 | struct MHD_Response *resp; | 2450 | struct MHD_Response *resp; |
2451 | struct GNUNET_HashCode cache_key; | ||
2451 | char *result_str; | 2452 | char *result_str; |
2453 | char *cached_code; | ||
2452 | 2454 | ||
2453 | if (NULL != handle->consume_timeout_op) | 2455 | if (NULL != handle->consume_timeout_op) |
2454 | GNUNET_SCHEDULER_cancel (handle->consume_timeout_op); | 2456 | GNUNET_SCHEDULER_cancel (handle->consume_timeout_op); |
2455 | handle->consume_timeout_op = NULL; | 2457 | handle->consume_timeout_op = NULL; |
2456 | handle->idp_op = NULL; | 2458 | handle->idp_op = NULL; |
2457 | 2459 | ||
2460 | /** | ||
2461 | * We received a reply. In any case clear the cache. | ||
2462 | */ | ||
2463 | GNUNET_CRYPTO_hash (handle->access_token, | ||
2464 | strlen (handle->access_token), | ||
2465 | &cache_key); | ||
2466 | cached_code = GNUNET_CONTAINER_multihashmap_get (oidc_code_cache, | ||
2467 | &cache_key); | ||
2468 | if (NULL != cached_code) | ||
2469 | { | ||
2470 | GNUNET_CONTAINER_multihashmap_remove (oidc_code_cache, | ||
2471 | &cache_key, | ||
2472 | cached_code); | ||
2473 | GNUNET_free (cached_code); | ||
2474 | } | ||
2475 | |||
2476 | |||
2458 | if (NULL == identity) | 2477 | if (NULL == identity) |
2459 | { | 2478 | { |
2460 | result_str = OIDC_generate_userinfo (&handle->ticket.identity, | 2479 | result_str = OIDC_generate_userinfo (&handle->ticket.identity, |