merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 11d0700360eb768d4cf502eea6be4c253702570d
parent 4b1e9c33e1b8c4f8c529fa51f6706c2bc82e3dcf
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon, 16 Mar 2026 01:41:25 +0100

convert merchant to new libgnunetutil API

Diffstat:
Msrc/backend/taler-merchant-depositcheck.c | 64++++++++++++++++++++++++++++++++++++----------------------------
Msrc/backend/taler-merchant-httpd_get-private-kyc.c | 14++++++--------
Msrc/backend/taler-merchant-httpd_get-private-orders-ORDER_ID.c | 14++++++--------
Msrc/backend/taler-merchant-httpd_post-challenge-ID.c | 40++++++++++++++++++++++++++--------------
Msrc/backend/taler-merchant-httpd_post-private-orders.c | 123++++++++-----------------------------------------------------------------------
Msrc/backend/taler-merchant-report-generator.c | 52++++++++++++++++++++++++++++++++--------------------
Msrc/backenddb/merchant-0033.sql | 2+-
Msrc/testing/testing_api_cmd_depositcheck.c | 41++++++++++++++++++++++++-----------------
Msrc/testing/testing_api_cmd_exec_donaukeyupdate.c | 39+++++++++++++++++++++++----------------
Msrc/testing/testing_api_cmd_tme.c | 41++++++++++++++++++++++++-----------------
Msrc/testing/testing_api_cmd_webhook.c | 39+++++++++++++++++++++++----------------
11 files changed, 213 insertions(+), 256 deletions(-)

diff --git a/src/backend/taler-merchant-depositcheck.c b/src/backend/taler-merchant-depositcheck.c @@ -58,7 +58,7 @@ struct Child /** * The child process. */ - struct GNUNET_OS_Process *process; + struct GNUNET_Process *process; /** * Wait handle. @@ -319,13 +319,14 @@ shutdown_task (void *cls) = GNUNET_OS_PROCESS_UNKNOWN; unsigned long code = 0; - GNUNET_break (0 == - GNUNET_OS_process_kill (c->process, - SIGTERM)); GNUNET_break (GNUNET_OK == - GNUNET_OS_process_wait_status (c->process, - &type, - &code)); + GNUNET_process_kill (c->process, + SIGTERM)); + GNUNET_break (GNUNET_OK == + GNUNET_process_wait (c->process, + true, + &type, + &code)); if ( (GNUNET_OS_PROCESS_EXITED != type) || (0 != code) ) GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -333,7 +334,7 @@ shutdown_task (void *cls) c->base_url, (int) type, (int) code); - GNUNET_OS_process_destroy (c->process); + GNUNET_process_destroy (c->process); } GNUNET_free (c->base_url); GNUNET_free (c); @@ -797,11 +798,13 @@ select_work (void *cls) * * @param base_url base URL to run with */ -static struct GNUNET_OS_Process * +static struct GNUNET_Process * start_worker (const char *base_url) { + struct GNUNET_Process *p; char toff[30]; long long zo; + enum GNUNET_GenericReturnValue ret; zo = GNUNET_TIME_get_offset (); GNUNET_snprintf (toff, @@ -814,12 +817,11 @@ start_worker (const char *base_url) NULL == cfg_filename ? "<default>" : cfg_filename); + p = GNUNET_process_create (); + if (NULL == cfg_filename) - return GNUNET_OS_start_process ( - GNUNET_OS_INHERIT_STD_ALL, - NULL, - NULL, - NULL, + ret = GNUNET_process_set_command_va ( + p, "taler-merchant-depositcheck", "taler-merchant-depositcheck", "-e", base_url, @@ -827,19 +829,25 @@ start_worker (const char *base_url) "-T", toff, test_mode ? "-t" : NULL, NULL); - return GNUNET_OS_start_process ( - GNUNET_OS_INHERIT_STD_ALL, - NULL, - NULL, - NULL, - "taler-merchant-depositcheck", - "taler-merchant-depositcheck", - "-c", cfg_filename, - "-e", base_url, - "-L", "INFO", - "-T", toff, - test_mode ? "-t" : NULL, - NULL); + else + ret = GNUNET_process_set_command_va ( + p, + "taler-merchant-depositcheck", + "taler-merchant-depositcheck", + "-c", cfg_filename, + "-e", base_url, + "-L", "INFO", + "-T", toff, + test_mode ? "-t" : NULL, + NULL); + if ( (GNUNET_OK != ret) || + (GNUNET_OK != + GNUNET_process_start (p)) ) + { + GNUNET_process_destroy (p); + return NULL; + } + return p; } @@ -867,7 +875,7 @@ child_done_cb (void *cls, struct Child *c = cls; c->cwh = NULL; - GNUNET_OS_process_destroy (c->process); + GNUNET_process_destroy (c->process); c->process = NULL; if ( (GNUNET_OS_PROCESS_EXITED != type) || (0 != exit_code) ) diff --git a/src/backend/taler-merchant-httpd_get-private-kyc.c b/src/backend/taler-merchant-httpd_get-private-kyc.c @@ -441,14 +441,12 @@ resume_kyc_with_response (struct KycContext *kc) } can = TALER_JSON_canonicalize (kc->kycs_data); GNUNET_assert (GNUNET_YES == - GNUNET_CRYPTO_kdf (&sh, - sizeof (sh), - "KYC-SALT", - strlen ("KYC-SALT"), - can, - strlen (can), - NULL, - 0)); + GNUNET_CRYPTO_hkdf_gnunet (&sh, + sizeof (sh), + "KYC-SALT", + strlen ("KYC-SALT"), + can, + strlen (can))); not_modified = kc->have_lp_not_etag && (0 == GNUNET_memcmp (&sh, &kc->lp_not_etag)); diff --git a/src/backend/taler-merchant-httpd_get-private-orders-ORDER_ID.c b/src/backend/taler-merchant-httpd_get-private-orders-ORDER_ID.c @@ -882,14 +882,12 @@ check_reply (struct GetOrderRequestContext *gorc, can = TALER_JSON_canonicalize (reply); GNUNET_assert (GNUNET_YES == - GNUNET_CRYPTO_kdf (&sh, - sizeof (sh), - "GOR-SALT", - strlen ("GOR-SALT"), - can, - strlen (can), - NULL, - 0)); + GNUNET_CRYPTO_hkdf_gnunet (&sh, + sizeof (sh), + "GOR-SALT", + strlen ("GOR-SALT"), + can, + strlen (can))); not_modified = gorc->have_lp_not_etag && (0 == GNUNET_memcmp (&sh, &gorc->lp_not_etag)); diff --git a/src/backend/taler-merchant-httpd_post-challenge-ID.c b/src/backend/taler-merchant-httpd_post-challenge-ID.c @@ -81,7 +81,7 @@ struct MfaState /** * Handle to the helper process. */ - struct GNUNET_OS_Process *child; + struct GNUNET_Process *child; /** * Handle to wait for @e child @@ -182,10 +182,15 @@ mfa_context_cleanup (void *cls) } if (NULL != mfa->child) { - (void) GNUNET_OS_process_kill (mfa->child, - SIGKILL); GNUNET_break (GNUNET_OK == - GNUNET_OS_process_wait (mfa->child)); + GNUNET_process_kill (mfa->child, + SIGKILL)); + GNUNET_break (GNUNET_OK == + GNUNET_process_wait (mfa->child, + true, + NULL, + NULL)); + GNUNET_process_destroy (mfa->child); mfa->child = NULL; } GNUNET_free (mfa->required_address); @@ -346,7 +351,7 @@ transmission_done_cb (void *cls, mfa->cwh = NULL; if (NULL != mfa->child) { - GNUNET_OS_process_destroy (mfa->child); + GNUNET_process_destroy (mfa->child); mfa->child = NULL; } mfa->send_ok = ( (GNUNET_OS_PROCESS_EXITED == type) && @@ -437,16 +442,23 @@ phase_send_challenge (struct MfaState *mfa) "pipe"); return; } - mfa->child = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ERR, - p, - NULL, - NULL, - prog, - prog, - mfa->required_address, - NULL); - if (NULL == mfa->child) + mfa->child = GNUNET_process_create (); + GNUNET_assert (GNUNET_OK == + GNUNET_process_set_options ( + mfa->child, + GNUNET_process_option_inherit_rpipe (p, + STDIN_FILENO))); + if ( (GNUNET_OK != + GNUNET_process_set_command_va (mfa->child, + prog, + prog, + mfa->required_address, + NULL)) || + (GNUNET_OK != + GNUNET_process_start (mfa->child)) ) { + GNUNET_process_destroy (mfa->child); + mfa->child = NULL; GNUNET_break (GNUNET_OK == GNUNET_DISK_pipe_close (p)); respond_with_error (mfa, diff --git a/src/backend/taler-merchant-httpd_post-private-orders.c b/src/backend/taler-merchant-httpd_post-private-orders.c @@ -210,16 +210,11 @@ struct WireMethodCandidate json_t *exchanges; /** - * Array of maximum amounts that could be paid over all available exchanges + * Set of maximum amounts that could be paid over all available exchanges * for this @a wm. Used to determine if this order creation requests exceeds * legal limits. */ - struct TALER_Amount *total_exchange_limits; - - /** - * Length of the @e total_exchange_limits array. - */ - unsigned int num_total_exchange_limits; + struct TALER_AmountSet total_exchange_limits; }; @@ -825,66 +820,6 @@ TMH_force_orders_resume () /** - * Add the given @a val to the @a array. Adds the - * amount to a given entry in @a array if one with the same - * currency exists, otherwise extends the @a array. - * - * @param[in,out] array pointer to array of amounts - * @param[in,out] array_len length of @a array - * @param val amount to add - * @param cap cap for the sums to enforce, can be NULL - */ -static void -add_to_currency_vector (struct TALER_Amount **array, - unsigned int *array_len, - const struct TALER_Amount *val, - const struct TALER_Amount *cap) -{ - for (unsigned int i = 0; i<*array_len; i++) - { - struct TALER_Amount *ai = &(*array)[i]; - - if (GNUNET_OK == - TALER_amount_cmp_currency (ai, - val)) - { - enum TALER_AmountArithmeticResult aar; - - aar = TALER_amount_add (ai, - ai, - val); - /* If we have a cap, we tolerate the overflow */ - GNUNET_assert ( (aar >= 0) || - ( (TALER_AAR_INVALID_RESULT_OVERFLOW == aar) && - (NULL != cap) ) ); - if (TALER_AAR_INVALID_RESULT_OVERFLOW == aar) - { - *ai = *cap; - } - else if (NULL != cap) - GNUNET_assert (GNUNET_OK == - TALER_amount_min (ai, - ai, - cap)); - return; - } - } - GNUNET_array_append (*array, - *array_len, - *val); - if (NULL != cap) - { - struct TALER_Amount *ai = &(*array)[(*array_len) - 1]; - - GNUNET_assert (GNUNET_OK == - TALER_amount_min (ai, - ai, - cap)); - } -} - - -/** * Update the phase of @a oc based on @a mret. * * @param[in,out] oc order to update phase for @@ -958,9 +893,7 @@ free_wmc (struct OrderContext *oc, GNUNET_CONTAINER_DLL_remove (oc->add_payment_details.wmc_head, oc->add_payment_details.wmc_tail, wmc); - GNUNET_array_grow (wmc->total_exchange_limits, - wmc->num_total_exchange_limits, - 0); + TALER_amount_set_free (&wmc->total_exchange_limits); json_decref (wmc->exchanges); GNUNET_free (wmc); } @@ -2552,36 +2485,6 @@ phase_set_max_fee (struct OrderContext *oc) /* ***************** ORDER_PHASE_SELECT_WIRE_METHOD **************** */ /** - * Check that the @a brutto amount is at or below the - * limits we have for the respective wire method candidate. - * - * @param wmc wire method candidate to check - * @param brutto amount to check - * @return true if the amount is OK, false if it is too high - */ -static bool -check_limits (struct WireMethodCandidate *wmc, - const struct TALER_Amount *brutto) -{ - for (unsigned int i = 0; i<wmc->num_total_exchange_limits; i++) - { - const struct TALER_Amount *total_exchange_limit - = &wmc->total_exchange_limits[i]; - - if (GNUNET_OK != - TALER_amount_cmp_currency (brutto, - total_exchange_limit)) - continue; - if (1 != - TALER_amount_cmp (brutto, - total_exchange_limit)) - return true; - } - return false; -} - - -/** * Phase to select a wire method that will be acceptable for the order. * If none is "perfect" (allows all choices), might jump back to the * previous phase to force "/keys" downloads to see if that helps. @@ -2608,8 +2511,8 @@ phase_select_wire_method (struct OrderContext *oc) want_choices = 1; ea = &oc->parse_order.details.v0.brutto; if (TALER_amount_is_zero (ea) || - check_limits (wmc, - ea)) + TALER_amount_set_test_above (&wmc->total_exchange_limits, + ea)) num_choices++; break; case TALER_MERCHANT_CONTRACT_VERSION_1: @@ -2618,8 +2521,8 @@ phase_select_wire_method (struct OrderContext *oc) { ea = &oc->parse_choices.choices[i].amount; if (TALER_amount_is_zero (ea) || - check_limits (wmc, - ea)) + TALER_amount_set_test_above (&wmc->total_exchange_limits, + ea)) num_choices++; } break; @@ -2645,9 +2548,7 @@ phase_select_wire_method (struct OrderContext *oc) wmc = wmc->next) { json_array_clear (wmc->exchanges); - GNUNET_array_grow (wmc->total_exchange_limits, - wmc->num_total_exchange_limits, - 0); + TALER_amount_set_free (&wmc->total_exchange_limits); } oc->phase = ORDER_PHASE_SET_EXCHANGES; return; @@ -3036,10 +2937,10 @@ get_acceptable (struct OrderContext *oc, GNUNET_assert (0 == json_array_append_new (wmc->exchanges, j_exchange)); - add_to_currency_vector (&wmc->total_exchange_limits, - &wmc->num_total_exchange_limits, - &max_amount, - max_needed); + GNUNET_assert (0 <= + TALER_amount_set_add (&wmc->total_exchange_limits, + &max_amount, + max_needed)); return true; } diff --git a/src/backend/taler-merchant-report-generator.c b/src/backend/taler-merchant-report-generator.c @@ -53,7 +53,7 @@ struct ReportActivity /** * Transmission program that is running. */ - struct GNUNET_OS_Process *proc; + struct GNUNET_Process *proc; /** * Handle to wait for @e proc to terminate. @@ -204,10 +204,15 @@ free_ra (struct ReportActivity *ra) } if (NULL != ra->proc) { - GNUNET_OS_process_kill (ra->proc, - SIGKILL); - GNUNET_OS_process_wait (ra->proc); - GNUNET_OS_process_destroy (ra->proc); + GNUNET_break (GNUNET_OK == + GNUNET_process_kill (ra->proc, + SIGKILL)); + GNUNET_break (GNUNET_OK == + GNUNET_process_wait (ra->proc, + true, + NULL, + NULL)); + GNUNET_process_destroy (ra->proc); ra->proc = NULL; } TALER_curl_easy_post_finished (&ra->post_ctx); @@ -330,7 +335,7 @@ child_completed_cb (void *cls, char *error_details = NULL; ra->cwh = NULL; - GNUNET_OS_process_destroy (ra->proc); + GNUNET_process_destroy (ra->proc); ra->proc = NULL; if ( (GNUNET_OS_PROCESS_EXITED != type) || (0 != exit_code) ) @@ -411,24 +416,31 @@ transmit_report (struct ReportActivity *ra, return; } - ra->proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ERR, - stdin_pipe, - NULL, - NULL, - binary, - binary, - "-d", - ra->report_description, - "-m", - ra->mime_type, - "-t", - ra->target_address, - NULL); - if (NULL == ra->proc) + ra->proc = GNUNET_process_create (); + GNUNET_assert (GNUNET_OK == + GNUNET_process_set_options ( + ra->proc, + GNUNET_process_option_inherit_rpipe (stdin_pipe, + STDIN_FILENO))); + if ( (GNUNET_OK != + GNUNET_process_set_command_va (ra->proc, + binary, + binary, + "-d", + ra->report_description, + "-m", + ra->mime_type, + "-t", + ra->target_address, + NULL)) || + (GNUNET_OK != + GNUNET_process_start (ra->proc)) ) { GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "exec", binary); + GNUNET_process_destroy (ra->proc); + ra->proc = NULL; GNUNET_DISK_pipe_close (stdin_pipe); finish_transmission (ra, TALER_EC_MERCHANT_REPORT_GENERATOR_FAILED, diff --git a/src/backenddb/merchant-0033.sql b/src/backenddb/merchant-0033.sql @@ -28,7 +28,7 @@ ALTER TABLE merchant_instances ADD COLUMN notification_language TEXT DEFAULT(NULL); COMMENT ON COLUMN merchant_instances.notification_language - IS 'Language in which (KYC) notifications should be sent to the merchant. NULL to disable build-in notifications.'; + IS 'Language in which (KYC) notifications should be sent to the merchant. NULL to disable built-in notifications.'; COMMIT; diff --git a/src/testing/testing_api_cmd_depositcheck.c b/src/testing/testing_api_cmd_depositcheck.c @@ -39,7 +39,7 @@ struct DepositcheckState /** * Process for the depositcheck. */ - struct GNUNET_OS_Process *depositcheck_proc; + struct GNUNET_Process *depositcheck_proc; /** * Configuration file used by the depositcheck. @@ -63,19 +63,22 @@ depositcheck_run (void *cls, struct DepositcheckState *ws = cls; (void) cmd; - ws->depositcheck_proc - = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-merchant-depositcheck", - "taler-merchant-depositcheck", - "-c", ws->config_filename, - "-t", /* exit when done */ - "-T", "1200s", - "-L", "INFO", - NULL); - if (NULL == ws->depositcheck_proc) + ws->depositcheck_proc = GNUNET_process_create (); + if ( (GNUNET_OK != + GNUNET_process_set_command_va (ws->depositcheck_proc, + "taler-merchant-depositcheck", + "taler-merchant-depositcheck", + "-c", ws->config_filename, + "-t", /* exit when done */ + "-T", "1200s", + "-L", "INFO", + NULL)) || + (GNUNET_OK != + GNUNET_process_start (ws->depositcheck_proc)) ) { GNUNET_break (0); + GNUNET_process_destroy (ws->depositcheck_proc); + ws->depositcheck_proc = NULL; TALER_TESTING_interpreter_fail (is); return; } @@ -99,11 +102,15 @@ depositcheck_cleanup (void *cls, (void) cmd; if (NULL != ws->depositcheck_proc) { - GNUNET_break (0 == - GNUNET_OS_process_kill (ws->depositcheck_proc, - SIGKILL)); - GNUNET_OS_process_wait (ws->depositcheck_proc); - GNUNET_OS_process_destroy (ws->depositcheck_proc); + GNUNET_break (GNUNET_OK == + GNUNET_process_kill (ws->depositcheck_proc, + SIGKILL)); + GNUNET_break (GNUNET_OK == + GNUNET_process_wait (ws->depositcheck_proc, + true, + NULL, + NULL)); + GNUNET_process_destroy (ws->depositcheck_proc); ws->depositcheck_proc = NULL; } GNUNET_free (ws); diff --git a/src/testing/testing_api_cmd_exec_donaukeyupdate.c b/src/testing/testing_api_cmd_exec_donaukeyupdate.c @@ -37,7 +37,7 @@ struct DonaukeyupdateState /** * Donaukeyupdate process. */ - struct GNUNET_OS_Process *donaukeyupdate_proc; + struct GNUNET_Process *donaukeyupdate_proc; /** * Configuration file used by the donaukeyupdate. @@ -61,18 +61,21 @@ donaukeyupdate_run (void *cls, struct DonaukeyupdateState *as = cls; (void) cmd; - as->donaukeyupdate_proc - = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-merchant-donaukeyupdate", - "taler-merchant-donaukeyupdate", - "-c", as->config_filename, - "-L", "INFO", - "-t", /* exit when done */ - NULL); - if (NULL == as->donaukeyupdate_proc) + as->donaukeyupdate_proc = GNUNET_process_create (); + if ( (GNUNET_OK != + GNUNET_process_set_command_va (as->donaukeyupdate_proc, + "taler-merchant-donaukeyupdate", + "taler-merchant-donaukeyupdate", + "-c", as->config_filename, + "-L", "INFO", + "-t", /* exit when done */ + NULL)) || + (GNUNET_OK != + GNUNET_process_start (as->donaukeyupdate_proc)) ) { GNUNET_break (0); + GNUNET_process_destroy (as->donaukeyupdate_proc); + as->donaukeyupdate_proc = NULL; TALER_TESTING_interpreter_fail (is); return; } @@ -96,11 +99,15 @@ donaukeyupdate_cleanup (void *cls, (void) cmd; if (NULL != as->donaukeyupdate_proc) { - GNUNET_break (0 == - GNUNET_OS_process_kill (as->donaukeyupdate_proc, - SIGKILL)); - GNUNET_OS_process_wait (as->donaukeyupdate_proc); - GNUNET_OS_process_destroy (as->donaukeyupdate_proc); + GNUNET_break (GNUNET_OK == + GNUNET_process_kill (as->donaukeyupdate_proc, + SIGKILL)); + GNUNET_break (GNUNET_OK == + GNUNET_process_wait (as->donaukeyupdate_proc, + true, + NULL, + NULL)); + GNUNET_process_destroy (as->donaukeyupdate_proc); as->donaukeyupdate_proc = NULL; } GNUNET_free (as); diff --git a/src/testing/testing_api_cmd_tme.c b/src/testing/testing_api_cmd_tme.c @@ -38,7 +38,7 @@ struct MerchantExchangeState /** * Process for taler-merchant-reconciliation */ - struct GNUNET_OS_Process *merchant_reconciliation_proc; + struct GNUNET_Process *merchant_reconciliation_proc; /** * Configuration file used by the program. @@ -62,19 +62,22 @@ tme_run (void *cls, struct MerchantExchangeState *ws = cls; (void) cmd; - ws->merchant_reconciliation_proc - = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-merchant-reconciliation", - "taler-merchant-reconciliation", - "-c", ws->config_filename, - "-t", /* exit when done */ - "-T", "1200s", - "-L", "INFO", - NULL); - if (NULL == ws->merchant_reconciliation_proc) + ws->merchant_reconciliation_proc = GNUNET_process_create (); + if ( (GNUNET_OK != + GNUNET_process_set_command_va (ws->merchant_reconciliation_proc, + "taler-merchant-reconciliation", + "taler-merchant-reconciliation", + "-c", ws->config_filename, + "-t", /* exit when done */ + "-T", "1200s", + "-L", "INFO", + NULL)) || + (GNUNET_OK != + GNUNET_process_start (ws->merchant_reconciliation_proc)) ) { GNUNET_break (0); + GNUNET_process_destroy (ws->merchant_reconciliation_proc); + ws->merchant_reconciliation_proc = NULL; TALER_TESTING_interpreter_fail (is); return; } @@ -98,11 +101,15 @@ tme_cleanup (void *cls, (void) cmd; if (NULL != ws->merchant_reconciliation_proc) { - GNUNET_break (0 == - GNUNET_OS_process_kill (ws->merchant_reconciliation_proc, - SIGKILL)); - GNUNET_OS_process_wait (ws->merchant_reconciliation_proc); - GNUNET_OS_process_destroy (ws->merchant_reconciliation_proc); + GNUNET_break (GNUNET_OK == + GNUNET_process_kill (ws->merchant_reconciliation_proc, + SIGKILL)); + GNUNET_break (GNUNET_OK == + GNUNET_process_wait (ws->merchant_reconciliation_proc, + true, + NULL, + NULL)); + GNUNET_process_destroy (ws->merchant_reconciliation_proc); ws->merchant_reconciliation_proc = NULL; } GNUNET_free (ws); diff --git a/src/testing/testing_api_cmd_webhook.c b/src/testing/testing_api_cmd_webhook.c @@ -38,7 +38,7 @@ struct WebhookState /** * Process for the webhook. */ - struct GNUNET_OS_Process *webhook_proc; + struct GNUNET_Process *webhook_proc; /** * Configuration file used by the webhook. @@ -62,18 +62,21 @@ webhook_run (void *cls, struct WebhookState *ws = cls; (void) cmd; - ws->webhook_proc - = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-merchant-webhook", - "taler-merchant-webhook", - "-c", ws->config_filename, - "-t", /* exit when done */ - "-L", "DEBUG", - NULL); - if (NULL == ws->webhook_proc) + ws->webhook_proc = GNUNET_process_create (); + if ( (GNUNET_OK != + GNUNET_process_set_command_va (ws->webhook_proc, + "taler-merchant-webhook", + "taler-merchant-webhook", + "-c", ws->config_filename, + "-t", /* exit when done */ + "-L", "DEBUG", + NULL)) || + (GNUNET_OK != + GNUNET_process_start (ws->webhook_proc)) ) { GNUNET_break (0); + GNUNET_process_destroy (ws->webhook_proc); + ws->webhook_proc = NULL; TALER_TESTING_interpreter_fail (is); return; } @@ -97,11 +100,15 @@ webhook_cleanup (void *cls, (void) cmd; if (NULL != ws->webhook_proc) { - GNUNET_break (0 == - GNUNET_OS_process_kill (ws->webhook_proc, - SIGKILL)); - GNUNET_OS_process_wait (ws->webhook_proc); - GNUNET_OS_process_destroy (ws->webhook_proc); + GNUNET_break (GNUNET_OK == + GNUNET_process_kill (ws->webhook_proc, + SIGKILL)); + GNUNET_break (GNUNET_OK == + GNUNET_process_wait (ws->webhook_proc, + true, + NULL, + NULL)); + GNUNET_process_destroy (ws->webhook_proc); ws->webhook_proc = NULL; } GNUNET_free (ws);