Squashed commit of the following:
commit
67d68cd61b13cf5c10f0e19a1df3923c064576a4
Author: Serhii Vlasiuk <svlasiuk@cisco.com>
Date: Mon Oct 12 18:38:49 2020 +0300
snort2lua: update comments for deleted rule_state options
* all rules must have a sid
* sid == 0 not allowed
* deleted activate / dynamic rules
-* deleted unused rule_state.action
* deleted metadata engine shared
* deleted metadata: rule-flushing (with PDU flushing rule flushing can cause
missed attacks, the opposite of its intent)
end
if line =~ delete_pattern
- arr << "deleted -> #{snort_opt}: '#{$1}'"
+ arr << "deleted -> #{snort_opt.strip}: '#{$1.strip}'"
end
if line =~ diff_pattern
- arr << "change -> #{snort_opt}: '#{$1}' ==> '#{$2}'"
+ arr << "change -> #{snort_opt.strip}: '#{$1.strip}' ==> '#{$2.strip}'"
end
if line =~ template_diff
- arr << "change -> config '#{$1}' ==> '#{$2}.#{$3}'"
+ arr << "change -> config '#{$1.strip}' ==> '#{$2.strip}.#{$3.strip}'"
end
if line =~ config_delete_template
- arr << "deleted -> config '#{$1}'"
+ arr << "deleted -> config '#{$1.strip}'"
end
# Files with special templates
if line =~ paths_diff
- arr << "change -> #{$1} ==> 'snort.--plugin_path=<path>'"
+ arr << "change -> #{$1.strip} ==> 'snort.--plugin_path=<path>'"
end
if line =~ normalizers_diff
- arr << "change -> preprocessor 'normalize_#{$1}' ==> 'normalize.#{$1}'"
+ arr << "change -> preprocessor 'normalize_#{$1.strip}' ==> 'normalize.#{$1.strip}'"
end
if line =~ unified2_diff
- arr << "change -> unified2: '#{$1}' ==> 'unified2'"
+ arr << "change -> unified2: '#{$1.strip}' ==> 'unified2'"
end
end
curr_state->add_option(name, val);
}
-void StateApi::add_comment(const std::string& comment)
+void StateApi::add_deleted_comment(const std::string& option)
{
if ( curr_state )
+ {
+ std::string comment = "rule_state option '" + option + "' deleted";
curr_state->add_comment(comment);
+ }
}
void StateApi::print_states(std::ostream& out) const
void clear();
bool empty() const;
void add_option(const std::string& keyword, const std::string& val);
- void add_comment(const std::string& comment);
+ void add_deleted_comment(const std::string& option);
void set_action(const std::string& action);
void print_states(std::ostream& out) const;
if ( !enable.empty() )
{
state_api.add_option("enable", enable);
- state_api.add_comment("option change: 'enabled/disabled' --> 'enable'");
+ state_api.add_deleted_comment("enable");
}
if ( !action.empty() )
if ( action == "sdrop" )
{
action = "drop";
- state_api.add_comment("action change: 'sdrop' --> 'drop'");
+ state_api.add_deleted_comment("action");
}
state_api.set_action(action);