Adds support to include path between quotes

This commit is contained in:
Felipe Zimmerle 2015-09-29 10:43:28 -03:00
parent b497091017
commit 70e2a4b379
2 changed files with 18 additions and 3 deletions

View File

@ -382,6 +382,23 @@ CONFIG_DIR_UNICODE_MAP_FILE (?i:SecUnicodeMapFile)
yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ));
}
{CONFIG_INCLUDE}[ ]["]{CONFIG_VALUE_PATH}["] {
const char *file = strchr(yytext, ' ') + 1;
char *f = strdup(file + 1);
f[strlen(f)-1] = '\0';
yyin = fopen(f, "r" );
if (!yyin) {
BEGIN(INITIAL);
driver.error (*driver.loc.back(), "", yytext + std::string(": Not able to open file."));
throw yy::seclang_parser::syntax_error(*driver.loc.back(), "");
}
free(f);
driver.ref.push_back(file);
driver.loc.push_back(new yy::location());
yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ));
}
{CONFIG_SEC_REMOTE_RULES}[ ][^ ]+[ ][^\n\r ]+ {
HttpsClient c;
std::string key;

View File

@ -1,3 +1 @@
SecRule ARGS "@contains /test.txt" "allow"
SecRule ARGS:teste "@contains /test.txt" " allow,deny"
SecRule ARGS "@contains /test.txt" "allow, allow,deny"
include "owasp-modsecurity-crs-orig/modsecurity_crs_10_setup.conf"