From: Josh Date: Thu, 17 Jul 2014 18:53:51 +0000 (-0400) Subject: tweaking rule_content and changing 'config profile' to reflect changed module name X-Git-Tag: 3.0.0-233~1175^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86f178c0375c08088c07881fe9865407010dda86;p=thirdparty%2Fsnort3.git tweaking rule_content and changing 'config profile' to reflect changed module name --- diff --git a/tools/snort2lua/config_states/config_profile.cc b/tools/snort2lua/config_states/config_profile.cc index 258725319..d5da9738e 100644 --- a/tools/snort2lua/config_states/config_profile.cc +++ b/tools/snort2lua/config_states/config_profile.cc @@ -139,7 +139,7 @@ static ConversionState* ctor(Converter* cv, LuaData* ld) **************************/ static const std::string rules = "rules"; -static const std::string preprocs = "preprocs"; +static const std::string modules = "modules"; static const ConvertMap profile_rules_api = @@ -151,7 +151,7 @@ static const ConvertMap profile_rules_api = static const ConvertMap profile_preprocs_api = { "profile_preprocs", - ctor<&preprocs>, + ctor<&modules>, }; const ConvertMap* profile_rules_map = &profile_rules_api; diff --git a/tools/snort2lua/rule_states/rule_content.cc b/tools/snort2lua/rule_states/rule_content.cc index 2bd45c9e0..aab5ed1d7 100644 --- a/tools/snort2lua/rule_states/rule_content.cc +++ b/tools/snort2lua/rule_states/rule_content.cc @@ -64,25 +64,17 @@ bool Content::convert(std::istringstream& data_stream) val = util::get_rule_option_args(data_stream); std::istringstream subopts(val); - while(subopts >> val) + while(util::get_string(subopts, keyword, ":")) { bool tmpval = true; - util::trim(val); - std::size_t keyword_pos = val.find_first_of(':'); - std::string keyword; + val = std::string(); + std::string tmp_str; - if (keyword_pos != std::string::npos) - { - keyword = val.substr(0, keyword_pos); - val = val.substr(keyword_pos + 1, std::string::npos); - } - else - { - keyword = val; - val = std::string(); - } + // get the rest of this option + while(subopts >> tmp_str) + val += tmp_str + " "; - // necessary since get_line and substr return strings with whitespace. + // necessary since options contain whitespace util::trim(keyword); util::trim(val);