|
|
|
@ -486,45 +486,24 @@ end:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int DetectUriSigTest01(void)
|
|
|
|
int DetectUriSigTest01(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SigMatch *sm = NULL;
|
|
|
|
|
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
ThreadVars th_v;
|
|
|
|
ThreadVars th_v;
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
|
|
|
Signature *s = NULL;
|
|
|
|
Signature *s = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
memset(&th_v, 0, sizeof(th_v));
|
|
|
|
memset(&th_v, 0, sizeof(th_v));
|
|
|
|
|
|
|
|
|
|
|
|
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
|
|
|
|
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
|
|
|
|
if (de_ctx == NULL) {
|
|
|
|
FAIL_IF_NULL(de_ctx);
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
de_ctx->flags |= DE_QUIET;
|
|
|
|
de_ctx->flags |= DE_QUIET;
|
|
|
|
|
|
|
|
|
|
|
|
s = de_ctx->sig_list = SigInit(de_ctx,"alert http any any -> any any (msg:"
|
|
|
|
s = DetectEngineAppendSig(de_ctx,"alert http any any -> any any (msg:"
|
|
|
|
"\" Test uricontent\"; "
|
|
|
|
"\" Test uricontent\"; content:\"me\"; uricontent:\"me\"; sid:1;)");
|
|
|
|
"content:\"me\"; uricontent:\"me\"; sid:1;)");
|
|
|
|
FAIL_IF_NULL(s);
|
|
|
|
if (s == NULL) {
|
|
|
|
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SigGroupBuild(de_ctx);
|
|
|
|
|
|
|
|
DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BUG_ON(de_ctx->sig_list->sm_lists[DETECT_SM_LIST_UMATCH] == NULL);
|
|
|
|
BUG_ON(s->sm_lists[DETECT_SM_LIST_UMATCH] == NULL);
|
|
|
|
|
|
|
|
FAIL_IF_NOT(de_ctx->sig_list->sm_lists[DETECT_SM_LIST_UMATCH]->type == DETECT_CONTENT);
|
|
|
|
|
|
|
|
|
|
|
|
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_UMATCH];
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
if (sm->type == DETECT_CONTENT) {
|
|
|
|
PASS;
|
|
|
|
result = 1;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
result = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end:
|
|
|
|
|
|
|
|
if (de_ctx != NULL) SigGroupCleanup(de_ctx);
|
|
|
|
|
|
|
|
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
|
|
|
|
|
|
|
|
if (det_ctx != NULL) DetectEngineThreadCtxDeinit(&th_v, det_ctx);
|
|
|
|
|
|
|
|
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** \test Check the signature working to alert when http_cookie is matched . */
|
|
|
|
/** \test Check the signature working to alert when http_cookie is matched . */
|
|
|
|
|