commit 002fd47ecdcaf4541a943b75332285dacf64f52f
parent 95fe2019571144b88372e57a820c439a5c7f1e61
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 10 Sep 2023 19:49:36 +0200
-fix NPE
Diffstat:
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
@@ -1814,10 +1814,18 @@ url_handler (void *cls,
(! auth_malformed) &&
(0 == strcmp (auth,
TMH_default_auth)) );
- hc->auth_scope = auth_ok
- ? TMH_AS_ALL
- : TMH_check_token (auth,
- hc->instance->settings.id);
+ if (auth_ok)
+ {
+ hc->auth_scope = TMH_AS_ALL;
+ }
+ else
+ {
+ if (NULL != hc->instance)
+ hc->auth_scope = TMH_check_token (auth,
+ hc->instance->settings.id);
+ else
+ hc->auth_scope = TMH_AS_NONE;
+ }
/* We grant access if:
- scope is 'all'
- rh has an explicit non-NONE scope that matches
@@ -1829,8 +1837,8 @@ url_handler (void *cls,
(0 == strcmp (MHD_HTTP_METHOD_GET,
method)) ) ) )
{
- if ( auth_malformed &&
- (TMH_AS_NONE == hc->auth_scope) )
+ if (auth_malformed &&
+ (TMH_AS_NONE == hc->auth_scope) )
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_UNAUTHORIZED,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -1930,7 +1938,7 @@ add_instance_cb (void *cls,
{
struct TMH_MerchantInstance *mi;
enum GNUNET_DB_QueryStatus qs;
-
+
(void) cls;
mi = TMH_lookup_instance (is->id);
if (NULL != mi)