From 9cecd29fd47e632033cddcfde7592d4dd6210bee Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 5 Mar 2026 07:56:38 +0100 Subject: [PATCH] detect/parse: convert test to fail/pass --- src/detect-parse.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/detect-parse.c b/src/detect-parse.c index 88875c096e..8bd5902a1a 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -4824,26 +4824,15 @@ static int SigParseTestNegation02 (void) */ static int SigParseTestNegation03 (void) { - int result = 0; - DetectEngineCtx *de_ctx; - Signature *s=NULL; - - de_ctx = DetectEngineCtxInit(); - if (de_ctx == NULL) - goto end; + DetectEngineCtx *de_ctx = DetectEngineCtxInit(); + FAIL_IF_NULL(de_ctx); de_ctx->flags |= DE_QUIET; - - s = SigInit(de_ctx,"alert tcp any any -> any [80:!80] (msg:\"SigTest41-03 dst port [80:!80] \"; classtype:misc-activity; sid:410003; rev:1;)"); - if (s != NULL) { - SigFree(de_ctx, s); - goto end; - } - - result = 1; -end: - if (de_ctx != NULL) - DetectEngineCtxFree(de_ctx); - return result; + Signature *s = DetectEngineAppendSig(de_ctx, + "alert tcp any any -> any [80:!80] (msg:\"SigTest41-03 dst port [80:!80] \"; " + "classtype:misc-activity; sid:410003; rev:1;)"); + FAIL_IF_NOT_NULL(s); + DetectEngineCtxFree(de_ctx); + PASS; } /** * \test check that we don't allow invalid negation options