From ea8eaf31aa5c0910d8fa0352c80d83f172bb70a8 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Wed, 10 Nov 2010 11:43:31 +0530 Subject: [PATCH] Fix fast_pattern tests that always showed success, irrespective of test results --- src/detect-fast-pattern.c | 48 ++++----------------------------------- 1 file changed, 4 insertions(+), 44 deletions(-) diff --git a/src/detect-fast-pattern.c b/src/detect-fast-pattern.c index 7cc690ece2..ea6bac2fca 100644 --- a/src/detect-fast-pattern.c +++ b/src/detect-fast-pattern.c @@ -1291,7 +1291,7 @@ int DetectFastPatternTest28(void) if (de_ctx->sig_list == NULL) goto end; - DetectContentData *cd = de_ctx->sig_list->pmatch_tail->prev->ctx; + DetectContentData *cd = de_ctx->sig_list->pmatch_tail->ctx; if (cd->flags & DETECT_CONTENT_FAST_PATTERN && cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY && !(cd->flags & cd->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) && @@ -1302,8 +1302,6 @@ int DetectFastPatternTest28(void) result = 0; } - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1323,7 +1321,7 @@ int DetectFastPatternTest29(void) "(content:one; content:two; within:30; content:two; fast_pattern:only; sid:1;)"); if (de_ctx->sig_list == NULL) goto end; - DetectContentData *cd = de_ctx->sig_list->pmatch_tail->prev->ctx; + DetectContentData *cd = de_ctx->sig_list->pmatch_tail->ctx; if (cd->flags & DETECT_CONTENT_FAST_PATTERN && cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY && !(cd->flags & cd->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) && @@ -1334,8 +1332,6 @@ int DetectFastPatternTest29(void) result = 0; } - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1355,7 +1351,7 @@ int DetectFastPatternTest30(void) "(content:one; content:two; offset:30; content:two; fast_pattern:only; sid:1;)"); if (de_ctx->sig_list == NULL) goto end; - DetectContentData *cd = de_ctx->sig_list->pmatch_tail->prev->ctx; + DetectContentData *cd = de_ctx->sig_list->pmatch_tail->ctx; if (cd->flags & DETECT_CONTENT_FAST_PATTERN && cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY && !(cd->flags & cd->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) && @@ -1366,8 +1362,6 @@ int DetectFastPatternTest30(void) result = 0; } - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1387,7 +1381,7 @@ int DetectFastPatternTest31(void) "(content:one; content:two; depth:30; content:two; fast_pattern:only; sid:1;)"); if (de_ctx->sig_list == NULL) goto end; - DetectContentData *cd = de_ctx->sig_list->pmatch_tail->prev->ctx; + DetectContentData *cd = de_ctx->sig_list->pmatch_tail->ctx; if (cd->flags & DETECT_CONTENT_FAST_PATTERN && cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY && !(cd->flags & cd->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) && @@ -1398,8 +1392,6 @@ int DetectFastPatternTest31(void) result = 0; } - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1431,8 +1423,6 @@ int DetectFastPatternTest32(void) result = 0; } - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1551,9 +1541,6 @@ int DetectFastPatternTest37(void) result = 0; } - - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1584,9 +1571,6 @@ int DetectFastPatternTest38(void) result = 0; } - - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1617,9 +1601,6 @@ int DetectFastPatternTest39(void) result = 0; } - - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1650,9 +1631,6 @@ int DetectFastPatternTest40(void) result = 0; } - - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1683,9 +1661,6 @@ int DetectFastPatternTest41(void) result = 0; } - - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1716,9 +1691,6 @@ int DetectFastPatternTest42(void) result = 0; } - - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1749,9 +1721,6 @@ int DetectFastPatternTest43(void) result = 0; } - - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1782,9 +1751,6 @@ int DetectFastPatternTest44(void) result = 0; } - - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1815,9 +1781,6 @@ int DetectFastPatternTest45(void) result = 0; } - - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx); @@ -1915,9 +1878,6 @@ int DetectFastPatternTest49(void) result = 0; } - - result = 1; - end: SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx);