summaryrefslogtreecommitdiff
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.tar.bz2
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,
* @param provider_url the provider to lookup config info from
* @param type the method to lookup the cost of
* @param[out] cost the recovery cost to return
+ * @param[out] ec set to the error code
* @return #GNUNET_OK on success, #GNUNET_NO if not found, #GNUNET_SYSERR on state error
*/
-static int
+static enum GNUNET_GenericReturnValue
lookup_cost (const json_t *state,
const char *provider_url,
const char *type,
- struct TALER_Amount *cost)
+ struct TALER_Amount *cost,
+ enum TALER_ErrorCode *ec)
{
const json_t *providers;
const json_t *provider;
const json_t *methods;
+ *ec = TALER_EC_NONE;
providers = json_object_get (state,
"authentication_providers");
if (NULL == providers)
{
+ *ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID;
GNUNET_break (0);
return GNUNET_SYSERR;
}
@@ -2408,14 +2412,24 @@ lookup_cost (const json_t *state,
provider_url);
if (NULL == provider)
{
+ *ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID;
GNUNET_break (0);
return GNUNET_SYSERR;
}
+ if (MHD_HTTP_OK !=
+ json_integer_value (json_object_get (provider,
+ "http_status")))
+ {
+ *ec = json_integer_value (json_object_get (provider,
+ "error_code"));
+ return GNUNET_SYSERR;
+ }
methods = json_object_get (provider,
"methods");
if ( (NULL == methods) ||
(! json_is_array (methods)) )
{
+ *ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID;
GNUNET_break (0);
return GNUNET_SYSERR;
}
@@ -2439,6 +2453,7 @@ lookup_cost (const json_t *state,
NULL, NULL))
{
GNUNET_break (0);
+ *ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID;
continue;
}
if (0 == strcmp (t,
@@ -2565,20 +2580,22 @@ policy_lookup_cb (void *cls,
const struct ANASTASIS_ChallengeDetails *cd;
json_t *cj;
struct TALER_Amount cost;
- int ret;
+ enum GNUNET_GenericReturnValue ret;
+ enum TALER_ErrorCode ec;
cd = ANASTASIS_challenge_get_details (c);
ret = lookup_cost (rss->state,
cd->provider_url,
cd->type,
- &cost);
+ &cost,
+ &ec);
if (GNUNET_SYSERR == ret)
{
json_decref (challenges);
json_decref (policies);
ANASTASIS_redux_fail_ (rss->cb,
rss->cb_cls,
- TALER_EC_ANASTASIS_REDUCER_STATE_INVALID,
+ ec,
"failed to 'lookup_cost'");
free_rss (rss);
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,
cr->tt = NULL;
cr->http_status = http_status;
if (MHD_HTTP_OK != http_status)
- cr->ec = TALER_EC_ANASTASIS_REDUCER_PROVIDER_CONFIG_FAILED;
+ {
+ if (0 == http_status)
+ cr->ec = TALER_EC_ANASTASIS_GENERIC_PROVIDER_UNREACHABLE;
+ else
+ cr->ec = TALER_EC_ANASTASIS_REDUCER_PROVIDER_CONFIG_FAILED;
+ }
if ( (MHD_HTTP_OK == http_status) &&
(NULL == acfg) )
{