From 44e7fdc3ca9add50e254f4c87fad63e8d0fe246f Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 12 Jan 2024 09:51:02 +0100 Subject: [PATCH] detect/noalert: minor cleanup --- src/detect-noalert.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/detect-noalert.c b/src/detect-noalert.c index dda060a4f0..fce16875e4 100644 --- a/src/detect-noalert.c +++ b/src/detect-noalert.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2010 Open Information Security Foundation +/* Copyright (C) 2007-2024 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free @@ -27,10 +27,17 @@ #include "detect.h" #include "detect-noalert.h" #include "util-debug.h" +#include "util-validate.h" -static int DetectNoalertSetup (DetectEngineCtx *, Signature *, const char *); +static int DetectNoalertSetup(DetectEngineCtx *de_ctx, Signature *s, const char *nullstr) +{ + DEBUG_VALIDATE_BUG_ON(nullstr != NULL); + + s->flags |= SIG_FLAG_NOALERT; + return 0; +} -void DetectNoalertRegister (void) +void DetectNoalertRegister(void) { sigmatch_table[DETECT_NOALERT].name = "noalert"; sigmatch_table[DETECT_NOALERT].desc = "no alert will be generated by the rule"; @@ -38,15 +45,3 @@ void DetectNoalertRegister (void) sigmatch_table[DETECT_NOALERT].Setup = DetectNoalertSetup; sigmatch_table[DETECT_NOALERT].flags |= SIGMATCH_NOOPT; } - -static int DetectNoalertSetup (DetectEngineCtx *de_ctx, Signature *s, const char *nullstr) -{ - if (nullstr != NULL) { - SCLogError("nocase has no value"); - return -1; - } - - s->flags |= SIG_FLAG_NOALERT; - return 0; -} -