commit cc821f698672e64201644f713c1ac2c9e6d13eb2
parent 2de2d9056a0837f113606a629cf2eb4501ea8abc
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Tue, 14 Jul 2026 22:57:54 +0200
empty fields do not satisfy regex restriction
Diffstat:
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/challenger/challenger-httpd_challenge.c b/src/challenger/challenger-httpd_challenge.c
@@ -561,23 +561,27 @@ check_restrictions (const json_t *address)
const char *key;
const json_t *val;
- json_object_foreach ((json_t *) address, key, val)
+ json_object_foreach ((json_t *) CH_restrictions, key, val)
{
- const char *str = json_string_value (val);
+ const char *str = json_string_value (
+ json_object_get (address,
+ key));
const char *regex = json_string_value (
json_object_get (
- json_object_get (CH_restrictions,
- key),
+ val,
"regex"));
regex_t re;
- if (0 == strcasecmp (key,
- "read_only"))
- continue;
if (NULL == str)
- return key;
+ return key; /* missing is not allowed */
if (NULL == regex)
- continue;
+ {
+ /* regex must be specified */
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Regex missing for `%s'\n",
+ key);
+ return key;
+ }
if (0 != regcomp (&re,
regex,
REG_EXTENDED))