Go to the documentation of this file.
39 static void DetectMsgRegisterTests(
void);
58 size_t slen = strlen(msgstr);
63 strlcpy(input, msgstr, slen + 1);
72 for (i = 0, x = 0; i < slen; i++) {
74 if(!escape &&
str[i] ==
'\\') {
82 SCLogDebug(
"character \"%c\" does not need to be escaped but is" ,
str[i]);
97 for (i = 0; i < x; i++) {
110 if (s->
msg != NULL) {
111 SCLogError(
"duplicated 'msg' keyword detected");
126 static int DetectMsgParseTest01(
void)
128 const char *teststringparsed =
"flow stateless to_server";
136 "alert tcp any any -> any any (msg:\"flow stateless to_server\"; "
137 "flow:stateless,to_server; content:\"flowstatelesscheck\"; "
138 "classtype:bad-unknown; sid: 40000002; rev: 1;)");
141 FAIL_IF(strcmp(sig->
msg, teststringparsed) != 0);
148 static int DetectMsgParseTest02(
void)
150 const char *teststringparsed =
"msg escape tests wxy'\"\\;:";
155 "alert tcp any any -> any any (msg:\"msg escape tests \\w\\x\\y\\'\\\"\\\\;\\:\"; "
156 "flow:to_server,established; content:\"blah\"; uricontent:\"/blah/\"; sid: 100;)");
159 FAIL_IF(strcmp(sig->
msg, teststringparsed) != 0);
166 static int DetectMsgParseTest03(
void)
168 const char *teststringparsed =
"flow stateless to_server";
176 "alert tcp any any -> any any (msg: \"flow stateless to_server\"; "
177 "flow:stateless,to_server; content:\"flowstatelesscheck\"; "
178 "classtype:bad-unknown; sid: 40000002; rev: 1;)");
181 FAIL_IF(strcmp(sig->
msg, teststringparsed) != 0);
191 void DetectMsgRegisterTests(
void)
void DetectMsgRegister(void)
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
SigTableElmt * sigmatch_table
void(* Free)(DetectEngineCtx *, void *)
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
main detection engine ctx
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Signature * DetectEngineAppendSig(DetectEngineCtx *, const char *)
Parse and append a Signature into the Detection Engine Context signature list.
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
size_t strlcpy(char *dst, const char *src, size_t siz)
#define SIGMATCH_QUOTES_MANDATORY
#define PASS
Pass the test.
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
#define SCLogError(...)
Macro used to log ERROR messages.
DetectEngineCtx * DetectEngineCtxInit(void)
FILE * SCClassConfGenerateValidDummyClassConfigFD01(void)
Creates a dummy classification file, with all valid Classtypes, for testing purposes.
int SCLogDebugEnabled(void)
Returns whether debug messages are enabled to be logged or not.
bool SCClassConfLoadClassificationConfigFile(DetectEngineCtx *de_ctx, FILE *fd)
Loads the Classtype info from the classification.config file.
void(* RegisterTests)(void)