-- added IpsOption CursorActionType
-- finally eliminated doe_ptr and friends ... yay!
-- merged ips_option_base64_{data,decode}.cc
+-- fast_pattern_only (previously fast_pattern:only) is gone
+ (delete the option, Snort will figure it out)
90
-- added InspectApi.buffers and Inspector::getbuf()
#include "detection/detection_util.h"
#define MAX_PATTERN_SIZE 2048
-#define PM_FP_ONLY "only"
#ifdef PERF_PROFILING
static THREAD_LOCAL PreprocStats contentPerfStats;
{
// this is provisional; will be disabled later if there
// is a relative rule option following this one
- pmd->fp_only = false; // true; FIXIT integrate this with parse_rule.cc::ValidateFastPattern()
+ // see parse_rule.cc::ValidateFastPattern()
+ pmd->fp_only = 1;
}
}
return pmd->fp_only != 0;
}
+void clear_fast_pattern_only(OptFpList* ofl)
+{
+ PatternMatchData* pmd = get_pmd(ofl);
+
+ if ( pmd )
+ pmd->fp_only = 0;
+}
+
bool is_unbounded(void* pv)
{
ContentOption* opt = (ContentOption*)pv;
// so PMD isn't exposed
PatternMatchData* get_pmd(OptFpList*);
bool is_fast_pattern_only(OptFpList*);
+void clear_fast_pattern_only(OptFpList*);
bool is_unbounded(void*);
#endif
static void ValidateFastPattern(OptTreeNode *otn)
{
- OptFpList* fpl;
+ OptFpList* fpl, * fp = nullptr;
bool relative_is_bad_mkay = false;
for(fpl = otn->opt_func; fpl != NULL; fpl = fpl->next)
if ( relative_is_bad_mkay )
{
if (fpl->isRelative)
- ParseWarning("relative rule option used after "
- "fast_pattern:only");
+ {
+ assert(fp);
+ clear_fast_pattern_only(fp);
+ }
}
// reset the check if one of these are present.
- if ( fpl->context && (fpl->type != RULE_OPTION_TYPE_CONTENT) )
+ if ( fpl->type != RULE_OPTION_TYPE_CONTENT )
{
- if ( IpsOption::get_cat(fpl->context) > CAT_NONE )
+ if ( fpl->context && IpsOption::get_cat(fpl->context) > CAT_NONE )
relative_is_bad_mkay = false;
}
// set/unset the check on content options.
else
{
if ( is_fast_pattern_only(fpl) )
+ {
+ fp = fpl;
relative_is_bad_mkay = true;
+ }
else
relative_is_bad_mkay = false;
}