diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-09-10 19:49:36 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-09-10 19:49:36 +0200 |
commit | 002fd47ecdcaf4541a943b75332285dacf64f52f (patch) | |
tree | 36cd392f781d2d1ee1f2b53962f941c9bc0e71a0 | |
parent | 95fe2019571144b88372e57a820c439a5c7f1e61 (diff) |
-fix NPE
-rw-r--r-- | src/backend/taler-merchant-httpd.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index dfffa36d..17e50dbc 100644 --- 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) |