data_api.set_current_line(++line_num);
std::size_t first_non_white_char = tmp.find_first_not_of(' ');
- if ((first_non_white_char == std::string::npos) ||
+ bool commented_rule = false;
+ if ( tmp.length() > first_non_white_char + 7 )
+ commented_rule = tmp.compare(first_non_white_char, 7, "# alert") == 0;
+ if ( !commented_rule && ((first_non_white_char == std::string::npos) ||
(tmp[first_non_white_char] == '#') ||
- (tmp[first_non_white_char] == ';')) // no, i did not know that semicolons made a
+ (tmp[first_non_white_char] == ';'))) // no, i did not know that semicolons made a
// line a comment
{
util::trim(tmp);
orig_text += tmp;
std::istringstream data_stream(orig_text);
+ if (commented_rule)
+ {
+ std::string hash_char;
+ data_stream >> hash_char;
+ }
+
try
{
while (data_stream.peek() != EOF)
break;
}
}
+ if (commented_rule)
+ get_rule_api().make_rule_a_comment();
if(empty_args)
{
set_empty_args(false);
}
static const std::string alert = "alert";
+static const std::string c_alert = "# alert";
static const std::string block = "block";
static const std::string log = "log";
static const std::string pass = "pass";
static const std::string dynamic = "dynamic";
static const ConvertMap alert_api = { alert, rule_ctor<& alert>};
+static const ConvertMap c_alert_api = { c_alert, rule_ctor<& c_alert>};
static const ConvertMap block_api = { block, rule_ctor<& block>};
static const ConvertMap log_api = { log, rule_ctor<& log>};
static const ConvertMap pass_api = { pass, rule_ctor<& pass>};
static const ConvertMap dynamic_api = { dynamic, dep_rule_ctor<& dynamic>};
const ConvertMap* alert_map = &alert_api;
+const ConvertMap* c_alert_map = &c_alert_api;
const ConvertMap* block_map = &block_api;
const ConvertMap* log_map = &log_api;
const ConvertMap* pass_map = &pass_api;