exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 352453ae63cda873f4535e83da96298937495392
parent 6763d3ee0c1433c975c174b5041313b15185de37
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Sun,  1 Feb 2026 07:05:58 +0100

Merge branch 'master' of git+ssh://git.taler.net/exchange

Diffstat:
Msrc/exchange/taler-exchange-httpd_aml-accounts-get.c | 98++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
Msrc/util/secmod_common.c | 59+++++++++++++++++++++++++++++++----------------------------
2 files changed, 93 insertions(+), 64 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_aml-accounts-get.c b/src/exchange/taler-exchange-httpd_aml-accounts-get.c @@ -43,19 +43,23 @@ #define CSV_FOOTER "\r\n" #define XML_HEADER "<?xml version=\"1.0\"?>" \ - "<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"" \ - "xmlns:o=\"urn:schemas-microsoft-com:office:office\"" \ - "xmlns:x=\"urn:schemas-microsoft-com:office:excel\"" \ - "xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\">" \ - "<Worksheet ss:Name=\"Sheet1\">" \ - "<Table>" \ - "<Row>" \ - "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">File number</Data></Cell>" \ - "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">Customer</Data></Cell>" \ - "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">Comments</Data></Cell>" \ - "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">Increased risk business relationship</Data></Cell>" \ - "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">Acquisition date</Data></Cell>" \ - "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">Exit date</Data></Cell>" \ + "<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"" \ + " xmlns:c=\"urn:schemas-microsoft-com:office:component:spreadsheet\"" \ + " xmlns:html=\"http://www.w3.org/TR/REC-html40\"" \ + " xmlns:x2=\"http://schemas.microsoft.com/office/excel/2003/xml\"" \ + " xmlns:o=\"urn:schemas-microsoft-com:office:office\"" \ + " xmlns:x=\"urn:schemas-microsoft-com:office:excel\"" \ + " xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\">" \ + "<Styles><Style ss:ID=\"DateFormat\"><NumberFormat ss:Format=\"yyyy-mm-dd\"/></Style></Styles>\n" \ + "<Worksheet ss:Name=\"Sheet1\">\n" \ + "<Table>\n" \ + "<Row>\n" \ + "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">File number</Data></Cell>\n" \ + "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">Customer</Data></Cell>\n" \ + "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">Comments</Data></Cell>\n" \ + "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">Increased risk business relationship</Data></Cell>\n" \ + "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">Acquisition date</Data></Cell>\n" \ + "<Cell ss:StyleID=\"Header\"><Data ss:Type=\"String\">Exit date</Data></Cell>\n" \ "</Row>\n" #define XML_FOOTER "</Table></Worksheet></Workbook>" @@ -237,35 +241,57 @@ record_cb ( case RCF_XML: { char *ecomments = NULL; + char opentime_s[128]; + char closetime_s[128]; + const struct tm *tm; + time_t tt; if ( (NULL == comments) && (GNUNET_TIME_absolute_is_never (open_time.abs_time)) ) comments = "transacted amounts below limits that trigger account opening"; ecomments = escape_xml (comments); - GNUNET_buffer_write_fstr (&rc->details.xml, - "<Row>" - "<Cell><Data ss:Type=\"Number\">%llu</Data></Cell>" - "<Cell><Data ss:Type=\"String\">%s</Data></Cell>" - "<Cell><Data ss:Type=\"String\">%s</Data></Cell>" - "<Cell><Data ss:Type=\"Boolean\">%s</Data></Cell>" - "<Cell><Data ss:Type=\"DateTime\">%s</Data></Cell>" - "<Cell><Data ss:Type=\"DateTime\">%s</Data></Cell>" - "</Row>\n", - (unsigned long long) row_id, - payto.full_payto, - NULL == ecomments - ? "" - : ecomments, - high_risk ? "1" : "0", - GNUNET_TIME_absolute_is_never (open_time. - abs_time) - ? "" - : GNUNET_TIME_timestamp2s (open_time), - GNUNET_TIME_absolute_is_never (close_time. - abs_time) - ? "" - : GNUNET_TIME_timestamp2s (close_time)); + tt = (time_t) GNUNET_TIME_timestamp_to_s (open_time); + tm = gmtime (&tt); + strftime (opentime_s, + sizeof (opentime_s), + "%Y-%m-%dT%H:%M:%S", + tm); + tt = (time_t) GNUNET_TIME_timestamp_to_s (close_time); + tm = gmtime (&tt); + strftime (closetime_s, + sizeof (closetime_s), + "%Y-%m-%dT%H:%M:%S", + tm); + GNUNET_buffer_write_fstr ( + &rc->details.xml, + "<Row>" + "<Cell><Data ss:Type=\"Number\">%llu</Data></Cell>" + "<Cell><Data ss:Type=\"String\">%s</Data></Cell>" + "<Cell><Data ss:Type=\"String\">%s</Data></Cell>" + "<Cell ss:Formula=\"=%s()\"><Data ss:Type=\"Boolean\">%s</Data></Cell>" + "<Cell ss:StyleID=\"DateFormat\"><Data ss:Type=\"%s\">%s</Data></Cell>" + "<Cell ss:StyleID=\"DateFormat\"><Data ss:Type=\"%s\">%s</Data></Cell>" + "</Row>\n", + (unsigned long long) row_id, + payto.full_payto, + NULL == ecomments + ? "" + : ecomments, + high_risk ? "TRUE" : "FALSE", + high_risk ? "1" : "0", + GNUNET_TIME_absolute_is_never (open_time.abs_time) + ? "String" + : "DateTime", + GNUNET_TIME_absolute_is_never (open_time.abs_time) + ? "never" + : opentime_s, + GNUNET_TIME_absolute_is_never (close_time.abs_time) + ? "String" + : "DateTime", + GNUNET_TIME_absolute_is_never (close_time.abs_time) + ? "never" + : closetime_s); GNUNET_free (ecomments); break; } /* end case RCF_XML */ diff --git a/src/util/secmod_common.c b/src/util/secmod_common.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2020 Taler Systems SA + Copyright (C) 2020, 2026 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -404,16 +404,37 @@ sign_worker (void *cls) } GNUNET_break (0 == close (client->csock)); client->csock = -1; + return NULL; +} + + +/** + * Clean up @a pos, joining the thread and closing the + * file descriptors. + * + * @param[in] pos client to clean up + */ +static void +join_client (struct TES_Client *pos) +{ + void *rval; + + GNUNET_CONTAINER_DLL_remove (TES_clients_head, + TES_clients_tail, + pos); + GNUNET_break (0 == + pthread_join (pos->worker, + &rval)); #ifdef __linux__ - GNUNET_break (0 == close (client->esock)); - client->esock = -1; + GNUNET_break (0 == close (pos->esock)); + pos->esock = -1; #else - GNUNET_break (0 == close (client->esock_in)); - client->esock_in = -1; - GNUNET_break (0 == close (client->esock_out)); - client->esock_out = -1; + GNUNET_break (0 == close (pos->esock_in)); + pos->esock_in = -1; + GNUNET_break (0 == close (pos->esock_out)); + pos->esock_out = -1; #endif - return NULL; + GNUNET_free (pos); } @@ -495,15 +516,7 @@ listen_job (void *cls) nxt = pos->next; if (-1 == pos->csock) { - void *rval; - - GNUNET_CONTAINER_DLL_remove (TES_clients_head, - TES_clients_tail, - pos); - GNUNET_break (0 == - pthread_join (pos->worker, - &rval)); - GNUNET_free (pos); + join_client (pos); } } GNUNET_CONTAINER_DLL_insert (TES_clients_head, @@ -627,16 +640,6 @@ TES_listen_stop (void) TES_wake_clients (); GNUNET_assert (0 == pthread_mutex_lock (&TES_clients_lock)); while (NULL != (client = TES_clients_head)) - { - void *rval; - - GNUNET_CONTAINER_DLL_remove (TES_clients_head, - TES_clients_tail, - client); - GNUNET_break (0 == - pthread_join (client->worker, - &rval)); - GNUNET_free (client); - } + join_client (client); GNUNET_assert (0 == pthread_mutex_unlock (&TES_clients_lock)); }