From 2359d8ae29b48f0280b1002a2dd0d1ba28bea0c6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 12 Nov 2023 15:13:35 +0100 Subject: handle conversion helper errors better --- src/kyclogic/plugin_kyclogic_kycaid.c | 29 +++++++++++++++++++++++++---- src/kyclogic/plugin_kyclogic_oauth2.c | 14 ++++++++++++++ src/kyclogic/plugin_kyclogic_persona.c | 23 +++++++++++++++++++++++ 3 files changed, 62 insertions(+), 4 deletions(-) (limited to 'src/kyclogic') diff --git a/src/kyclogic/plugin_kyclogic_kycaid.c b/src/kyclogic/plugin_kyclogic_kycaid.c index b1b9f0a49..726ba7ead 100644 --- a/src/kyclogic/plugin_kyclogic_kycaid.c +++ b/src/kyclogic/plugin_kyclogic_kycaid.c @@ -361,10 +361,10 @@ kycaid_load_configuration (void *cls, return NULL; } if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (ps->cfg, - provider_section_name, - "KYC_KYCAID_CONVERTER_HELPER", - &pd->conversion_helper)) + GNUNET_CONFIGURATION_get_value_string (ps->cfg, + provider_section_name, + "KYC_KYCAID_CONVERTER_HELPER", + &pd->conversion_helper)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, provider_section_name, @@ -968,6 +968,27 @@ handle_webhook_finished (void *cls, "-a", wh->pd->auth_token, NULL); + if (NULL == wh->econ) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to start KYCAID conversion helper `%s'\n", + wh->pd->conversion_helper); + resp = TALER_MHD_make_error ( + TALER_EC_EXCHANGE_GENERIC_KYC_CONVERTER_FAILED, + NULL); + wh->cb (wh->cb_cls, + wh->process_row, + &wh->h_payto, + wh->pd->section, + wh->applicant_id, + wh->verification_id, + TALER_KYCLOGIC_STATUS_INTERNAL_ERROR, + GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ + NULL, + MHD_HTTP_INTERNAL_SERVER_ERROR, + resp); + break; + } return; } break; diff --git a/src/kyclogic/plugin_kyclogic_oauth2.c b/src/kyclogic/plugin_kyclogic_oauth2.c index 5ef1330ad..7c57b5ae1 100644 --- a/src/kyclogic/plugin_kyclogic_oauth2.c +++ b/src/kyclogic/plugin_kyclogic_oauth2.c @@ -1023,6 +1023,20 @@ parse_proof_success_reply (struct TALER_KYCLOGIC_ProofHandle *ph, pd->conversion_binary, pd->conversion_binary, NULL); + if (NULL == ph->ec) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to start KYCAID conversion helper `%s'\n", + pd->conversion_binary); + ph->status = TALER_KYCLOGIC_STATUS_INTERNAL_ERROR; + ph->response + = TALER_MHD_make_error ( + TALER_EC_EXCHANGE_GENERIC_KYC_CONVERTER_FAILED, + "Failed to launch KYC conversion helper"); + ph->http_status + = MHD_HTTP_INTERNAL_SERVER_ERROR; + return; + } } diff --git a/src/kyclogic/plugin_kyclogic_persona.c b/src/kyclogic/plugin_kyclogic_persona.c index 7568af1f5..2183c6121 100644 --- a/src/kyclogic/plugin_kyclogic_persona.c +++ b/src/kyclogic/plugin_kyclogic_persona.c @@ -1257,6 +1257,20 @@ handle_proof_finished (void *cls, j, &proof_post_conversion_cb, ph); + if (NULL == ph->ec) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to start Persona conversion helper\n"); + proof_reply_error ( + ph, + ph->inquiry_id, + MHD_HTTP_BAD_GATEWAY, + "persona-logic-failure", + GNUNET_JSON_PACK ( + TALER_JSON_pack_ec ( + TALER_EC_EXCHANGE_GENERIC_KYC_CONVERTER_FAILED))); + break; + } } return; /* continued in proof_post_conversion_cb */ } @@ -1771,6 +1785,15 @@ handle_webhook_finished (void *cls, j, &webhook_post_conversion_cb, wh); + if (NULL == wh->ec) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to start Persona conversion helper\n"); + webhook_reply_error (wh, + inquiry_id, + MHD_HTTP_INTERNAL_SERVER_ERROR); + break; + } } return; /* continued in webhook_post_conversion_cb */ } -- cgit v1.2.3