aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2022-04-06 14:32:53 +0200
committerChristian Grothoff <grothoff@gnunet.org>2022-04-06 14:32:53 +0200
commite9c63cf3194aacb950026bec8ff2201f1d1f5418 (patch)
tree02115e9216f058cb2de582adcffe06019cb5d87e
parent979b9ed5f672a74ec06c0c330f80e28c842e4e29 (diff)
downloadanastasis-e9c63cf3194aacb950026bec8ff2201f1d1f5418.tar.gz
anastasis-e9c63cf3194aacb950026bec8ff2201f1d1f5418.zip
fix #7218 and #7219
-rw-r--r--src/backend/anastasis-httpd_truth-challenge.c9
-rw-r--r--src/include/anastasis.h5
-rw-r--r--src/include/anastasis_service.h6
-rw-r--r--src/lib/anastasis_recovery.c3
-rw-r--r--src/reducer/anastasis_api_recovery_redux.c29
-rw-r--r--src/restclient/anastasis_api_truth_challenge.c6
-rw-r--r--src/testing/testing_api_cmd_truth_challenge.c2
-rw-r--r--src/testing/testing_cmd_challenge_answer.c3
8 files changed, 59 insertions, 4 deletions
diff --git a/src/backend/anastasis-httpd_truth-challenge.c b/src/backend/anastasis-httpd_truth-challenge.c
index b03c883..98ae524 100644
--- a/src/backend/anastasis-httpd_truth-challenge.c
+++ b/src/backend/anastasis-httpd_truth-challenge.c
@@ -1295,10 +1295,11 @@ AH_handler_truth_challenge (
1295 { 1295 {
1296 /* Too early for a retransmission! */ 1296 /* Too early for a retransmission! */
1297 GNUNET_free (decrypted_truth); 1297 GNUNET_free (decrypted_truth);
1298 return TALER_MHD_reply_with_error (gc->connection, 1298 return TALER_MHD_REPLY_JSON_PACK (
1299 MHD_HTTP_ALREADY_REPORTED, 1299 gc->connection,
1300 TALER_EC_ANASTASIS_TRUTH_CHALLENGE_ACTIVE, 1300 MHD_HTTP_OK,
1301 NULL); 1301 GNUNET_JSON_pack_string ("challenge_type",
1302 "TAN_ALREADY_SENT"));
1302 } 1303 }
1303 } 1304 }
1304 1305
diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index 90f3f5d..473756f 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -126,6 +126,11 @@ enum ANASTASIS_ChallengeStartStatus
126 ANASTASIS_CHALLENGE_START_STATUS_TAN_SENT_HINT_PROVIDED, 126 ANASTASIS_CHALLENGE_START_STATUS_TAN_SENT_HINT_PROVIDED,
127 127
128 /** 128 /**
129 * A TAN has been sent before.
130 */
131 ANASTASIS_CHALLENGE_START_STATUS_TAN_ALREADY_SENT,
132
133 /**
129 * Wire transfer required, banking details provided. 134 * Wire transfer required, banking details provided.
130 */ 135 */
131 ANASTASIS_CHALLENGE_START_STATUS_BANK_TRANSFER_REQUIRED 136 ANASTASIS_CHALLENGE_START_STATUS_BANK_TRANSFER_REQUIRED
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index e88b7e0..8af0f07 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -596,6 +596,12 @@ enum ANASTASIS_ChallengeDetailType
596 ANASTASIS_CS_TAN_SENT, 596 ANASTASIS_CS_TAN_SENT,
597 597
598 /** 598 /**
599 * A challenge TAN was already recently sent to the customer.
600 * A hint may be provided as to the address used.
601 */
602 ANASTASIS_CS_TAN_ALREADY_SENT,
603
604 /**
599 * The customer should wire funds to the bank 605 * The customer should wire funds to the bank
600 * account address provided. 606 * account address provided.
601 */ 607 */
diff --git a/src/lib/anastasis_recovery.c b/src/lib/anastasis_recovery.c
index b70061d..c425398 100644
--- a/src/lib/anastasis_recovery.c
+++ b/src/lib/anastasis_recovery.c
@@ -286,6 +286,9 @@ truth_challenge_cb (void *cls,
286 csr.details.tan_address_hint 286 csr.details.tan_address_hint
287 = tcd->details.success.details.tan_address_hint; 287 = tcd->details.success.details.tan_address_hint;
288 break; 288 break;
289 case ANASTASIS_CS_TAN_ALREADY_SENT:
290 csr.cs = ANASTASIS_CHALLENGE_START_STATUS_TAN_ALREADY_SENT;
291 break;
289 case ANASTASIS_CS_WIRE_FUNDS: 292 case ANASTASIS_CS_WIRE_FUNDS:
290 csr.cs = ANASTASIS_CHALLENGE_START_STATUS_BANK_TRANSFER_REQUIRED; 293 csr.cs = ANASTASIS_CHALLENGE_START_STATUS_BANK_TRANSFER_REQUIRED;
291 csr.details.bank_transfer_required 294 csr.details.bank_transfer_required
diff --git a/src/reducer/anastasis_api_recovery_redux.c b/src/reducer/anastasis_api_recovery_redux.c
index e08c7e7..a8083f2 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -593,6 +593,35 @@ start_feedback_cb (
593 sctx->state); 593 sctx->state);
594 sctx_free (sctx); 594 sctx_free (sctx);
595 return; 595 return;
596
597 case ANASTASIS_CHALLENGE_START_STATUS_TAN_ALREADY_SENT:
598 {
599 json_t *instructions;
600 char *hint;
601
602 GNUNET_asprintf (&hint,
603 _ ("TAN code already sent."));
604 instructions = GNUNET_JSON_PACK (
605 GNUNET_JSON_pack_string ("state",
606 "send-to-address"),
607 GNUNET_JSON_pack_string ("display_hint",
608 hint),
609 GNUNET_JSON_pack_uint64 ("http_status",
610 (json_int_t) csr->http_status));
611 GNUNET_free (hint);
612 GNUNET_assert (0 ==
613 json_object_set_new (feedback,
614 uuid,
615 instructions));
616 }
617 set_state (sctx->state,
618 ANASTASIS_RECOVERY_STATE_CHALLENGE_SOLVING);
619 sctx->cb (sctx->cb_cls,
620 TALER_EC_NONE,
621 sctx->state);
622 sctx_free (sctx);
623 return;
624
596 case ANASTASIS_CHALLENGE_START_STATUS_PAYMENT_REQUIRED: 625 case ANASTASIS_CHALLENGE_START_STATUS_PAYMENT_REQUIRED:
597 { 626 {
598 json_t *pay; 627 json_t *pay;
diff --git a/src/restclient/anastasis_api_truth_challenge.c b/src/restclient/anastasis_api_truth_challenge.c
index 76e9ec5..606bcfb 100644
--- a/src/restclient/anastasis_api_truth_challenge.c
+++ b/src/restclient/anastasis_api_truth_challenge.c
@@ -161,6 +161,12 @@ handle_truth_challenge_finished (void *cls,
161 tcd.details.success.details.tan_address_hint = tan_hint; 161 tcd.details.success.details.tan_address_hint = tan_hint;
162 break; 162 break;
163 } 163 }
164 if (0 == strcmp (ct,
165 "TAN_ALREADY_SENT"))
166 {
167 tcd.details.success.cs = ANASTASIS_CS_TAN_ALREADY_SENT;
168 break;
169 }
164 if ( (0 == strcmp (ct, 170 if ( (0 == strcmp (ct,
165 "FILE_WRITTEN")) && 171 "FILE_WRITTEN")) &&
166 (NULL != filename) ) 172 (NULL != filename) )
diff --git a/src/testing/testing_api_cmd_truth_challenge.c b/src/testing/testing_api_cmd_truth_challenge.c
index c584d5f..f1384c4 100644
--- a/src/testing/testing_api_cmd_truth_challenge.c
+++ b/src/testing/testing_api_cmd_truth_challenge.c
@@ -153,6 +153,8 @@ truth_challenge_cb (void *cls,
153 ksls->instructions = GNUNET_strdup ( 153 ksls->instructions = GNUNET_strdup (
154 tcd->details.success.details.tan_address_hint); 154 tcd->details.success.details.tan_address_hint);
155 break; 155 break;
156 case ANASTASIS_CS_TAN_ALREADY_SENT:
157 break;
156 case ANASTASIS_CS_WIRE_FUNDS: 158 case ANASTASIS_CS_WIRE_FUNDS:
157 /* FIXME: not implemented */ 159 /* FIXME: not implemented */
158 GNUNET_break (0); 160 GNUNET_break (0);
diff --git a/src/testing/testing_cmd_challenge_answer.c b/src/testing/testing_cmd_challenge_answer.c
index 88c4c2f..3472793 100644
--- a/src/testing/testing_cmd_challenge_answer.c
+++ b/src/testing/testing_cmd_challenge_answer.c
@@ -370,6 +370,9 @@ challenge_start_cb (void *af_cls,
370 case ANASTASIS_CHALLENGE_START_STATUS_TAN_SENT_HINT_PROVIDED: 370 case ANASTASIS_CHALLENGE_START_STATUS_TAN_SENT_HINT_PROVIDED:
371 GNUNET_break (0); /* FIXME: not implemented */ 371 GNUNET_break (0); /* FIXME: not implemented */
372 break; 372 break;
373 case ANASTASIS_CHALLENGE_START_STATUS_TAN_ALREADY_SENT:
374 GNUNET_break (0); /* FIXME: not implemented */
375 break;
373 case ANASTASIS_CHALLENGE_START_STATUS_BANK_TRANSFER_REQUIRED: 376 case ANASTASIS_CHALLENGE_START_STATUS_BANK_TRANSFER_REQUIRED:
374 GNUNET_break (0); /* FIXME: not implemented */ 377 GNUNET_break (0); /* FIXME: not implemented */
375 break; 378 break;