aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-27 21:04:17 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-27 21:04:17 +0100
commit0920fe0f15e563e4beaa0e0c5c814a87163631ca (patch)
tree4b9965d6aa3e7da4499da766ff671e6ee7c64a68
parent7d93e843f3b1cc41bb5d336d6ab785ae8360a85f (diff)
downloadanastasis-0920fe0f15e563e4beaa0e0c5c814a87163631ca.tar.gz
anastasis-0920fe0f15e563e4beaa0e0c5c814a87163631ca.zip
fix #7036
m---------contrib/gana0
-rw-r--r--src/reducer/anastasis_api_recovery_redux.c27
-rw-r--r--src/reducer/anastasis_api_redux.c7
3 files changed, 28 insertions, 6 deletions
diff --git a/contrib/gana b/contrib/gana
Subproject f126ffd32255c68f4fbef5e9ef849ef04855b0a Subproject b0dd85e8187f33a1f92dd5eb31082050d333e16
diff --git a/src/reducer/anastasis_api_recovery_redux.c b/src/reducer/anastasis_api_recovery_redux.c
index 050a5b1..a26b6ad 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -2385,22 +2385,26 @@ core_early_secret_cb (void *cls,
2385 * @param provider_url the provider to lookup config info from 2385 * @param provider_url the provider to lookup config info from
2386 * @param type the method to lookup the cost of 2386 * @param type the method to lookup the cost of
2387 * @param[out] cost the recovery cost to return 2387 * @param[out] cost the recovery cost to return
2388 * @param[out] ec set to the error code
2388 * @return #GNUNET_OK on success, #GNUNET_NO if not found, #GNUNET_SYSERR on state error 2389 * @return #GNUNET_OK on success, #GNUNET_NO if not found, #GNUNET_SYSERR on state error
2389 */ 2390 */
2390static int 2391static enum GNUNET_GenericReturnValue
2391lookup_cost (const json_t *state, 2392lookup_cost (const json_t *state,
2392 const char *provider_url, 2393 const char *provider_url,
2393 const char *type, 2394 const char *type,
2394 struct TALER_Amount *cost) 2395 struct TALER_Amount *cost,
2396 enum TALER_ErrorCode *ec)
2395{ 2397{
2396 const json_t *providers; 2398 const json_t *providers;
2397 const json_t *provider; 2399 const json_t *provider;
2398 const json_t *methods; 2400 const json_t *methods;
2399 2401
2402 *ec = TALER_EC_NONE;
2400 providers = json_object_get (state, 2403 providers = json_object_get (state,
2401 "authentication_providers"); 2404 "authentication_providers");
2402 if (NULL == providers) 2405 if (NULL == providers)
2403 { 2406 {
2407 *ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID;
2404 GNUNET_break (0); 2408 GNUNET_break (0);
2405 return GNUNET_SYSERR; 2409 return GNUNET_SYSERR;
2406 } 2410 }
@@ -2408,14 +2412,24 @@ lookup_cost (const json_t *state,
2408 provider_url); 2412 provider_url);
2409 if (NULL == provider) 2413 if (NULL == provider)
2410 { 2414 {
2415 *ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID;
2411 GNUNET_break (0); 2416 GNUNET_break (0);
2412 return GNUNET_SYSERR; 2417 return GNUNET_SYSERR;
2413 } 2418 }
2419 if (MHD_HTTP_OK !=
2420 json_integer_value (json_object_get (provider,
2421 "http_status")))
2422 {
2423 *ec = json_integer_value (json_object_get (provider,
2424 "error_code"));
2425 return GNUNET_SYSERR;
2426 }
2414 methods = json_object_get (provider, 2427 methods = json_object_get (provider,
2415 "methods"); 2428 "methods");
2416 if ( (NULL == methods) || 2429 if ( (NULL == methods) ||
2417 (! json_is_array (methods)) ) 2430 (! json_is_array (methods)) )
2418 { 2431 {
2432 *ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID;
2419 GNUNET_break (0); 2433 GNUNET_break (0);
2420 return GNUNET_SYSERR; 2434 return GNUNET_SYSERR;
2421 } 2435 }
@@ -2439,6 +2453,7 @@ lookup_cost (const json_t *state,
2439 NULL, NULL)) 2453 NULL, NULL))
2440 { 2454 {
2441 GNUNET_break (0); 2455 GNUNET_break (0);
2456 *ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID;
2442 continue; 2457 continue;
2443 } 2458 }
2444 if (0 == strcmp (t, 2459 if (0 == strcmp (t,
@@ -2565,20 +2580,22 @@ policy_lookup_cb (void *cls,
2565 const struct ANASTASIS_ChallengeDetails *cd; 2580 const struct ANASTASIS_ChallengeDetails *cd;
2566 json_t *cj; 2581 json_t *cj;
2567 struct TALER_Amount cost; 2582 struct TALER_Amount cost;
2568 int ret; 2583 enum GNUNET_GenericReturnValue ret;
2584 enum TALER_ErrorCode ec;
2569 2585
2570 cd = ANASTASIS_challenge_get_details (c); 2586 cd = ANASTASIS_challenge_get_details (c);
2571 ret = lookup_cost (rss->state, 2587 ret = lookup_cost (rss->state,
2572 cd->provider_url, 2588 cd->provider_url,
2573 cd->type, 2589 cd->type,
2574 &cost); 2590 &cost,
2591 &ec);
2575 if (GNUNET_SYSERR == ret) 2592 if (GNUNET_SYSERR == ret)
2576 { 2593 {
2577 json_decref (challenges); 2594 json_decref (challenges);
2578 json_decref (policies); 2595 json_decref (policies);
2579 ANASTASIS_redux_fail_ (rss->cb, 2596 ANASTASIS_redux_fail_ (rss->cb,
2580 rss->cb_cls, 2597 rss->cb_cls,
2581 TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, 2598 ec,
2582 "failed to 'lookup_cost'"); 2599 "failed to 'lookup_cost'");
2583 free_rss (rss); 2600 free_rss (rss);
2584 return; 2601 return;
diff --git a/src/reducer/anastasis_api_redux.c b/src/reducer/anastasis_api_redux.c
index 11dc678..66aabe1 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -574,7 +574,12 @@ config_cb (void *cls,
574 cr->tt = NULL; 574 cr->tt = NULL;
575 cr->http_status = http_status; 575 cr->http_status = http_status;
576 if (MHD_HTTP_OK != http_status) 576 if (MHD_HTTP_OK != http_status)
577 cr->ec = TALER_EC_ANASTASIS_REDUCER_PROVIDER_CONFIG_FAILED; 577 {
578 if (0 == http_status)
579 cr->ec = TALER_EC_ANASTASIS_GENERIC_PROVIDER_UNREACHABLE;
580 else
581 cr->ec = TALER_EC_ANASTASIS_REDUCER_PROVIDER_CONFIG_FAILED;
582 }
578 if ( (MHD_HTTP_OK == http_status) && 583 if ( (MHD_HTTP_OK == http_status) &&
579 (NULL == acfg) ) 584 (NULL == acfg) )
580 { 585 {