diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2022-07-21 09:37:37 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2022-07-21 09:37:37 +0200 |
commit | e853576ca26825273acf7b7cf92a9a43b6b47be7 (patch) | |
tree | fd1d24624c5710ea566cbd0bbc8c4bd41c8e40a3 /src/backend | |
parent | 6ea6a9ae8ed3535bddb8c11b15dc9ebc6f68aec1 (diff) |
apply access control override logic also to /instances/default path
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/taler-merchant-httpd.c | 28 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd.h | 7 |
2 files changed, 23 insertions, 12 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index 94213556..43e945b2 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -241,15 +241,7 @@ TMH_instance_decref (struct TMH_MerchantInstance *mi) } -/** - * Callback that frees an instances removing - * it from the global hashmap. - * - * @param cls closure, NULL - * @param key current key - * @param value a `struct TMH_MerchantInstance` - */ -int +enum GNUNET_GenericReturnValue TMH_instance_free_cb (void *cls, const struct GNUNET_HashCode *key, void *value) @@ -1169,6 +1161,24 @@ url_handler (void *cls, instance_id = GNUNET_strndup (istart, slash - istart); hc->instance = TMH_lookup_instance (instance_id); + if ( (NULL == hc->instance) && + (0 == strcmp ("default", + instance_id)) ) + hc->instance = TMH_lookup_instance (NULL); + if ( (0 == strcmp ("default", + instance_id)) && + (NULL != TMH_default_auth) && + (NULL != hc->instance) ) + { + /* Override default instance access control */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Overriding access control\n"); + TMH_compute_auth (TMH_default_auth, + &hc->instance->auth.auth_salt, + &hc->instance->auth.auth_hash); + hc->instance->auth_override = true; + GNUNET_free (TMH_default_auth); + } GNUNET_free (instance_id); if (NULL == slash) url = ""; diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h index da1a6127..2e9f89fa 100644 --- a/src/backend/taler-merchant-httpd.h +++ b/src/backend/taler-merchant-httpd.h @@ -626,11 +626,12 @@ extern char *TMH_default_auth; * Callback that frees an instances removing * it from the global hashmap. * - * @param cls closure, NULL - * @param key current key + * @param cls closure, pass NULL + * @param key current key (ignored) * @param value a `struct TMH_MerchantInstance` + * @return #GNUNET_YES (always) */ -int +enum GNUNET_GenericReturnValue TMH_instance_free_cb (void *cls, const struct GNUNET_HashCode *key, void *value); |