]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/parse: cleanup test
authorVictor Julien <vjulien@oisf.net>
Wed, 25 May 2022 13:01:15 +0000 (15:01 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 27 May 2022 17:41:12 +0000 (19:41 +0200)
src/detect-parse.c

index 01070462e2e0b3278445797d806b58d9e5bbe300..b1b1e7cb8f1fb1f799655fdeed18fd55eacc5d9e 100644 (file)
@@ -3907,26 +3907,14 @@ end:
  */
 static int SigParseTestNegation07 (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 -> [192.168.0.2,!192.168.0.0/24] any (msg:\"SigTest41-06 dst ip [192.168.0.2,!192.168.0.0/24] \"; classtype:misc-activity; sid:410006; 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 -> [192.168.0.2,!192.168.0.0/24] any (sid:410006;)");
+    FAIL_IF_NOT_NULL(s);
+    DetectEngineCtxFree(de_ctx);
+    PASS;
 }
 
 /**