if tmpl_preparse() is told to not require a regex, then it should
treat '/' as any other character
char *p, *expanded;
char buffer[8192];
+ /*
+ * When 'request_regex == false', tmpl_preparse() treats
+ * '/' as a bare word. This is so that the configuration
+ * file parser can parse filenames, which may begin with
+ * '/'. We therefore check for leading '/' here, as
+ * conditions don't use filenames.
+ */
+ if (!require_regex && (*start == '/')) {
+ *error = "Unexpected regular expression";
+ return 0;
+ }
+
/*
* Allow dynamic xlat expansion everywhere.
*/
if (*p != '/') {
return_P("Expected regular expression");
}
-
- } else if (*p == '/') {
- return_P("Unexpected regular expression");
- }
+ } /* else treat '/' as any other character */
switch (*p) {
/*