From 77b0e836d1ca5b1aec45ba6c4c901153a22ab196 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 9 Nov 2019 21:36:19 +0100 Subject: [PATCH 1/3] fix off by one: reserve space for 0-termination --- src/util/util.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/util/util.c b/src/util/util.c index 10d5d53f7..fa65fc238 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -265,25 +265,22 @@ TALER_url_join (const char *base_url, unsigned int iparam = 0; va_list args; struct TALER_Buffer buf = { 0 }; - size_t len = 0; + size_t len; GNUNET_assert (NULL != base_url); GNUNET_assert (NULL != path); - - if (strlen (base_url) == 0) + if (0 == strlen (base_url)) { /* base URL can't be empty */ GNUNET_break (0); return NULL; } - if ('/' != base_url[strlen (base_url) - 1]) { /* Must be an actual base URL! */ GNUNET_break (0); return NULL; } - if ('/' == path[0]) { /* The path must be relative. */ @@ -291,14 +288,14 @@ TALER_url_join (const char *base_url, return NULL; } - // Path should be relative to existing path of base URL + /* Path should be relative to existing path of base URL */ GNUNET_break ('/' != path[0]); if ('/' == path[0]) GNUNET_break (0); /* 1st pass: compute length */ - len += strlen (base_url) + strlen (path); + len = strlen (base_url) + strlen (path) + 1; va_start (args, path); while (1) @@ -316,7 +313,6 @@ TALER_url_join (const char *base_url, va_end (args); TALER_buffer_prealloc (&buf, len); - TALER_buffer_write_str (&buf, base_url); TALER_buffer_write_str (&buf, path); @@ -325,6 +321,7 @@ TALER_url_join (const char *base_url, { char *key; char *value; + key = va_arg (args, char *); if (NULL == key) break; From 636b167655be4656af5c5aeba2a8336ed4e73e89 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 15 Nov 2019 09:39:13 +0100 Subject: [PATCH 2/3] sync error codes --- src/include/taler_error_codes.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/include/taler_error_codes.h b/src/include/taler_error_codes.h index 7e093c3ba..8f3a29ecc 100644 --- a/src/include/taler_error_codes.h +++ b/src/include/taler_error_codes.h @@ -1834,6 +1834,37 @@ enum TALER_ErrorCode */ TALER_EC_BANK_REJECT_NO_RIGHTS = 5200, + + /** + * The sync service failed to access its database. + * This response is provided with HTTP status code + * MHD_HTTP_INTERNAL_ERROR. + */ + TALER_EC_SYNC_DB_FETCH_ERROR = 6000, + + /** + * The sync service failed find the record in its database. + * This response is provided with HTTP status code + * MHD_HTTP_NOT_FOUND. + */ + TALER_EC_SYNC_BACKUP_UNKNOWN = 6001, + + /** + * The sync service failed find the account in its database. + * This response is provided with HTTP status code + * MHD_HTTP_NOT_FOUND. + */ + TALER_EC_SYNC_ACCOUNT_UNKNOWN = 6002, + + /** + * The Etag provided in the If-None-Match header is + * malformed. + * This response is provided with HTTP status code + * MHD_HTTP_BAD_REQUEST. + */ + TALER_EC_SYNC_BAD_ETAG = 6003, + + /** * End of error code range. */ From 44bccda22b90d4edfac993ded78a3e6a83787d5a Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Sat, 16 Nov 2019 02:36:53 +0100 Subject: [PATCH 3/3] new error codes (bank) --- src/include/taler_error_codes.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/include/taler_error_codes.h b/src/include/taler_error_codes.h index 8f3a29ecc..2212fdb00 100644 --- a/src/include/taler_error_codes.h +++ b/src/include/taler_error_codes.h @@ -1827,6 +1827,12 @@ enum TALER_ErrorCode */ TALER_EC_BANK_TRANSACTION_NOT_FOUND = 5111, + + /** + * Bank received a malformed amount string. + */ + TALER_EC_BANK_BAD_FORMAT_AMOUNT = 5112, + /** * The client does not own the account credited by the transaction * which is to be rejected, so it has no rights do reject it. To be @@ -1835,6 +1841,13 @@ enum TALER_ErrorCode TALER_EC_BANK_REJECT_NO_RIGHTS = 5200, + /** + * This error code is returned when no known exception types + * captured the exception. + */ + TALER_EC_BANK_UNMANAGED_EXCEPTION = 5300, + + /** * The sync service failed to access its database. * This response is provided with HTTP status code