Fix rule file inclusion path

The inclusion was not taking `*' into consideration, leading the
relative configuration inclusion to fail. That was very annoying.
This commit is contained in:
Felipe Zimmerle
2016-11-11 15:03:15 -03:00
parent 361ec8340f
commit 8b4f1bc46c
2 changed files with 14 additions and 2 deletions

View File

@@ -396,7 +396,8 @@ VAR_FREE_TEXT_SPACE_COMMA [^, \t\"]+
{CONFIG_INCLUDE}[ ]{CONFIG_VALUE_PATH} {
const char *file = strchr(yytext, ' ') + 1;
for (auto& s: modsecurity::utils::expandEnv(file, 0)) {
std::string fi = modsecurity::utils::find_resource(file, driver.ref.back());
for (auto& s: modsecurity::utils::expandEnv(fi, 0)) {
std::string f = modsecurity::utils::find_resource(s, driver.ref.back());
yyin = fopen(f.c_str(), "r" );
if (!yyin) {
@@ -414,7 +415,8 @@ VAR_FREE_TEXT_SPACE_COMMA [^, \t\"]+
const char *file = strchr(yytext, ' ') + 1;
char *f = strdup(file + 1);
f[strlen(f)-1] = '\0';
for (auto& s: modsecurity::utils::expandEnv(f, 0)) {
std::string fi = modsecurity::utils::find_resource(f, driver.ref.back());
for (auto& s: modsecurity::utils::expandEnv(fi, 0)) {
std::string f = modsecurity::utils::find_resource(s, driver.ref.back());
yyin = fopen(f.c_str(), "r" );
if (!yyin) {