From 4067891ed9f66eb5e47a709d3ea21c2ed36a1e86 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 19 Aug 2021 13:52:16 +0200 Subject: modify lib/ to pass 202 status back to reducer --- src/include/anastasis.h | 12 ++++++++++-- src/lib/anastasis_recovery.c | 19 +++++++++++++++++++ src/testing/testing_api_cmd_keyshare_lookup.c | 2 ++ src/testing/testing_cmd_challenge_answer.c | 4 +++- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/include/anastasis.h b/src/include/anastasis.h index f9782fd..8443eb6 100644 --- a/src/include/anastasis.h +++ b/src/include/anastasis.h @@ -138,7 +138,14 @@ enum ANASTASIS_ChallengeStatus * challenge in time. The request should be repeated * later and may then succeed. */ - ANASTASIS_CHALLENGE_STATUS_AUTH_TIMEOUT + ANASTASIS_CHALLENGE_STATUS_AUTH_TIMEOUT, + + /** + * Plugin-specific ("external") instructions for how to solve the + * challenge are provided. + */ + ANASTASIS_CHALLENGE_STATUS_EXTERNAL_INSTRUCTIONS + }; @@ -166,7 +173,8 @@ struct ANASTASIS_ChallengeStartResponse /** * Challenge details provided if - * @e cs is #ANASTASIS_CHALLENGE_STATUS_INSTRUCTIONS. + * @e cs is #ANASTASIS_CHALLENGE_STATUS_INSTRUCTIONS + * or #ANASTASIS_CHALLENGE_STATUS_EXTERNAL_INSTRUCTIONS. */ struct { diff --git a/src/lib/anastasis_recovery.c b/src/lib/anastasis_recovery.c index f65da8c..4e23db0 100644 --- a/src/lib/anastasis_recovery.c +++ b/src/lib/anastasis_recovery.c @@ -348,6 +348,25 @@ keyshare_lookup_cb (void *cls, = dd->details.server_failure.http_status }; + c->af (c->af_cls, + &csr); + return; + } + case ANASTASIS_KSD_EXTERNAL_CHALLENGE_INSTRUCTIONS: + { + struct ANASTASIS_ChallengeStartResponse csr = { + .cs = ANASTASIS_CHALLENGE_STATUS_EXTERNAL_INSTRUCTIONS, + .challenge = c, + .details.open_challenge.body + = dd->details.open_challenge.body, + .details.open_challenge.content_type + = dd->details.open_challenge.content_type, + .details.open_challenge.body_size + = dd->details.open_challenge.body_size, + .details.open_challenge.http_status + = dd->details.open_challenge.http_status + }; + c->af (c->af_cls, &csr); return; diff --git a/src/testing/testing_api_cmd_keyshare_lookup.c b/src/testing/testing_api_cmd_keyshare_lookup.c index c9f8e45..04ecf43 100644 --- a/src/testing/testing_api_cmd_keyshare_lookup.c +++ b/src/testing/testing_api_cmd_keyshare_lookup.c @@ -206,6 +206,8 @@ keyshare_lookup_cb (void *cls, break; case ANASTASIS_KSD_AUTHENTICATION_TIMEOUT: break; + case ANASTASIS_KSD_EXTERNAL_CHALLENGE_INSTRUCTIONS: + break; } TALER_TESTING_interpreter_next (ksls->is); } diff --git a/src/testing/testing_cmd_challenge_answer.c b/src/testing/testing_cmd_challenge_answer.c index d7d11a1..ff897f3 100644 --- a/src/testing/testing_cmd_challenge_answer.c +++ b/src/testing/testing_cmd_challenge_answer.c @@ -1,6 +1,6 @@ /* This file is part of Anastasis - Copyright (C) 2020 Anastasis SARL + Copyright (C) 2020, 2021 Anastasis SARL Anastasis is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -239,6 +239,8 @@ challenge_answer_cb (void *af_cls, break; case ANASTASIS_CHALLENGE_STATUS_AUTH_TIMEOUT: break; + case ANASTASIS_CHALLENGE_STATUS_EXTERNAL_INSTRUCTIONS: + break; } TALER_TESTING_interpreter_next (cs->is); } -- cgit v1.2.3