mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Searches for included configuration using the resource policy
This commit is contained in:
parent
e54ef72051
commit
e57ee8908f
@ -377,16 +377,16 @@ CONFIG_DIR_UNICODE_MAP_FILE (?i:SecUnicodeMapFile)
|
|||||||
{CONFIG_INCLUDE}[ ]{CONFIG_VALUE_PATH} {
|
{CONFIG_INCLUDE}[ ]{CONFIG_VALUE_PATH} {
|
||||||
const char *file = strchr(yytext, ' ') + 1;
|
const char *file = strchr(yytext, ' ') + 1;
|
||||||
for (auto& s: ModSecurity::expandEnv(file, 0)) {
|
for (auto& s: ModSecurity::expandEnv(file, 0)) {
|
||||||
yyin = fopen(s.c_str(), "r" );
|
std::string f = ModSecurity::find_resource(s, driver.ref.back());
|
||||||
|
yyin = fopen(f.c_str(), "r" );
|
||||||
if (!yyin) {
|
if (!yyin) {
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
driver.error (*driver.loc.back(), "", s + std::string(": Not able to open file."));
|
driver.error (*driver.loc.back(), "", s + std::string(": Not able to open file."));
|
||||||
throw yy::seclang_parser::syntax_error(*driver.loc.back(), "");
|
throw yy::seclang_parser::syntax_error(*driver.loc.back(), "");
|
||||||
}
|
}
|
||||||
driver.ref.push_back(file);
|
driver.ref.push_back(f);
|
||||||
driver.loc.push_back(new yy::location());
|
driver.loc.push_back(new yy::location());
|
||||||
yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ));
|
yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,13 +395,14 @@ CONFIG_DIR_UNICODE_MAP_FILE (?i:SecUnicodeMapFile)
|
|||||||
char *f = strdup(file + 1);
|
char *f = strdup(file + 1);
|
||||||
f[strlen(f)-1] = '\0';
|
f[strlen(f)-1] = '\0';
|
||||||
for (auto& s: ModSecurity::expandEnv(f, 0)) {
|
for (auto& s: ModSecurity::expandEnv(f, 0)) {
|
||||||
yyin = fopen(s.c_str(), "r" );
|
std::string f = ModSecurity::find_resource(s, driver.ref.back());
|
||||||
|
yyin = fopen(f.c_str(), "r" );
|
||||||
if (!yyin) {
|
if (!yyin) {
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
driver.error (*driver.loc.back(), "", s + std::string(": Not able to open file."));
|
driver.error (*driver.loc.back(), "", s + std::string(": Not able to open file."));
|
||||||
throw yy::seclang_parser::syntax_error(*driver.loc.back(), "");
|
throw yy::seclang_parser::syntax_error(*driver.loc.back(), "");
|
||||||
}
|
}
|
||||||
driver.ref.push_back(s.c_str());
|
driver.ref.push_back(f.c_str());
|
||||||
driver.loc.push_back(new yy::location());
|
driver.loc.push_back(new yy::location());
|
||||||
yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ));
|
yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user