gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] 01/02: apply access control override logic also to /ins


From: gnunet
Subject: [taler-merchant] 01/02: apply access control override logic also to /instances/default path
Date: Thu, 21 Jul 2022 12:32:24 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

commit e853576ca26825273acf7b7cf92a9a43b6b47be7
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Thu Jul 21 09:37:37 2022 +0200

    apply access control override logic also to /instances/default path
---
 src/backend/taler-merchant-httpd.c | 28 +++++++++++++++++++---------
 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);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]