Skip to content

Commit 86379b4

Browse files
committed
conf: parse regexes case-sensitive
rather than treating everything as case insensitive, we explicitly allow upper/lowercase where it makes sense.
1 parent 57f932a commit 86379b4

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/conf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ config_init (void)
262262

263263
r = regcomp (directives[i].cre,
264264
directives[i].re,
265-
REG_EXTENDED | REG_ICASE | REG_NEWLINE);
265+
REG_EXTENDED | REG_NEWLINE);
266266
if (r)
267267
return r;
268268
}

src/conf_regex.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
#define SPACE "[ \\t]"
1212
#define WS SPACE "+"
1313
#define STR "\"([^\"]+)\""
14-
#define BOOL "(yes|on|no|off)"
14+
#define BOOL "([Yy][Ee][Ss]|[Oo][Nn]|[Nn][Oo]|[Oo][Ff][Ff])"
1515
#define INT "(" DIGIT "+)"
16-
#define ALNUM "([-a-z0-9._]+)"
16+
#define ALNUM "([-A-Za-z0-9._]+)"
1717
#define USERNAME "([^:]*)"
1818
#define PASSWORD "([^@]*)"
1919
#define IP "((([0-9]{1,3})\\.){3}[0-9]{1,3})"
2020
#define IPMASK "(" IP "(/" DIGIT "+)?)"
2121
#define IPV6 "(" \
22-
"(([0-9a-f:]{2,39}))|" \
23-
"(([0-9a-f:]{0,29}:" IP "))" \
22+
"(([0-9a-fA-F:]{2,39}))|" \
23+
"(([0-9a-fA-F:]{0,29}:" IP "))" \
2424
")"
2525

2626
#define IPV6MASK "(" IPV6 "(/" DIGIT "+)?)"
@@ -88,6 +88,6 @@ STDCONF (upstream,
8888
":" INT "(" WS STR ")?" ")", handle_upstream),
8989
#endif
9090
/* loglevel */
91-
STDCONF (loglevel, "(critical|error|warning|notice|connect|info)",
91+
STDCONF (loglevel, "([Cc]ritical|[Ee]rror|[Ww]arning|[Nn]otice|[Cc]onnect|[Ii]nfo)",
9292
handle_loglevel)
9393

0 commit comments

Comments
 (0)