[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-twister] branch master updated: Addressing #5336.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-twister] branch master updated: Addressing #5336. |
Date: |
Mon, 04 Jun 2018 10:40:34 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository twister.
The following commit(s) were added to refs/heads/master by this push:
new 3ea9194 Addressing #5336.
3ea9194 is described below
commit 3ea91942f5dd739ccccee2ff2d996081003d654a
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Jun 4 10:40:18 2018 +0200
Addressing #5336.
---
src/twister/taler-twister-service.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/twister/taler-twister-service.c
b/src/twister/taler-twister-service.c
index fe0e119..8616ee2 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -918,6 +918,13 @@ flip_object (struct MHD_Connection *con,
{
char *target;
json_t *parent;
+ #define CROCKFORD_MAX_INDEX 31
+ char crockford_chars[] = {'0', '1', '2', '3', '4', '5',
+ '6', '7', '8', '9', 'A', 'B',
+ 'C', 'D', 'E', 'F', 'G', 'H',
+ 'J', 'K', 'M', 'N', 'P', 'Q',
+ 'R', 'S', 'T', 'V', 'W', 'X',
+ 'Y', 'Z'}; // index: 0-31
if (GNUNET_OK != walk_response_object (flip_path,
&parent,
@@ -930,7 +937,8 @@ flip_object (struct MHD_Connection *con,
json_t *child = NULL;
const char *current_value;
char *current_value_flip;
- uint32_t index;
+ uint32_t crockford_index;
+ uint32_t flip_index;
if (json_is_object (parent))
child = json_object_get (parent, target);
@@ -949,11 +957,19 @@ flip_object (struct MHD_Connection *con,
#warning When free this?
current_value_flip = GNUNET_strdup (current_value);
- index = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- strlen (current_value_flip));
+ crockford_index = GNUNET_CRYPTO_random_u32
+ (GNUNET_CRYPTO_QUALITY_WEAK,
+ CROCKFORD_MAX_INDEX + 1);
- /* flip the LSB. */
- current_value_flip[index] ^= 1;
+ flip_index = GNUNET_CRYPTO_random_u32
+ (GNUNET_CRYPTO_QUALITY_WEAK,
+ strlen (current_value_flip));
+
+ /* flip the LSB. WARNING: if the flipping does NOT
+ * reach a Crockford-friendly char, then the test cases
+ * will get disoriented by "400 Bad request" responses. */
+ current_value_flip[flip_index] =
+ crockford_chars[crockford_index];
TALER_LOG_INFO ("Flipping %s to %s\n",
current_value,
@@ -1413,7 +1429,9 @@ create_response (void *cls,
{
TALER_LOG_DEBUG ("Will flip path: %s\n",
flip_path_dl);
- flip_object (con, hr->json, flip_path_dl);
+ flip_object (con,
+ hr->json,
+ flip_path_dl);
}
if ('\0' != delete_path[0])
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-twister] branch master updated: Addressing #5336.,
gnunet <=