diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-15 11:53:51 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-15 11:53:51 +0200 |
commit | eabd8e45715a2d2c76f8eb8a99e09981b8a1b254 (patch) | |
tree | 02a8e573b15a5a4d7ecc806b12bdf524d50f5638 /src/restclient | |
parent | 7d9f1fbec3fcf1d38fe7d7cf89dfb7b8d8128775 (diff) | |
download | anastasis-eabd8e45715a2d2c76f8eb8a99e09981b8a1b254.tar.gz anastasis-eabd8e45715a2d2c76f8eb8a99e09981b8a1b254.tar.bz2 anastasis-eabd8e45715a2d2c76f8eb8a99e09981b8a1b254.zip |
-note left-over todos
Diffstat (limited to 'src/restclient')
-rw-r--r-- | src/restclient/anastasis_api_keyshare_lookup.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/restclient/anastasis_api_keyshare_lookup.c b/src/restclient/anastasis_api_keyshare_lookup.c index 6df00dd..bb463b6 100644 --- a/src/restclient/anastasis_api_keyshare_lookup.c +++ b/src/restclient/anastasis_api_keyshare_lookup.c @@ -150,16 +150,30 @@ handle_keyshare_lookup_finished (void *cls, { GNUNET_break_op (0); kdd.status = ANASTASIS_KSD_SERVER_ERROR; + kdd.details.server_failure.http_status = MHD_HTTP_ACCEPTED; + kdd.details.server_failure.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; } /* Success, call callback with all details! */ memcpy (&kdd.details.eks, data, data_size); - kslo->cb (kslo->cb_cls, - &kdd); - ANASTASIS_keyshare_lookup_cancel (kslo); - return; + break; + case MHD_HTTP_ACCEPTED: + kdd.details.external_challenge = json_loadb (data, + data_size, + JSON_REJECT_DUPLICATES, + NULL); + if (NULL == kdd.details.external_challenge) + { + GNUNET_break_op (0); + kdd.status = ANASTASIS_KSD_SERVER_ERROR; + kdd.details.server_failure.http_status = MHD_HTTP_ACCEPTED; + kdd.details.server_failure.ec = TALER_EC_GENERIC_INVALID_RESPONSE; + break; + } + kdd.status = ANASTASIS_KSD_EXTERNAL_CHALLENGE_INSTRUCTIONS; + break; case MHD_HTTP_BAD_REQUEST: /* This should never happen, either us or the anastasis server is buggy (or API version conflict); just pass JSON reply to the application */ @@ -206,24 +220,16 @@ handle_keyshare_lookup_finished (void *cls, /* Nothing really to verify, authentication required/failed */ kdd.status = ANASTASIS_KSD_REDIRECT_FOR_AUTHENTICATION; kdd.details.redirect_url = kslo->location; - kslo->cb (kslo->cb_cls, - &kdd); - ANASTASIS_keyshare_lookup_cancel (kslo); - return; + break; case MHD_HTTP_ALREADY_REPORTED: case MHD_HTTP_FORBIDDEN: /* Nothing really to verify, authentication required/failed */ - { - kdd.status = ANASTASIS_KSD_INVALID_ANSWER; - kdd.details.open_challenge.body = data; - kdd.details.open_challenge.body_size = data_size; - kdd.details.open_challenge.content_type = kslo->content_type; - kdd.details.open_challenge.http_status = response_code; - kslo->cb (kslo->cb_cls, - &kdd); - } - ANASTASIS_keyshare_lookup_cancel (kslo); - return; + kdd.status = ANASTASIS_KSD_INVALID_ANSWER; + kdd.details.open_challenge.body = data; + kdd.details.open_challenge.body_size = data_size; + kdd.details.open_challenge.content_type = kslo->content_type; + kdd.details.open_challenge.http_status = response_code; + break; case MHD_HTTP_NOT_FOUND: /* Nothing really to verify */ kdd.status = ANASTASIS_KSD_TRUTH_UNKNOWN; |