From 86379b4b66d5c7c491b8b5ff3131030dc614a671 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Fri, 9 Oct 2020 01:43:46 +0100 Subject: [PATCH] conf: parse regexes case-sensitive rather than treating everything as case insensitive, we explicitly allow upper/lowercase where it makes sense. --- src/conf.c | 2 +- src/conf_regex.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/conf.c b/src/conf.c index f6af384..d40d3a3 100644 --- a/src/conf.c +++ b/src/conf.c @@ -262,7 +262,7 @@ config_init (void) r = regcomp (directives[i].cre, directives[i].re, - REG_EXTENDED | REG_ICASE | REG_NEWLINE); + REG_EXTENDED | REG_NEWLINE); if (r) return r; } diff --git a/src/conf_regex.h b/src/conf_regex.h index 240d664..281e67b 100644 --- a/src/conf_regex.h +++ b/src/conf_regex.h @@ -11,16 +11,16 @@ #define SPACE "[ \\t]" #define WS SPACE "+" #define STR "\"([^\"]+)\"" -#define BOOL "(yes|on|no|off)" +#define BOOL "([Yy][Ee][Ss]|[Oo][Nn]|[Nn][Oo]|[Oo][Ff][Ff])" #define INT "(" DIGIT "+)" -#define ALNUM "([-a-z0-9._]+)" +#define ALNUM "([-A-Za-z0-9._]+)" #define USERNAME "([^:]*)" #define PASSWORD "([^@]*)" #define IP "((([0-9]{1,3})\\.){3}[0-9]{1,3})" #define IPMASK "(" IP "(/" DIGIT "+)?)" #define IPV6 "(" \ - "(([0-9a-f:]{2,39}))|" \ - "(([0-9a-f:]{0,29}:" IP "))" \ + "(([0-9a-fA-F:]{2,39}))|" \ + "(([0-9a-fA-F:]{0,29}:" IP "))" \ ")" #define IPV6MASK "(" IPV6 "(/" DIGIT "+)?)" @@ -88,6 +88,6 @@ STDCONF (upstream, ":" INT "(" WS STR ")?" ")", handle_upstream), #endif /* loglevel */ -STDCONF (loglevel, "(critical|error|warning|notice|connect|info)", +STDCONF (loglevel, "([Cc]ritical|[Ee]rror|[Ww]arning|[Nn]otice|[Cc]onnect|[Ii]nfo)", handle_loglevel)