if (sig == NULL)
SCReturn;
if (sig->cd)
- DetectContentFree(sig->cd);
+ DetectContentFree(NULL, sig->cd);
SCFree(sig);
SCReturn;
}
goto end;
error:
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
ret = -1;
end:
SCReturnInt(ret);
Packet *p, const Signature *s, const SigMatchCtx *ctx);
static int DetectAppLayerEventSetupP1(DetectEngineCtx *, Signature *, const char *);
static void DetectAppLayerEventRegisterTests(void);
-static void DetectAppLayerEventFree(void *);
+static void DetectAppLayerEventFree(DetectEngineCtx *, void *);
static int DetectEngineAptEventInspect(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
const Signature *s, const SigMatchData *smd,
}
}
-static int DetectAppLayerEventSetupP2(Signature *s,
+static int DetectAppLayerEventSetupP2(DetectEngineCtx *de_ctx,
+ Signature *s,
SigMatch *sm)
{
AppLayerEventType event_type = 0;
/* DetectAppLayerEventParseAppP2 prints errors */
/* sm has been removed from lists by DetectAppLayerEventPrepare */
- SigMatchFree(sm);
+ SigMatchFree(de_ctx, sm);
return ret;
}
SigMatchAppendSMToList(s, sm, g_applayer_events_list_id);
error:
if (data) {
- DetectAppLayerEventFree(data);
+ DetectAppLayerEventFree(de_ctx, data);
}
if (sm) {
sm->ctx = NULL;
- SigMatchFree(sm);
+ SigMatchFree(de_ctx, sm);
}
return -1;
}
-static void DetectAppLayerEventFree(void *ptr)
+static void DetectAppLayerEventFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectAppLayerEventData *data = (DetectAppLayerEventData *)ptr;
if (data->arg != NULL)
return;
}
-int DetectAppLayerEventPrepare(Signature *s)
+int DetectAppLayerEventPrepare(DetectEngineCtx *de_ctx, Signature *s)
{
SigMatch *sm = s->init_data->smlists[g_applayer_events_list_id];
SigMatch *smn;
* called by DetectAppLayerEventSetupP2
*/
sm->next = sm->prev = NULL;
- int ret = DetectAppLayerEventSetupP2(s, sm);
+ int ret = DetectAppLayerEventSetupP2(de_ctx, s, sm);
if (ret < 0) {
// current one was freed, let's free the next ones
sm = smn;
while(sm) {
smn = sm->next;
- SigMatchFree(sm);
+ SigMatchFree(de_ctx, sm);
sm = smn;
}
return ret;
end:
AppLayerParserRestoreParserTable();
if (aled != NULL)
- DetectAppLayerEventFree(aled);
+ DetectAppLayerEventFree(NULL, aled);
return result;
}
FAIL_IF(aled->event_id != APP_LAYER_EVENT_TEST_MAP_EVENT5);
AppLayerParserRestoreParserTable();
- DetectAppLayerEventFree(aled);
+ DetectAppLayerEventFree(NULL, aled);
PASS;
}
FAIL_IF(aled->alproto != ALPROTO_UNKNOWN);
FAIL_IF(aled->event_id != DET_CTX_EVENT_TEST);
- DetectAppLayerEventFree(aled);
+ DetectAppLayerEventFree(NULL, aled);
PASS;
}
#endif /* UNITTESTS */
char *arg;
} DetectAppLayerEventData;
-int DetectAppLayerEventPrepare(Signature *s);
+int DetectAppLayerEventPrepare(DetectEngineCtx *de_ctx, Signature *s);
void DetectAppLayerEventRegister(void);
#endif /* __DETECT_APP_LAYER_EVENT_H__ */
return -1;
}
-static void DetectAppLayerProtocolFree(void *ptr)
+static void DetectAppLayerProtocolFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCFree(ptr);
return;
FAIL_IF_NULL(data);
FAIL_IF(data->alproto != ALPROTO_HTTP);
FAIL_IF(data->negated != 0);
- DetectAppLayerProtocolFree(data);
+ DetectAppLayerProtocolFree(NULL, data);
PASS;
}
FAIL_IF_NULL(data);
FAIL_IF(data->alproto != ALPROTO_HTTP);
FAIL_IF(data->negated == 0);
- DetectAppLayerProtocolFree(data);
+ DetectAppLayerProtocolFree(NULL, data);
PASS;
}
FAIL_IF_NULL(data);
FAIL_IF(data->alproto != ALPROTO_FAILED);
FAIL_IF(data->negated != 0);
- DetectAppLayerProtocolFree(data);
+ DetectAppLayerProtocolFree(NULL, data);
PASS;
}
FAIL_IF_NULL(data);
FAIL_IF(data->alproto != ALPROTO_FAILED);
FAIL_IF(data->negated == 0);
- DetectAppLayerProtocolFree(data);
+ DetectAppLayerProtocolFree(NULL, data);
PASS;
}
const Signature *, const SigMatchCtx *);
static int DetectAsn1Setup (DetectEngineCtx *, Signature *, const char *);
static void DetectAsn1RegisterTests(void);
-static void DetectAsn1Free(void *);
+static void DetectAsn1Free(DetectEngineCtx *, void *);
/**
* \brief Registration function for asn1
error:
if (ad != NULL)
- DetectAsn1Free(ad);
+ DetectAsn1Free(de_ctx, ad);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param ad pointer to DetectAsn1Data
*/
-static void DetectAsn1Free(void *ptr)
+static void DetectAsn1Free(DetectEngineCtx *de_ctx, void *ptr)
{
DetectAsn1Data *ad = (DetectAsn1Data *)ptr;
SCFree(ad);
if (ad->oversize_length == 1024 && (ad->flags & ASN1_OVERSIZE_LEN)) {
result = 1;
}
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
}
return result;
ad = DetectAsn1Parse(str);
if (ad != NULL && ad->absolute_offset == 1024
&& (ad->flags & ASN1_ABSOLUTE_OFFSET)) {
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 1;
}
ad = DetectAsn1Parse(str);
if (ad != NULL && ad->relative_offset == 1024
&& (ad->flags & ASN1_RELATIVE_OFFSET)) {
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 1;
}
ad = DetectAsn1Parse(str);
if (ad != NULL && (ad->flags & ASN1_BITSTRING_OVF)) {
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 1;
}
ad = DetectAsn1Parse(str);
if (ad != NULL && (ad->flags & ASN1_DOUBLE_OVF)) {
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 1;
}
ad = DetectAsn1Parse(str);
if (ad != NULL) {
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 0;
}
ad = DetectAsn1Parse(str);
if (ad != NULL) {
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 0;
}
ad = DetectAsn1Parse(str);
if (ad != NULL) {
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 0;
}
fd = DetectAsn1Parse(str);
if (fd != NULL) {
result = 0;
- DetectAsn1Free(fd);
+ DetectAsn1Free(NULL, fd);
}
return result;
fd = DetectAsn1Parse(str);
if (fd != NULL) {
result = 0;
- DetectAsn1Free(fd);
+ DetectAsn1Free(NULL, fd);
}
return result;
&& ad->relative_offset == 10
&& (ad->flags & ASN1_RELATIVE_OFFSET))
{
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 1;
}
&& ad->absolute_offset == 10
&& (ad->flags & ASN1_ABSOLUTE_OFFSET))
{
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 1;
}
&& ad->absolute_offset == 10
&& (ad->flags & ASN1_ABSOLUTE_OFFSET))
{
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 1;
}
&& ad->absolute_offset == 10
&& (ad->flags & ASN1_ABSOLUTE_OFFSET))
{
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 1;
}
&& ad->relative_offset == 10
&& (ad->flags & ASN1_RELATIVE_OFFSET))
{
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
result = 1;
}
FAIL_IF(result != 1);
SCAsn1CtxDestroy(ac);
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
PASS;
}
}
SCAsn1CtxDestroy(ac);
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
}
}
SCAsn1CtxDestroy(ac);
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
}
}
SCAsn1CtxDestroy(ac);
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
}
}
SCAsn1CtxDestroy(ac);
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
}
}
SCAsn1CtxDestroy(ac);
- DetectAsn1Free(ad);
+ DetectAsn1Free(NULL, ad);
}
static DetectParseRegex decode_pcre;
static int DetectBase64DecodeSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectBase64DecodeFree(void *);
+static void DetectBase64DecodeFree(DetectEngineCtx *, void *);
static void DetectBase64DecodeRegisterTests(void);
void DetectBase64DecodeRegister(void)
return -1;
}
-static void DetectBase64DecodeFree(void *ptr)
+static void DetectBase64DecodeFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectBase64Decode *data = ptr;
SCFree(data);
/*prototypes*/
static int DetectBsizeSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectBsizeFree (void *);
+static void DetectBsizeFree (DetectEngineCtx *, void *);
#ifdef UNITTESTS
static void DetectBsizeRegisterTests (void);
#endif
SCReturnInt(0);
error:
- DetectBsizeFree(bsz);
+ DetectBsizeFree(de_ctx, bsz);
SCReturnInt(-1);
}
*
* \param ptr pointer to DetectBsizeData
*/
-void DetectBsizeFree(void *ptr)
+void DetectBsizeFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr == NULL)
return;
static int DetectByteExtractSetup(DetectEngineCtx *, Signature *, const char *);
static void DetectByteExtractRegisterTests(void);
-static void DetectByteExtractFree(void *);
+static void DetectByteExtractFree(DetectEngineCtx *, void *);
/**
* \brief Registers the keyword handlers for the "byte_extract" keyword.
* \internal
* \brief Used to parse byte_extract arg.
*
+ * \param de_ctx Pointer to the detection engine context
* \arg The argument to parse.
*
* \param bed On success an instance containing the parsed data.
* On failure, NULL.
*/
-static inline DetectByteExtractData *DetectByteExtractParse(const char *arg)
+static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_ctx, const char *arg)
{
DetectByteExtractData *bed = NULL;
#undef MAX_SUBSTRINGS
return bed;
error:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(de_ctx, bed);
return NULL;
}
DetectByteExtractData *data = NULL;
int ret = -1;
- data = DetectByteExtractParse(arg);
+ data = DetectByteExtractParse(de_ctx, arg);
if (data == NULL)
goto error;
ret = 0;
return ret;
error:
- DetectByteExtractFree(data);
+ DetectByteExtractFree(de_ctx, data);
return ret;
}
*
* \param ptr Instance of DetectByteExtractData to be freed.
*/
-static void DetectByteExtractFree(void *ptr)
+static void DetectByteExtractFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr != NULL) {
DetectByteExtractData *bed = ptr;
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, relative");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, relative");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, multiplier 10");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, multiplier 10");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, relative, multiplier 10");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, relative, multiplier 10");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, big");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, big");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, little");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, little");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, dce");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, dce");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, string, hex");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, string, hex");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, string, oct");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, string, oct");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, string, dec");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, string, dec");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, relative");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, relative");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, relative, big");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, relative, big");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, relative, dce");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, relative, dce");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, relative, little");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, relative, little");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, relative, little, multiplier 2");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, relative, little, multiplier 2");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, "
"relative, little, "
"multiplier 2, string hex");
if (bed != NULL)
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, "
"relative, little, "
"multiplier 2, "
"relative");
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, "
"relative, little, "
"multiplier 2, "
"little");
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, "
"relative, "
"multiplier 2, "
"align 2");
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, "
"multiplier 2, "
"relative, "
"multiplier 2");
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, "
"string hex, "
"relative, "
"string hex");
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, "
"string hex, "
"relative, "
"string oct");
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("24, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "24, 2, one, align 4, "
"string hex, "
"relative");
if (bed != NULL)
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("9, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "9, 2, one, align 4, "
"little, "
"relative");
if (bed != NULL)
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, "
"little, "
"relative, "
"multiplier 65536");
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, align 4, "
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, align 4, "
"little, "
"relative, "
"multiplier 0");
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("23, 2, one, string, oct");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "23, 2, one, string, oct");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("24, 2, one, string, oct");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "24, 2, one, string, oct");
if (bed != NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("20, 2, one, string, dec");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "20, 2, one, string, dec");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("21, 2, one, string, dec");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "21, 2, one, string, dec");
if (bed != NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("14, 2, one, string, hex");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "14, 2, one, string, hex");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("15, 2, one, string, hex");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "15, 2, one, string, hex");
if (bed != NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, -2, one");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, -2, one");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
{
int result = 0;
- DetectByteExtractData *bed = DetectByteExtractParse("4, 2, one, string");
+ DetectByteExtractData *bed = DetectByteExtractParse(NULL, "4, 2, one, string");
if (bed == NULL)
goto end;
result = 1;
end:
if (bed != NULL)
- DetectByteExtractFree(bed);
+ DetectByteExtractFree(NULL, bed);
return result;
}
static int DetectBytejumpMatch(DetectEngineThreadCtx *det_ctx,
Packet *p, const Signature *s, const SigMatchCtx *ctx);
-static DetectBytejumpData *DetectBytejumpParse(const char *optstr, char **offset);
+static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const char *optstr, char **offset);
static int DetectBytejumpSetup(DetectEngineCtx *de_ctx, Signature *s, const char *optstr);
-static void DetectBytejumpFree(void *ptr);
+static void DetectBytejumpFree(DetectEngineCtx*, void *ptr);
static void DetectBytejumpRegisterTests(void);
void DetectBytejumpRegister (void)
return 1;
}
-static DetectBytejumpData *DetectBytejumpParse(const char *optstr, char **offset)
+static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const char *optstr, char **offset)
{
DetectBytejumpData *data = NULL;
char args[10][64];
*offset = NULL;
}
if (data != NULL)
- DetectBytejumpFree(data);
+ DetectBytejumpFree(de_ctx, data);
return NULL;
}
char *offset = NULL;
int ret = -1;
- data = DetectBytejumpParse(optstr, &offset);
+ data = DetectBytejumpParse(de_ctx, optstr, &offset);
if (data == NULL)
goto error;
if (offset != NULL) {
SCFree(offset);
}
- DetectBytejumpFree(data);
+ DetectBytejumpFree(de_ctx, data);
return ret;
}
*
* \param data pointer to DetectBytejumpData
*/
-static void DetectBytejumpFree(void *ptr)
+static void DetectBytejumpFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr == NULL)
return;
{
int result = 0;
DetectBytejumpData *data = NULL;
- data = DetectBytejumpParse("4,0", NULL);
+ data = DetectBytejumpParse(NULL, "4,0", NULL);
if (data != NULL) {
- DetectBytejumpFree(data);
+ DetectBytejumpFree(NULL, data);
result = 1;
}
{
int result = 0;
DetectBytejumpData *data = NULL;
- data = DetectBytejumpParse("4, 0", NULL);
+ data = DetectBytejumpParse(NULL, "4, 0", NULL);
if (data != NULL) {
if ( (data->nbytes == 4)
&& (data->offset == 0)
{
result = 1;
}
- DetectBytejumpFree(data);
+ DetectBytejumpFree(NULL, data);
}
return result;
{
int result = 0;
DetectBytejumpData *data = NULL;
- data = DetectBytejumpParse(" 4,0 , relative , little, string, "
+ data = DetectBytejumpParse(NULL, " 4,0 , relative , little, string, "
"dec, align, from_beginning", NULL);
if (data != NULL) {
if ( (data->nbytes == 4)
{
result = 1;
}
- DetectBytejumpFree(data);
+ DetectBytejumpFree(NULL, data);
}
return result;
{
int result = 0;
DetectBytejumpData *data = NULL;
- data = DetectBytejumpParse(" 4,0 , relative , little, string, "
+ data = DetectBytejumpParse(NULL, " 4,0 , relative , little, string, "
"dec, align, from_beginning , "
"multiplier 2 , post_offset -16 ", NULL);
if (data != NULL) {
{
result = 1;
}
- DetectBytejumpFree(data);
+ DetectBytejumpFree(NULL, data);
}
return result;
{
int result = 0;
DetectBytejumpData *data = NULL;
- data = DetectBytejumpParse(" 4,0 , relative , little, dec, "
+ data = DetectBytejumpParse(NULL, " 4,0 , relative , little, dec, "
"align, from_beginning", NULL);
if (data == NULL) {
result = 1;
{
int result = 0;
DetectBytejumpData *data = NULL;
- data = DetectBytejumpParse("9, 0", NULL);
+ data = DetectBytejumpParse(NULL, "9, 0", NULL);
if (data == NULL) {
result = 1;
}
{
int result = 0;
DetectBytejumpData *data = NULL;
- data = DetectBytejumpParse("24, 0, string, dec", NULL);
+ data = DetectBytejumpParse(NULL, "24, 0, string, dec", NULL);
if (data == NULL) {
result = 1;
}
{
int result = 0;
DetectBytejumpData *data = NULL;
- data = DetectBytejumpParse("4, 0xffffffffffffffff", NULL);
+ data = DetectBytejumpParse(NULL, "4, 0xffffffffffffffff", NULL);
if (data == NULL) {
result = 1;
}
int result = 1;
if (DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0) {
- SigFree(s);
+ SigFree(NULL, s);
return 0;
}
result &= (DetectBytejumpSetup(NULL, s, "4,0, from_beginning, dce") == -1);
result &= (s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
- SigFree(s);
+ SigFree(NULL, s);
return result;
}
static int DetectBytetestMatch(DetectEngineThreadCtx *det_ctx,
Packet *p, const Signature *s, const SigMatchCtx *ctx);
static int DetectBytetestSetup(DetectEngineCtx *de_ctx, Signature *s, const char *optstr);
-static void DetectBytetestFree(void *ptr);
+static void DetectBytetestFree(DetectEngineCtx *, void *ptr);
static void DetectBytetestRegisterTests(void);
void DetectBytetestRegister (void)
SCFree(offset);
if (value)
SCFree(value);
- DetectBytetestFree(data);
+ DetectBytetestFree(de_ctx, data);
return ret;
}
*
* \param data pointer to DetectBytetestData
*/
-static void DetectBytetestFree(void *ptr)
+static void DetectBytetestFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr == NULL)
return;
DetectBytetestData *data = NULL;
data = DetectBytetestParse("4, =, 1 , 0", NULL, NULL);
if (data != NULL) {
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
result = 1;
}
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
{
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
(data->flags & DETECT_BYTETEST_DCE) ) {
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
!(data->flags & DETECT_BYTETEST_DCE) ) {
result = 1;
}
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
}
return result;
int result = 1;
if (DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0) {
- SigFree(s);
+ SigFree(NULL, s);
return 0;
}
result &= (DetectBytetestSetup(NULL, s, "1,=,1,6,oct,dce") == -1);
result &= (DetectBytetestSetup(NULL, s, "1,=,1,6,dec,dce") == -1);
- SigFree(s);
+ SigFree(NULL, s);
return result;
}
FAIL_IF_NOT(data->bitmask == 0xf8);
FAIL_IF_NOT(data->bitmask_shift_count == 3);
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
PASS;
}
FAIL_IF_NOT(data->bitmask == 0xf8);
FAIL_IF_NOT(data->bitmask_shift_count == 3);
- DetectBytetestFree(data);
+ DetectBytetestFree(NULL, data);
PASS;
}
* \brief CIP Service Detect Prototypes
*/
static int DetectCipServiceSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectCipServiceFree(void *);
+static void DetectCipServiceFree(DetectEngineCtx *, void *);
static void DetectCipServiceRegisterTests(void);
static int g_cip_buffer_id = 0;
error:
if (cipserviced != NULL)
- DetectCipServiceFree(cipserviced);
+ DetectCipServiceFree(de_ctx, cipserviced);
if (sm != NULL)
SCFree(sm);
SCReturnInt(-1);
*
* \param ptr pointer to DetectCipServiceData
*/
-static void DetectCipServiceFree(void *ptr)
+static void DetectCipServiceFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectCipServiceData *cipserviced = (DetectCipServiceData *) ptr;
SCFree(cipserviced);
cipserviced = DetectCipServiceParse("7");
FAIL_IF_NULL(cipserviced);
FAIL_IF(cipserviced->cipservice != 7);
- DetectCipServiceFree(cipserviced);
+ DetectCipServiceFree(NULL, cipserviced);
PASS;
}
* \brief ENIP Commond Detect Prototypes
*/
static int DetectEnipCommandSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectEnipCommandFree(void *);
+static void DetectEnipCommandFree(DetectEngineCtx *, void *);
static void DetectEnipCommandRegisterTests(void);
static int g_enip_buffer_id = 0;
error:
if (enipcmdd != NULL)
- DetectEnipCommandFree(enipcmdd);
+ DetectEnipCommandFree(de_ctx, enipcmdd);
if (sm != NULL)
SCFree(sm);
SCReturnInt(-1);
*
* \param ptr pointer to DetectEnipCommandData
*/
-static void DetectEnipCommandFree(void *ptr)
+static void DetectEnipCommandFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectEnipCommandData *enipcmdd = (DetectEnipCommandData *) ptr;
SCFree(enipcmdd);
FAIL_IF_NULL(enipcmdd);
FAIL_IF_NOT(enipcmdd->enipcommand == 1);
- DetectEnipCommandFree(enipcmdd);
+ DetectEnipCommandFree(NULL, enipcmdd);
PASS;
}
return 0;
error:
- DetectContentFree(cd);
+ DetectContentFree(de_ctx, cd);
return -1;
}
*
* \param cd pointer to DetectContentData
*/
-void DetectContentFree(void *ptr)
+void DetectContentFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCEnter();
DetectContentData *cd = (DetectContentData *)ptr;
PrintRawUriFp(stdout,cd->content,cd->content_len);
SCLogDebug(": ");
result = 0;
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
}
} else {
SCLogDebug("expected %s got NULL: ", teststringparsed);
PrintRawUriFp(stdout,cd->content,cd->content_len);
SCLogDebug(": ");
result = 0;
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
}
} else {
SCLogDebug("expected %s got NULL: ", teststringparsed);
PrintRawUriFp(stdout,cd->content,cd->content_len);
SCLogDebug(": ");
result = 0;
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
}
} else {
SCLogDebug("expected %s got NULL: ", teststringparsed);
PrintRawUriFp(stdout,cd->content,cd->content_len);
SCLogDebug(": ");
result = 0;
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
}
} else {
SCLogDebug("expected %s got NULL: ", teststringparsed);
PrintRawUriFp(stdout,cd->content,cd->content_len);
SCLogDebug(": ");
result = 0;
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
}
SpmDestroyGlobalThreadCtx(spm_global_thread_ctx);
return result;
PrintRawUriFp(stdout,cd->content,cd->content_len);
SCLogDebug(": ");
result = 0;
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
}
} else {
SCLogDebug("expected %s got NULL: ", teststringparsed);
if (cd != NULL) {
SCLogDebug("expected NULL got %p: ", cd);
result = 0;
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
}
SpmDestroyGlobalThreadCtx(spm_global_thread_ctx);
return result;
if (cd != NULL) {
SCLogDebug("expected NULL got %p: ", cd);
result = 0;
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
}
SpmDestroyGlobalThreadCtx(spm_global_thread_ctx);
return result;
cd = DetectContentParse(spm_global_thread_ctx, teststring);
FAIL_IF_NULL(cd);
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
SpmDestroyGlobalThreadCtx(spm_global_thread_ctx);
PASS;
}
result &= (DetectContentSetup(de_ctx, s, "one") == 0);
result &= (s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
- SigFree(s);
+ SigFree(de_ctx, s);
s = SigAlloc();
if (s == NULL)
result &= (s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
end:
- SigFree(s);
+ SigFree(de_ctx, s);
DetectEngineCtxFree(de_ctx);
return result;
SpmDestroyGlobalThreadCtx(spm_global_thread_ctx);
SCFree(teststring);
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
return result;
}
SpmDestroyGlobalThreadCtx(spm_global_thread_ctx);
SCFree(teststring);
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
return result;
}
SpmDestroyGlobalThreadCtx(spm_global_thread_ctx);
SCFree(teststring);
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
return result;
}
SpmDestroyGlobalThreadCtx(spm_global_thread_ctx);
SCFree(teststring);
- DetectContentFree(cd);
+ DetectContentFree(NULL, cd);
return result;
}
int DetectContentSetup(DetectEngineCtx *de_ctx, Signature *s, const char *contentstr);
void DetectContentPrint(DetectContentData *);
-void DetectContentFree(void *);
+void DetectContentFree(DetectEngineCtx *, void *);
bool DetectContentPMATCHValidateCallback(const Signature *s);
void DetectContentPropagateLimits(Signature *s);
static int DetectIPV4CsumMatch(DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static int DetectIPV4CsumSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectIPV4CsumFree(void *);
+static void DetectIPV4CsumFree(DetectEngineCtx *, void *);
/* prototypes for the "tcpv4-csum" rule keyword */
static int DetectTCPV4CsumMatch(DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static int DetectTCPV4CsumSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectTCPV4CsumFree(void *);
+static void DetectTCPV4CsumFree(DetectEngineCtx *, void *);
/* prototypes for the "tcpv6-csum" rule keyword */
static int DetectTCPV6CsumMatch(DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static int DetectTCPV6CsumSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectTCPV6CsumFree(void *);
+static void DetectTCPV6CsumFree(DetectEngineCtx *, void *);
/* prototypes for the "udpv4-csum" rule keyword */
static int DetectUDPV4CsumMatch(DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static int DetectUDPV4CsumSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectUDPV4CsumFree(void *);
+static void DetectUDPV4CsumFree(DetectEngineCtx *, void *);
/* prototypes for the "udpv6-csum" rule keyword */
static int DetectUDPV6CsumMatch(DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static int DetectUDPV6CsumSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectUDPV6CsumFree(void *);
+static void DetectUDPV6CsumFree(DetectEngineCtx *de_ctx, void *);
/* prototypes for the "icmpv4-csum" rule keyword */
static int DetectICMPV4CsumMatch(DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static int DetectICMPV4CsumSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectICMPV4CsumFree(void *);
+static void DetectICMPV4CsumFree(DetectEngineCtx *, void *);
/* prototypes for the "icmpv6-csum" rule keyword */
static int DetectICMPV6CsumMatch(DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static int DetectICMPV6CsumSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectICMPV6CsumFree(void *);
+static void DetectICMPV6CsumFree(DetectEngineCtx *, void *);
static void DetectCsumRegisterTests(void);
return 0;
error:
- if (cd != NULL) DetectIPV4CsumFree(cd);
+ if (cd != NULL) DetectIPV4CsumFree(de_ctx, cd);
if (sm != NULL) SCFree(sm);
return -1;
}
-static void DetectIPV4CsumFree(void *ptr)
+static void DetectIPV4CsumFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectCsumData *cd = (DetectCsumData *)ptr;
return 0;
error:
- if (cd != NULL) DetectTCPV4CsumFree(cd);
+ if (cd != NULL) DetectTCPV4CsumFree(de_ctx, cd);
if (sm != NULL) SCFree(sm);
return -1;
}
-static void DetectTCPV4CsumFree(void *ptr)
+static void DetectTCPV4CsumFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectCsumData *cd = (DetectCsumData *)ptr;
return 0;
error:
- if (cd != NULL) DetectTCPV6CsumFree(cd);
+ if (cd != NULL) DetectTCPV6CsumFree(de_ctx, cd);
if (sm != NULL) SCFree(sm);
return -1;
}
-static void DetectTCPV6CsumFree(void *ptr)
+static void DetectTCPV6CsumFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectCsumData *cd = (DetectCsumData *)ptr;
return 0;
error:
- if (cd != NULL) DetectUDPV4CsumFree(cd);
+ if (cd != NULL) DetectUDPV4CsumFree(de_ctx, cd);
if (sm != NULL) SCFree(sm);
return -1;
}
-static void DetectUDPV4CsumFree(void *ptr)
+static void DetectUDPV4CsumFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectCsumData *cd = (DetectCsumData *)ptr;
return 0;
error:
- if (cd != NULL) DetectUDPV6CsumFree(cd);
+ if (cd != NULL) DetectUDPV6CsumFree(de_ctx, cd);
if (sm != NULL) SCFree(sm);
return -1;
}
-static void DetectUDPV6CsumFree(void *ptr)
+static void DetectUDPV6CsumFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectCsumData *cd = (DetectCsumData *)ptr;
return 0;
error:
- if (cd != NULL) DetectICMPV4CsumFree(cd);
+ if (cd != NULL) DetectICMPV4CsumFree(de_ctx, cd);
if (sm != NULL) SCFree(sm);
return -1;
}
-static void DetectICMPV4CsumFree(void *ptr)
+static void DetectICMPV4CsumFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectCsumData *cd = (DetectCsumData *)ptr;
return 0;
error:
- if (cd != NULL) DetectICMPV6CsumFree(cd);
+ if (cd != NULL) DetectICMPV6CsumFree(de_ctx, cd);
if (sm != NULL) SCFree(sm);
return -1;
}
-static void DetectICMPV6CsumFree(void *ptr)
+static void DetectICMPV6CsumFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectCsumData *cd = (DetectCsumData *)ptr;
int DetectDatarepMatch (ThreadVars *, DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectDatarepSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectDatarepFree (void *);
+void DetectDatarepFree (DetectEngineCtx *, void *);
void DetectDatarepRegister (void)
{
return -1;
}
-void DetectDatarepFree (void *ptr)
+void DetectDatarepFree (DetectEngineCtx *de_ctx, void *ptr)
{
DetectDatarepData *fd = (DetectDatarepData *)ptr;
int DetectDatasetMatch (ThreadVars *, DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectDatasetSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectDatasetFree (void *);
+void DetectDatasetFree (DetectEngineCtx *, void *);
void DetectDatasetRegister (void)
{
return -1;
}
-void DetectDatasetFree (void *ptr)
+void DetectDatasetFree (DetectEngineCtx *de_ctx, void *ptr)
{
DetectDatasetData *fd = (DetectDatasetData *)ptr;
if (fd == NULL)
Flow *f, uint8_t flags, void *state, void *txv,
const Signature *s, const SigMatchCtx *m);
static int DetectDceIfaceSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectDceIfaceFree(void *);
+static void DetectDceIfaceFree(DetectEngineCtx *, void *);
static void DetectDceIfaceRegisterTests(void);
static int g_dce_generic_list_id = 0;
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectDceIfaceFree(did);
+ DetectDceIfaceFree(de_ctx, did);
return -1;
}
return 0;
}
-static void DetectDceIfaceFree(void *ptr)
+static void DetectDceIfaceFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCFree(ptr);
result &= (did->op == 0);
result &= (did->any_frag == 0);
- SigFree(s);
+ SigFree(NULL, s);
SCReturnInt(result);
}
result &= (did->op == DETECT_DCE_IFACE_OP_GT);
result &= (did->any_frag == 0);
- SigFree(s);
+ SigFree(NULL, s);
SCReturnInt(result);
}
result &= (did->op == DETECT_DCE_IFACE_OP_LT);
result &= (did->any_frag == 0);
- SigFree(s);
+ SigFree(NULL, s);
SCReturnInt(result);
}
result &= (did->op == DETECT_DCE_IFACE_OP_NE);
result &= (did->any_frag == 0);
- SigFree(s);
+ SigFree(NULL, s);
SCReturnInt(result);
}
result &= (did->op == DETECT_DCE_IFACE_OP_EQ);
result &= (did->any_frag == 0);
- SigFree(s);
+ SigFree(NULL, s);
SCReturnInt(result);
}
result &= (did->op == 0);
result &= (did->any_frag == 1);
- SigFree(s);
+ SigFree(NULL, s);
SCReturnInt(result);
}
result &= (did->op == DETECT_DCE_IFACE_OP_GT);
result &= (did->any_frag == 1);
- SigFree(s);
+ SigFree(NULL, s);
SCReturnInt(result);
}
result &= (did->op == DETECT_DCE_IFACE_OP_LT);
result &= (did->any_frag == 1);
- SigFree(s);
+ SigFree(NULL, s);
SCReturnInt(result);
}
result &= (did->op == DETECT_DCE_IFACE_OP_EQ);
result &= (did->any_frag == 1);
- SigFree(s);
+ SigFree(NULL, s);
SCReturnInt(result);
}
result &= (did->op == DETECT_DCE_IFACE_OP_NE);
result &= (did->any_frag == 1);
- SigFree(s);
+ SigFree(NULL, s);
SCReturnInt(result);
}
result &= (DetectDceIfaceSetup(NULL, s, "12345678-1234-1234-1234-123456789ABC,<0,any_frag") == -1);
result &= (DetectDceIfaceSetup(NULL, s, "12345678-1234-1234-1234-123456789ABC,>65535,any_frag") == -1);
- SigFree(s);
+ SigFree(NULL, s);
return result;
}
Flow *f, uint8_t flags, void *state, void *txv,
const Signature *s, const SigMatchCtx *m);
static int DetectDceOpnumSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectDceOpnumFree(void *);
+static void DetectDceOpnumFree(DetectEngineCtx *, void *);
static void DetectDceOpnumRegisterTests(void);
static int g_dce_generic_list_id = 0;
/**
* \internal
* \brief Parses the argument sent along with the "dce_opnum" keyword.
- *
+ * \param de_ctx Pointer to the detection engine context
* \param arg Pointer to the string containing the argument to be parsed.
*
* \retval did Pointer to a DetectDceIfaceData instance that holds the data
* from the parsed arg.
*/
-static DetectDceOpnumData *DetectDceOpnumArgParse(const char *arg)
+static DetectDceOpnumData *DetectDceOpnumArgParse(DetectEngineCtx *de_ctx, const char *arg)
{
DetectDceOpnumData *dod = NULL;
error:
if (dup_str_head != NULL)
SCFree(dup_str_head);
- DetectDceOpnumFree(dod);
+ DetectDceOpnumFree(de_ctx, dod);
return NULL;
}
return -1;
}
- DetectDceOpnumData *dod = DetectDceOpnumArgParse(arg);
+ DetectDceOpnumData *dod = DetectDceOpnumArgParse(de_ctx, arg);
if (dod == NULL) {
SCLogError(SC_ERR_INVALID_SIGNATURE, "Error parsing dce_opnum option in "
"signature");
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectDceOpnumFree(dod);
+ DetectDceOpnumFree(de_ctx, dod);
return -1;
}
return 0;
}
-static void DetectDceOpnumFree(void *ptr)
+static void DetectDceOpnumFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectDceOpnumData *dod = ptr;
DetectDceOpnumRange *dor = NULL;
result &= (DetectDceOpnumSetup(NULL, s, "12-14,12,121,62-8") == -1);
if (s->sm_lists[g_dce_generic_list_id] != NULL) {
- SigFree(s);
+ SigFree(NULL, s);
result &= 1;
}
}
end:
- SigFree(s);
+ SigFree(NULL, s);
return result;
}
}
end:
- SigFree(s);
+ SigFree(NULL, s);
return result;
}
}
end:
- SigFree(s);
+ SigFree(NULL, s);
return result;
}
}
end:
- SigFree(s);
+ SigFree(NULL, s);
return result;
}
}
end:
- SigFree(s);
+ SigFree(NULL, s);
return result;
}
}
end:
- SigFree(s);
+ SigFree(NULL, s);
return result;
}
Packet *, const Signature *, const SigMatchCtx *);
static int DetectDetectionFilterSetup(DetectEngineCtx *, Signature *, const char *);
static void DetectDetectionFilterRegisterTests(void);
-static void DetectDetectionFilterFree(void *);
+static void DetectDetectionFilterFree(DetectEngineCtx *, void *);
/**
* \brief Registration function for detection_filter: keyword
*
* \param df_ptr pointer to DetectDetectionFilterData
*/
-static void DetectDetectionFilterFree(void *df_ptr)
+static void DetectDetectionFilterFree(DetectEngineCtx *de_ctx, void *df_ptr)
{
DetectThresholdData *df = (DetectThresholdData *)df_ptr;
if (df)
DetectThresholdData *df = NULL;
df = DetectDetectionFilterParse("track by_dst,count 10,seconds 60");
if (df && (df->track == TRACK_DST) && (df->count == 10) && (df->seconds == 60)) {
- DetectDetectionFilterFree(df);
+ DetectDetectionFilterFree(NULL, df);
return 1;
}
DetectThresholdData *df = NULL;
df = DetectDetectionFilterParse("track both,count 10,seconds 60");
if (df && (df->track == TRACK_DST || df->track == TRACK_SRC) && (df->count == 10) && (df->seconds == 60)) {
- DetectDetectionFilterFree(df);
+ DetectDetectionFilterFree(NULL, df);
return 0;
}
DetectThresholdData *df = NULL;
df = DetectDetectionFilterParse("track by_dst, seconds 60, count 10");
if (df && (df->track == TRACK_DST) && (df->count == 10) && (df->seconds == 60)) {
- DetectDetectionFilterFree(df);
+ DetectDetectionFilterFree(NULL, df);
return 1;
}
DetectThresholdData *df = NULL;
df = DetectDetectionFilterParse("count 10, track by_dst, seconds 60, count 10");
if (df && (df->track == TRACK_DST) && (df->count == 10) && (df->seconds == 60)) {
- DetectDetectionFilterFree(df);
+ DetectDetectionFilterFree(NULL, df);
return 0;
}
DetectThresholdData *df = NULL;
df = DetectDetectionFilterParse("count 10, track by_dst, seconds 60");
if (df && (df->track == TRACK_DST) && (df->count == 10) && (df->seconds == 60)) {
- DetectDetectionFilterFree(df);
+ DetectDetectionFilterFree(NULL, df);
return 1;
}
DetectThresholdData *df = NULL;
df = DetectDetectionFilterParse("count 10, track by_dst, seconds 0");
if (df && (df->track == TRACK_DST) && (df->count == 10) && (df->seconds == 0)) {
- DetectDetectionFilterFree(df);
+ DetectDetectionFilterFree(NULL, df);
return 0;
}
SCReturnInt(0);
}
-static void DetectDNP3Free(void *ptr)
+static void DetectDNP3Free(DetectEngineCtx *de_ctx, void *ptr)
{
SCEnter();
if (ptr != NULL) {
static int dns_opcode_list_id = 0;
-static void DetectDnsOpcodeFree(void *ptr);
+static void DetectDnsOpcodeFree(DetectEngineCtx *, void *ptr);
static int DetectDnsOpcodeSetup(DetectEngineCtx *de_ctx, Signature *s,
const char *str)
SCReturnInt(0);
error:
- DetectDnsOpcodeFree(detect);
+ DetectDnsOpcodeFree(de_ctx, detect);
SCReturnInt(-1);
}
-static void DetectDnsOpcodeFree(void *ptr)
+static void DetectDnsOpcodeFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCEnter();
if (ptr != NULL) {
const Signature *, const SigMatchCtx *);
static int DetectDsizeSetup (DetectEngineCtx *, Signature *s, const char *str);
static void DsizeRegisterTests(void);
-static void DetectDsizeFree(void *);
+static void DetectDsizeFree(DetectEngineCtx *, void *);
static int PrefilterSetupDsize(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterDsizeIsPrefilterable(const Signature *s);
*
* \param de pointer to DetectDsizeData
*/
-void DetectDsizeFree(void *de_ptr)
+void DetectDsizeFree(DetectEngineCtx *de_ctx, void *de_ptr)
{
DetectDsizeData *dd = (DetectDsizeData *)de_ptr;
if(dd) SCFree(dd);
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse("1");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 1;
}
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse(">10");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 1;
}
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse("<100");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 1;
}
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse("1<>2");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 1;
}
if (dd->dsize == 1)
result = 1;
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
}
return result;
if (dd->dsize == 10 && dd->mode == DETECTDSIZE_GT)
result = 1;
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
}
return result;
if (dd->dsize == 100 && dd->mode == DETECTDSIZE_LT)
result = 1;
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
}
return result;
if (dd->dsize == 1 && dd->dsize2 == 2 && dd->mode == DETECTDSIZE_RA)
result = 1;
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
}
return result;
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse("A");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 0;
}
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse(">10<>10");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 0;
}
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse("<>10");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 0;
}
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse("1<>");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 0;
}
if (dd->dsize2 == 0)
result = 1;
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
}
return result;
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse("");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 0;
}
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse(" ");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 0;
}
DetectDsizeData *dd = NULL;
dd = DetectDsizeParse("2<>1");
if (dd) {
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
return 0;
}
if (dd->dsize == 1 && dd->dsize2 == 2 && dd->mode == DETECTDSIZE_RA)
result = 1;
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
}
return result;
if (dd->dsize == 2 && dd->mode == DETECTDSIZE_GT)
result = 1;
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
}
return result;
if (dd->dsize == 12 && dd->mode == DETECTDSIZE_LT)
result = 1;
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
}
return result;
if (dd->dsize == 12 && dd->mode == DETECTDSIZE_EQ)
result = 1;
- DetectDsizeFree(dd);
+ DetectDsizeFree(NULL, dd);
}
return result;
* DetectAddressHead sent as the argument with the relevant address
* ranges from the parsed string.
*
+ * \param de_ctx Pointer to the detection engine context
* \param gh Pointer to the DetectAddressHead.
* \param str Pointer to the character string containing the address group
* that has to be parsed.
for (Signature *s = de_ctx->sig_list; s != NULL;) {
Signature *ns = s->next;
- SigFree(s);
+ SigFree(de_ctx, s);
s = ns;
}
de_ctx->sig_list = NULL;
SigMatch *sm = s->init_data->smlists[i];
while (sm != NULL) {
SigMatch *nsm = sm->next;
- SigMatchFree(sm);
+ SigMatchFree(de_ctx, sm);
sm = nsm;
}
}
static int DetectEngineEventSetup (DetectEngineCtx *, Signature *, const char *);
static int DetectDecodeEventSetup (DetectEngineCtx *, Signature *, const char *);
static int DetectStreamEventSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectEngineEventFree (void *);
+static void DetectEngineEventFree (DetectEngineCtx *, void *);
void EngineEventRegisterTests(void);
*
* \param de pointer to DetectEngineEventData
*/
-static void DetectEngineEventFree(void *ptr)
+static void DetectEngineEventFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectEngineEventData *de = (DetectEngineEventData *)ptr;
if (de)
DetectEngineEventData *de = NULL;
de = DetectEngineEventParse("decoder.ipv4.pkt_too_small");
if (de) {
- DetectEngineEventFree(de);
+ DetectEngineEventFree(NULL, de);
return 1;
}
DetectEngineEventData *de = NULL;
de = DetectEngineEventParse("decoder.PPP.pkt_too_small");
if (de) {
- DetectEngineEventFree(de);
+ DetectEngineEventFree(NULL, de);
return 1;
}
DetectEngineEventData *de = NULL;
de = DetectEngineEventParse("decoder.IPV6.PKT_TOO_SMALL");
if (de) {
- DetectEngineEventFree(de);
+ DetectEngineEventFree(NULL, de);
return 1;
}
DetectEngineEventData *de = NULL;
de = DetectEngineEventParse("decoder.IPV6.INVALID_EVENT");
if (de) {
- DetectEngineEventFree(de);
+ DetectEngineEventFree(NULL, de);
return 0;
}
DetectEngineEventData *de = NULL;
de = DetectEngineEventParse("decoder.IPV-6,INVALID_CHAR");
if (de) {
- DetectEngineEventFree(de);
+ DetectEngineEventFree(NULL, de);
return 0;
}
FAIL_IF(s == NULL);
FAIL_IF(SignatureIsIPOnly(de_ctx, s) == 0);
- SigFree(s);
+ SigFree(de_ctx, s);
DetectEngineCtxFree(de_ctx);
PASS;
}
FAIL_IF(s == NULL);
FAIL_IF(SignatureIsIPOnly(de_ctx, s) == 0);
- SigFree(s);
+ SigFree(de_ctx, s);
DetectEngineCtxFree(de_ctx);
PASS;
}
printf("got a IPOnly signature (content): ");
result=0;
}
- SigFree(s);
+ SigFree(de_ctx, s);
/* content */
s = SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (content) \"; content:\"match something\"; classtype:misc-activity; sid:400001; rev:1;)");
printf("got a IPOnly signature (content): ");
result=0;
}
- SigFree(s);
+ SigFree(de_ctx, s);
/* uricontent */
s = SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (uricontent) \"; uricontent:\"match something\"; classtype:misc-activity; sid:400001; rev:1;)");
printf("got a IPOnly signature (uricontent): ");
result=0;
}
- SigFree(s);
+ SigFree(de_ctx, s);
/* pcre */
s = SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (pcre) \"; pcre:\"/e?idps rule[sz]/i\"; classtype:misc-activity; sid:400001; rev:1;)");
printf("got a IPOnly signature (pcre): ");
result=0;
}
- SigFree(s);
+ SigFree(de_ctx, s);
/* flow */
s = SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (flow) \"; flow:to_server; classtype:misc-activity; sid:400001; rev:1;)");
printf("got a IPOnly signature (flow): ");
result=0;
}
- SigFree(s);
+ SigFree(de_ctx, s);
/* dsize */
s = SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (dsize) \"; dsize:100; classtype:misc-activity; sid:400001; rev:1;)");
printf("got a IPOnly signature (dsize): ");
result=0;
}
- SigFree(s);
+ SigFree(de_ctx, s);
/* flowbits */
s = SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (flowbits) \"; flowbits:unset; classtype:misc-activity; sid:400001; rev:1;)");
printf("got a IPOnly signature (flowbits): ");
result=0;
}
- SigFree(s);
+ SigFree(de_ctx, s);
/* flowvar */
s = SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (flowvar) \"; pcre:\"/(?<flow_var>.*)/i\"; flowvar:var,\"str\"; classtype:misc-activity; sid:400001; rev:1;)");
printf("got a IPOnly signature (flowvar): ");
result=0;
}
- SigFree(s);
+ SigFree(de_ctx, s);
/* pktvar */
s = SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (pktvar) \"; pcre:\"/(?<pkt_var>.*)/i\"; pktvar:var,\"str\"; classtype:misc-activity; sid:400001; rev:1;)");
printf("got a IPOnly signature (pktvar): ");
result=0;
}
- SigFree(s);
+ SigFree(de_ctx, s);
end:
if (de_ctx != NULL)
FAIL_IF(s == NULL);
FAIL_IF(SignatureIsIPOnly(de_ctx, s) == 0);
- SigFree(s);
+ SigFree(de_ctx, s);
DetectEngineCtxFree(de_ctx);
PASS;
}
FAIL_IF(s == NULL);
FAIL_IF(SignatureIsIPOnly(de_ctx, s) == 1);
- SigFree(s);
+ SigFree(de_ctx, s);
DetectEngineCtxFree(de_ctx);
PASS;
}
/**
* \brief Function for parsing port strings
*
+ * \param de_ctx Pointer to the detection engine context
* \param head Pointer to the head of the DetectPort group list
* \param str Pointer to the port string
*
DetectEngineCtx *DetectEngineCtxInit(void);
Signature *SigInit(DetectEngineCtx *, const char *);
-void SigFree(Signature *);
+void SigFree(DetectEngineCtx *, Signature *);
void DetectEngineCtxFree(DetectEngineCtx *);
#ifdef UNITTESTS
* double freeing, so it takes an approach to first fill an array
* of the to-free pointers before freeing them.
*/
-void DetectEngineAppInspectionEngineSignatureFree(Signature *s)
+void DetectEngineAppInspectionEngineSignatureFree(DetectEngineCtx *de_ctx, Signature *s)
{
int nlists = 0;
SigMatchData *smd = ptrs[i];
while(1) {
if (sigmatch_table[smd->type].Free != NULL) {
- sigmatch_table[smd->type].Free(smd->ctx);
+ sigmatch_table[smd->type].Free(de_ctx, smd->ctx);
}
if (smd->is_last)
break;
InspectionBufferPktInspectFunc Callback);
int DetectEngineAppInspectionEngine2Signature(DetectEngineCtx *de_ctx, Signature *s);
-void DetectEngineAppInspectionEngineSignatureFree(Signature *s);
+void DetectEngineAppInspectionEngineSignatureFree(DetectEngineCtx *, Signature *s);
bool DetectEnginePktInspectionRun(ThreadVars *tv,
DetectEngineThreadCtx *det_ctx, const Signature *s,
error:
if (filehash != NULL)
- DetectFileHashFree(filehash);
+ DetectFileHashFree((DetectEngineCtx *) de_ctx, filehash);
if (fp != NULL)
fclose(fp);
if (filename != NULL)
error:
if (filehash != NULL)
- DetectFileHashFree(filehash);
+ DetectFileHashFree(de_ctx, filehash);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param filehash pointer to DetectFileHashData
*/
-void DetectFileHashFree(void *ptr)
+void DetectFileHashFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr != NULL) {
DetectFileHashData *filehash = (DetectFileHashData *)ptr;
int DetectFileHashMatch(DetectEngineThreadCtx *, Flow *, uint8_t,
File *, const Signature *, const SigMatchCtx *);
int DetectFileHashSetup(DetectEngineCtx *, Signature *, const char *, uint32_t, int);
-void DetectFileHashFree(void *);
+void DetectFileHashFree(DetectEngineCtx *, void *);
#endif /* __UTIL_DETECT_FILE_HASH_H__ */
uint8_t, File *, const Signature *, const SigMatchCtx *);
static int DetectFileextSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectFileextRegisterTests(void);
-static void DetectFileextFree(void *);
+static void DetectFileextFree(DetectEngineCtx *, void *);
static int g_file_match_list_id = 0;
/**
/**
* \brief This function is used to parse fileet
*
+ * \param de_ctx Pointer to the detection engine context
* \param str Pointer to the fileext value string
*
* \retval pointer to DetectFileextData on success
* \retval NULL on failure
*/
-static DetectFileextData *DetectFileextParse (const char *str, bool negate)
+static DetectFileextData *DetectFileextParse (DetectEngineCtx *de_ctx, const char *str, bool negate)
{
DetectFileextData *fileext = NULL;
error:
if (fileext != NULL)
- DetectFileextFree(fileext);
+ DetectFileextFree(de_ctx, fileext);
return NULL;
}
DetectFileextData *fileext= NULL;
SigMatch *sm = NULL;
- fileext = DetectFileextParse(str, s->init_data->negated);
+ fileext = DetectFileextParse(de_ctx, str, s->init_data->negated);
if (fileext == NULL)
goto error;
error:
if (fileext != NULL)
- DetectFileextFree(fileext);
+ DetectFileextFree(de_ctx, fileext);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param fileext pointer to DetectFileextData
*/
-static void DetectFileextFree(void *ptr)
+static void DetectFileextFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr != NULL) {
DetectFileextData *fileext = (DetectFileextData *)ptr;
*/
static int DetectFileextTestParse01 (void)
{
- DetectFileextData *dfd = DetectFileextParse("doc", false);
+ DetectFileextData *dfd = DetectFileextParse(NULL, "doc", false);
if (dfd != NULL) {
- DetectFileextFree(dfd);
+ DetectFileextFree(NULL, dfd);
return 1;
}
return 0;
{
int result = 0;
- DetectFileextData *dfd = DetectFileextParse("tar.gz", false);
+ DetectFileextData *dfd = DetectFileextParse(NULL, "tar.gz", false);
if (dfd != NULL) {
if (dfd->len == 6 && memcmp(dfd->ext, "tar.gz", 6) == 0) {
result = 1;
}
- DetectFileextFree(dfd);
+ DetectFileextFree(NULL, dfd);
return result;
}
return 0;
{
int result = 0;
- DetectFileextData *dfd = DetectFileextParse("pdf", false);
+ DetectFileextData *dfd = DetectFileextParse(NULL, "pdf", false);
if (dfd != NULL) {
if (dfd->len == 3 && memcmp(dfd->ext, "pdf", 3) == 0) {
result = 1;
}
- DetectFileextFree(dfd);
+ DetectFileextFree(NULL, dfd);
return result;
}
return 0;
uint8_t, File *, const Signature *, const SigMatchCtx *);
static int DetectFilemagicSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectFilemagicRegisterTests(void);
-static void DetectFilemagicFree(void *);
+static void DetectFilemagicFree(DetectEngineCtx *, void *);
static int g_file_match_list_id = 0;
static int DetectFilemagicSetupSticky(DetectEngineCtx *de_ctx, Signature *s, const char *str);
/**
* \brief Parse the filemagic keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param idstr Pointer to the user provided option
*
* \retval filemagic pointer to DetectFilemagicData on success
* \retval NULL on failure
*/
-static DetectFilemagicData *DetectFilemagicParse (const char *str, bool negate)
+static DetectFilemagicData *DetectFilemagicParse (DetectEngineCtx *de_ctx, const char *str, bool negate)
{
DetectFilemagicData *filemagic = NULL;
error:
if (filemagic != NULL)
- DetectFilemagicFree(filemagic);
+ DetectFilemagicFree(de_ctx, filemagic);
return NULL;
}
{
SigMatch *sm = NULL;
- DetectFilemagicData *filemagic = DetectFilemagicParse(str, s->init_data->negated);
+ DetectFilemagicData *filemagic = DetectFilemagicParse(de_ctx, str, s->init_data->negated);
if (filemagic == NULL)
return -1;
return 0;
error:
- DetectFilemagicFree(filemagic);
+ DetectFilemagicFree(de_ctx, filemagic);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param filemagic pointer to DetectFilemagicData
*/
-static void DetectFilemagicFree(void *ptr)
+static void DetectFilemagicFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr != NULL) {
DetectFilemagicData *filemagic = (DetectFilemagicData *)ptr;
*/
static int DetectFilemagicTestParse01 (void)
{
- DetectFilemagicData *dnd = DetectFilemagicParse("secret.pdf", false);
+ DetectFilemagicData *dnd = DetectFilemagicParse(NULL, "secret.pdf", false);
if (dnd != NULL) {
- DetectFilemagicFree(dnd);
+ DetectFilemagicFree(NULL, dnd);
return 1;
}
return 0;
{
int result = 0;
- DetectFilemagicData *dnd = DetectFilemagicParse("backup.tar.gz", false);
+ DetectFilemagicData *dnd = DetectFilemagicParse(NULL, "backup.tar.gz", false);
if (dnd != NULL) {
if (dnd->len == 13 && memcmp(dnd->name, "backup.tar.gz", 13) == 0) {
result = 1;
}
- DetectFilemagicFree(dnd);
+ DetectFilemagicFree(NULL, dnd);
return result;
}
return 0;
{
int result = 0;
- DetectFilemagicData *dnd = DetectFilemagicParse("cmd.exe", false);
+ DetectFilemagicData *dnd = DetectFilemagicParse(NULL, "cmd.exe", false);
if (dnd != NULL) {
if (dnd->len == 7 && memcmp(dnd->name, "cmd.exe", 7) == 0) {
result = 1;
}
- DetectFilemagicFree(dnd);
+ DetectFilemagicFree(NULL, dnd);
return result;
}
return 0;
static int DetectFilenameSetup (DetectEngineCtx *, Signature *, const char *);
static int DetectFilenameSetupSticky(DetectEngineCtx *de_ctx, Signature *s, const char *str);
static void DetectFilenameRegisterTests(void);
-static void DetectFilenameFree(void *);
+static void DetectFilenameFree(DetectEngineCtx *, void *);
static int g_file_match_list_id = 0;
static int g_file_name_buffer_id = 0;
/**
* \brief Parse the filename keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param idstr Pointer to the user provided option
*
* \retval filename pointer to DetectFilenameData on success
* \retval NULL on failure
*/
-static DetectFilenameData *DetectFilenameParse (const char *str, bool negate)
+static DetectFilenameData *DetectFilenameParse (DetectEngineCtx *de_ctx, const char *str, bool negate)
{
DetectFilenameData *filename = NULL;
error:
if (filename != NULL)
- DetectFilenameFree(filename);
+ DetectFilenameFree(de_ctx, filename);
return NULL;
}
DetectFilenameData *filename = NULL;
SigMatch *sm = NULL;
- filename = DetectFilenameParse(str, s->init_data->negated);
+ filename = DetectFilenameParse(de_ctx, str, s->init_data->negated);
if (filename == NULL)
goto error;
error:
if (filename != NULL)
- DetectFilenameFree(filename);
+ DetectFilenameFree(de_ctx, filename);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param filename pointer to DetectFilenameData
*/
-static void DetectFilenameFree(void *ptr)
+static void DetectFilenameFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr != NULL) {
DetectFilenameData *filename = (DetectFilenameData *)ptr;
*/
static int DetectFilenameTestParse01 (void)
{
- DetectFilenameData *dnd = DetectFilenameParse("secret.pdf", false);
+ DetectFilenameData *dnd = DetectFilenameParse(NULL, "secret.pdf", false);
if (dnd != NULL) {
- DetectFilenameFree(dnd);
+ DetectFilenameFree(NULL, dnd);
return 1;
}
return 0;
{
int result = 0;
- DetectFilenameData *dnd = DetectFilenameParse("backup.tar.gz", false);
+ DetectFilenameData *dnd = DetectFilenameParse(NULL, "backup.tar.gz", false);
if (dnd != NULL) {
if (dnd->len == 13 && memcmp(dnd->name, "backup.tar.gz", 13) == 0) {
result = 1;
}
- DetectFilenameFree(dnd);
+ DetectFilenameFree(NULL, dnd);
return result;
}
return 0;
{
int result = 0;
- DetectFilenameData *dnd = DetectFilenameParse("cmd.exe", false);
+ DetectFilenameData *dnd = DetectFilenameParse(NULL, "cmd.exe", false);
if (dnd != NULL) {
if (dnd->len == 7 && memcmp(dnd->name, "cmd.exe", 7) == 0) {
result = 1;
}
- DetectFilenameFree(dnd);
+ DetectFilenameFree(NULL, dnd);
return result;
}
return 0;
static int DetectFilesizeMatch (DetectEngineThreadCtx *det_ctx, Flow *f,
uint8_t flags, File *file, const Signature *s, const SigMatchCtx *m);
static int DetectFilesizeSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectFilesizeFree (void *);
+static void DetectFilesizeFree (DetectEngineCtx *, void *);
static void DetectFilesizeRegisterTests (void);
static int g_file_match_list_id = 0;
error:
if (fsd != NULL)
- DetectFilesizeFree(fsd);
+ DetectFilesizeFree(de_ctx, fsd);
if (sm != NULL)
SCFree(sm);
SCReturnInt(-1);
*
* \param ptr pointer to DetectFilesizeData
*/
-static void DetectFilesizeFree(void *ptr)
+static void DetectFilesizeFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectFilesizeData *fsd = (DetectFilesizeData *)ptr;
SCFree(fsd);
if (fsd->size1 == 10 && fsd->mode == DETECT_FILESIZE_EQ)
ret = 1;
- DetectFilesizeFree(fsd);
+ DetectFilesizeFree(NULL, fsd);
}
return ret;
}
if (fsd->size1 == 10 && fsd->mode == DETECT_FILESIZE_LT)
ret = 1;
- DetectFilesizeFree(fsd);
+ DetectFilesizeFree(NULL, fsd);
}
return ret;
}
if (fsd->size1 == 10 && fsd->mode == DETECT_FILESIZE_GT)
ret = 1;
- DetectFilesizeFree(fsd);
+ DetectFilesizeFree(NULL, fsd);
}
return ret;
}
fsd->mode == DETECT_FILESIZE_RA)
ret = 1;
- DetectFilesizeFree(fsd);
+ DetectFilesizeFree(NULL, fsd);
}
return ret;
}
fsd->mode == DETECT_FILESIZE_RA)
ret = 1;
- DetectFilesizeFree(fsd);
+ DetectFilesizeFree(NULL, fsd);
}
return ret;
}
static int DetectFilestorePostMatch(DetectEngineThreadCtx *det_ctx,
Packet *p, const Signature *s, const SigMatchCtx *ctx);
static int DetectFilestoreSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectFilestoreFree(void *);
+static void DetectFilestoreFree(DetectEngineCtx *, void *);
static void DetectFilestoreRegisterTests(void);
static int g_file_match_list_id = 0;
return -1;
}
-static void DetectFilestoreFree(void *ptr)
+static void DetectFilestoreFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr != NULL) {
SCFree(ptr);
const Signature *, const SigMatchCtx *);
static int DetectFlowSetup (DetectEngineCtx *, Signature *, const char *);
void DetectFlowRegisterTests(void);
-void DetectFlowFree(void *);
+void DetectFlowFree(DetectEngineCtx *, void *);
static int PrefilterSetupFlow(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterFlowIsPrefilterable(const Signature *s);
/**
* \brief This function is used to parse flow options passed via flow: keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param flowstr Pointer to the user provided flow options
*
* \retval fd pointer to DetectFlowData on success
* \retval NULL on failure
*/
-static DetectFlowData *DetectFlowParse (const char *flowstr)
+static DetectFlowData *DetectFlowParse (DetectEngineCtx *de_ctx, const char *flowstr)
{
DetectFlowData *fd = NULL;
char *args[3] = {NULL,NULL,NULL};
error:
if (fd != NULL)
- DetectFlowFree(fd);
+ DetectFlowFree(de_ctx, fd);
return NULL;
}
return -1;
}
- DetectFlowData *fd = DetectFlowParse(flowstr);
+ DetectFlowData *fd = DetectFlowParse(de_ctx, flowstr);
if (fd == NULL)
return -1;
{
/* no direct flow is needed for just direction,
* no sigmatch is needed either. */
- SigMatchFree(sm);
+ SigMatchFree(de_ctx, sm);
sm = NULL;
} else {
s->init_data->init_flags |= SIG_FLAG_INIT_FLOW;
error:
if (fd != NULL)
- DetectFlowFree(fd);
+ DetectFlowFree(de_ctx, fd);
return -1;
}
*
* \param fd pointer to DetectFlowData
*/
-void DetectFlowFree(void *ptr)
+void DetectFlowFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectFlowData *fd = (DetectFlowData *)ptr;
SCFree(fd);
static int DetectFlowTestParse01 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("established");
+ fd = DetectFlowParse(NULL, "established");
FAIL_IF_NULL(fd);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse02 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("established");
+ fd = DetectFlowParse(NULL, "established");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_ESTABLISHED &&
fd->match_cnt == 1);
static int DetectFlowTestParse03 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("stateless");
+ fd = DetectFlowParse(NULL, "stateless");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_STATELESS && fd->match_cnt == 1);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse04 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("to_client");
+ fd = DetectFlowParse(NULL, "to_client");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_TOCLIENT && fd->match_cnt == 1);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse05 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("to_server");
+ fd = DetectFlowParse(NULL, "to_server");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_TOSERVER && fd->match_cnt == 1);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse06 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("from_server");
+ fd = DetectFlowParse(NULL, "from_server");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_TOCLIENT && fd->match_cnt == 1);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse07 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("from_client");
+ fd = DetectFlowParse(NULL, "from_client");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_TOSERVER && fd->match_cnt == 1);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse08 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("established,to_client");
+ fd = DetectFlowParse(NULL, "established,to_client");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_ESTABLISHED && fd->flags & DETECT_FLOW_FLAG_TOCLIENT && fd->match_cnt == 2);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse09 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("to_client,stateless");
+ fd = DetectFlowParse(NULL, "to_client,stateless");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_STATELESS &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->match_cnt == 2);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse10 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("from_server,stateless");
+ fd = DetectFlowParse(NULL, "from_server,stateless");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_STATELESS &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->match_cnt == 2);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse11 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse(" from_server , stateless ");
+ fd = DetectFlowParse(NULL, " from_server , stateless ");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_STATELESS &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->match_cnt == 2);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase01 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("ESTABLISHED");
+ fd = DetectFlowParse(NULL, "ESTABLISHED");
FAIL_IF_NULL(fd);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase02 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("ESTABLISHED");
+ fd = DetectFlowParse(NULL, "ESTABLISHED");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_ESTABLISHED &&
fd->match_cnt == 1);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase03 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("STATELESS");
+ fd = DetectFlowParse(NULL, "STATELESS");
FAIL_IF_NULL(fd);
- FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_STATELESS && fd->match_cnt == 1); DetectFlowFree(fd);
+ FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_STATELESS && fd->match_cnt == 1); DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase04 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("TO_CLIENT");
+ fd = DetectFlowParse(NULL, "TO_CLIENT");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_TOCLIENT && fd->match_cnt == 1);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase05 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("TO_SERVER");
+ fd = DetectFlowParse(NULL, "TO_SERVER");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_TOSERVER && fd->match_cnt == 1);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase06 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("FROM_SERVER");
+ fd = DetectFlowParse(NULL, "FROM_SERVER");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_TOCLIENT && fd->match_cnt == 1);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase07 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("FROM_CLIENT");
+ fd = DetectFlowParse(NULL, "FROM_CLIENT");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags == DETECT_FLOW_FLAG_TOSERVER && fd->match_cnt == 1);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase08 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("ESTABLISHED,TO_CLIENT");
+ fd = DetectFlowParse(NULL, "ESTABLISHED,TO_CLIENT");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_ESTABLISHED &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->match_cnt == 2);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase09 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("TO_CLIENT,STATELESS");
+ fd = DetectFlowParse(NULL, "TO_CLIENT,STATELESS");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_STATELESS &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->match_cnt == 2);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase10 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("FROM_SERVER,STATELESS");
+ fd = DetectFlowParse(NULL, "FROM_SERVER,STATELESS");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_STATELESS &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->match_cnt == 2);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase11 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse(" FROM_SERVER , STATELESS ");
+ fd = DetectFlowParse(NULL, " FROM_SERVER , STATELESS ");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_STATELESS &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->match_cnt == 2);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse12 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("from_server:stateless");
+ fd = DetectFlowParse(NULL, "from_server:stateless");
FAIL_IF_NOT_NULL(fd);
PASS;
}
static int DetectFlowTestParse13 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("invalidoptiontest");
+ fd = DetectFlowParse(NULL, "invalidoptiontest");
FAIL_IF_NOT_NULL(fd);
PASS;
}
static int DetectFlowTestParse14 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("");
+ fd = DetectFlowParse(NULL, "");
FAIL_IF_NOT_NULL(fd);
PASS;
}
static int DetectFlowTestParse15 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("established,stateless");
+ fd = DetectFlowParse(NULL, "established,stateless");
FAIL_IF_NOT_NULL(fd);
PASS;
}
static int DetectFlowTestParse16 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("to_client,to_server");
+ fd = DetectFlowParse(NULL, "to_client,to_server");
FAIL_IF_NOT_NULL(fd);
PASS;
}
static int DetectFlowTestParse17 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("to_client,from_server");
+ fd = DetectFlowParse(NULL, "to_client,from_server");
FAIL_IF_NOT_NULL(fd);
PASS;
}
static int DetectFlowTestParse18 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("from_server,established,only_stream");
+ fd = DetectFlowParse(NULL, "from_server,established,only_stream");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_ESTABLISHED &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->flags & DETECT_FLOW_FLAG_ONLYSTREAM &&
fd->match_cnt == 3);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase18 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("FROM_SERVER,ESTABLISHED,ONLY_STREAM");
+ fd = DetectFlowParse(NULL, "FROM_SERVER,ESTABLISHED,ONLY_STREAM");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_ESTABLISHED &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->flags & DETECT_FLOW_FLAG_ONLYSTREAM &&
fd->match_cnt == 3);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse19 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("from_server,established,only_stream,a");
+ fd = DetectFlowParse(NULL, "from_server,established,only_stream,a");
FAIL_IF_NOT_NULL(fd);
PASS;
}
static int DetectFlowTestParse20 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("from_server,established,no_stream");
+ fd = DetectFlowParse(NULL, "from_server,established,no_stream");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_ESTABLISHED &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->flags & DETECT_FLOW_FLAG_NOSTREAM &&
fd->match_cnt == 3);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNocase20 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("FROM_SERVER,ESTABLISHED,NO_STREAM");
+ fd = DetectFlowParse(NULL, "FROM_SERVER,ESTABLISHED,NO_STREAM");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_ESTABLISHED &&
fd->flags & DETECT_FLOW_FLAG_TOCLIENT &&
fd->flags & DETECT_FLOW_FLAG_NOSTREAM &&
fd->match_cnt == 3);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParse21 (void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("from_server,a,no_stream");
+ fd = DetectFlowParse(NULL, "from_server,a,no_stream");
FAIL_IF_NOT_NULL(fd);
PASS;
}
static int DetectFlowTestParseNotEstablished(void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("not_established");
+ fd = DetectFlowParse(NULL, "not_established");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_NOT_ESTABLISHED);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNoFrag(void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("no_frag");
+ fd = DetectFlowParse(NULL, "no_frag");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_NO_FRAG);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseOnlyFrag(void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("only_frag");
+ fd = DetectFlowParse(NULL, "only_frag");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_ONLY_FRAG);
- DetectFlowFree(fd);
+ DetectFlowFree(NULL, fd);
PASS;
}
static int DetectFlowTestParseNoFragOnlyFrag(void)
{
DetectFlowData *fd = NULL;
- fd = DetectFlowParse("no_frag,only_frag");
+ fd = DetectFlowParse(NULL, "no_frag,only_frag");
FAIL_IF_NOT_NULL(fd);
PASS;
}
static int DetectFlowTestNoFragMatch(void)
{
uint32_t pflags = 0;
- DetectFlowData *fd = DetectFlowParse("no_frag");
+ DetectFlowData *fd = DetectFlowParse(NULL, "no_frag");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_NO_FRAG);
FAIL_IF_NOT(fd->match_cnt == 1);
static int DetectFlowTestOnlyFragMatch(void)
{
uint32_t pflags = 0;
- DetectFlowData *fd = DetectFlowParse("only_frag");
+ DetectFlowData *fd = DetectFlowParse(NULL, "only_frag");
FAIL_IF_NULL(fd);
FAIL_IF_NOT(fd->flags & DETECT_FLOW_FLAG_ONLY_FRAG);
FAIL_IF_NOT(fd->match_cnt == 1);
const Signature *, const SigMatchCtx *);
static int DetectFlowbitSetup (DetectEngineCtx *, Signature *, const char *);
static int FlowbitOrAddData(DetectEngineCtx *, DetectFlowbitsData *, char *);
-void DetectFlowbitFree (void *);
+void DetectFlowbitFree (DetectEngineCtx *, void *);
void FlowBitsRegisterTests(void);
void DetectFlowbitsRegister (void)
error:
if (cd != NULL)
- DetectFlowbitFree(cd);
+ DetectFlowbitFree(de_ctx, cd);
if (sm != NULL)
SCFree(sm);
return -1;
}
-void DetectFlowbitFree (void *ptr)
+void DetectFlowbitFree (DetectEngineCtx *de_ctx, void *ptr)
{
DetectFlowbitsData *fd = (DetectFlowbitsData *)ptr;
if (fd == NULL)
int DetectFlowintMatch(DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectFlowintSetup(DetectEngineCtx *, Signature *, const char *);
-void DetectFlowintFree(void *);
+void DetectFlowintFree(DetectEngineCtx *, void *);
void DetectFlowintRegisterTests(void);
void DetectFlowintRegister(void)
error:
if (sfd)
- DetectFlowintFree(sfd);
+ DetectFlowintFree(de_ctx, sfd);
if (sm)
SCFree(sm);
return -1;
/**
* \brief This function is used to free the data of DetectFlowintData
*/
-void DetectFlowintFree(void *tmp)
+void DetectFlowintFree(DetectEngineCtx *de_ctx, void *tmp)
{
DetectFlowintData *sfd =(DetectFlowintData*) tmp;
if (sfd != NULL) {
&& sfd->modifier == FLOWINT_MODIFIER_SET) {
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
return result;
&& sfd->modifier == FLOWINT_MODIFIER_ADD) {
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
return result;
&& sfd->modifier == FLOWINT_MODIFIER_SUB) {
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
return result;
&& sfd->modifier == FLOWINT_MODIFIER_EQ) {
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
return result;
&& sfd->modifier == FLOWINT_MODIFIER_NE) {
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
return result;
&& sfd->modifier == FLOWINT_MODIFIER_GT) {
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
return result;
&& sfd->modifier == FLOWINT_MODIFIER_GE) {
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
return result;
&& sfd->modifier == FLOWINT_MODIFIER_LE) {
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
return result;
&& sfd->modifier == FLOWINT_MODIFIER_LT) {
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
result = 1;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
return result;
result = 0;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
sfd = DetectFlowintParse(de_ctx, "myvar, notset");
DetectFlowintPrintData(sfd);
if (sfd != NULL && !strcmp(sfd->name, "myvar")
result = 0;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
return result;
SCLogDebug("DetectFlowintTestParseInvalidSyntaxis01: ERROR: invalid option at myvar,=,9532458716234857");
result = 0;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
sfd = DetectFlowintParse(de_ctx, "myvar,=,45targetvar");
if (sfd != NULL) {
SCLogDebug("DetectFlowintTestParseInvalidSyntaxis01: ERROR: invalid option at myvar,=,45targetvar ");
result = 0;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
sfd = DetectFlowintParse(de_ctx, "657myvar,=,targetvar");
if (sfd != NULL) {
SCLogDebug("DetectFlowintTestParseInvalidSyntaxis01: ERROR: invalid option at 657myvar,=,targetvar ");
result = 0;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
sfd = DetectFlowintParse(de_ctx, "myvar,=<,targetvar");
if (sfd != NULL) {
SCLogDebug("DetectFlowintTestParseInvalidSyntaxis01: ERROR: invalid option at myvar,=<,targetvar ");
result = 0;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
sfd = DetectFlowintParse(de_ctx, "myvar,===,targetvar");
if (sfd != NULL) {
SCLogDebug("DetectFlowintTestParseInvalidSyntaxis01: ERROR: invalid option at myvar,===,targetvar ");
result = 0;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
sfd = DetectFlowintParse(de_ctx, "myvar,==");
if (sfd != NULL) {
SCLogDebug("DetectFlowintTestParseInvalidSyntaxis01: ERROR: invalid option at myvar,==");
result = 0;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
sfd = DetectFlowintParse(de_ctx, "myvar,");
if (sfd != NULL) {
SCLogDebug("DetectFlowintTestParseInvalidSyntaxis01: ERROR: invalid option at myvar,");
result = 0;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
sfd = DetectFlowintParse(de_ctx, "myvar");
if (sfd != NULL) {
SCLogDebug("DetectFlowintTestParseInvalidSyntaxis01: ERROR: invalid option at myvar");
result = 0;
}
- if (sfd) DetectFlowintFree(sfd);
+ if (sfd) DetectFlowintFree(NULL, sfd);
DetectEngineCtxFree(de_ctx);
static int DetectFlowvarSetup (DetectEngineCtx *, Signature *, const char *);
static int DetectFlowvarPostMatch(DetectEngineThreadCtx *det_ctx,
Packet *p, const Signature *s, const SigMatchCtx *ctx);
-static void DetectFlowvarDataFree(void *ptr);
+static void DetectFlowvarDataFree(DetectEngineCtx *, void *ptr);
void DetectFlowvarRegister (void)
{
*
* \param cd pointer to DetectCotentData
*/
-static void DetectFlowvarDataFree(void *ptr)
+static void DetectFlowvarDataFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr == NULL)
SCReturn;
error:
if (fd != NULL)
- DetectFlowvarDataFree(fd);
+ DetectFlowvarDataFree(de_ctx, fd);
if (sm != NULL)
SCFree(sm);
if (content != NULL)
/** \brief Setup a post-match for flowvar storage
* We're piggyback riding the DetectFlowvarData struct
*/
-int DetectFlowvarPostMatchSetup(Signature *s, uint32_t idx)
+int DetectFlowvarPostMatchSetup(DetectEngineCtx *de_ctx, Signature *s, uint32_t idx)
{
SigMatch *sm = NULL;
DetectFlowvarData *fv = NULL;
return 0;
error:
if (fv != NULL)
- DetectFlowvarDataFree(fv);
+ DetectFlowvarDataFree(de_ctx, fv);
return -1;
}
/* prototypes */
void DetectFlowvarRegister (void);
-int DetectFlowvarPostMatchSetup(Signature *s, uint32_t idx);
+int DetectFlowvarPostMatchSetup(DetectEngineCtx *de_ctx, Signature *s, uint32_t idx);
int DetectVarStoreMatch(DetectEngineThreadCtx *,
uint32_t, uint8_t *, uint16_t, int);
int DetectVarStoreMatchKeyValue(DetectEngineThreadCtx *,
static int DetectFragBitsMatch (DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectFragBitsSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectFragBitsFree(void *);
+static void DetectFragBitsFree(DetectEngineCtx *, void *);
static int PrefilterSetupFragBits(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterFragBitsIsPrefilterable(const Signature *s);
*
* \param de pointer to DetectFragBitsData
*/
-static void DetectFragBitsFree(void *de_ptr)
+static void DetectFragBitsFree(DetectEngineCtx *de_ctx, void *de_ptr)
{
DetectFragBitsData *de = (DetectFragBitsData *)de_ptr;
if(de) SCFree(de);
DetectFragBitsData *de = NULL;
de = DetectFragBitsParse("M");
if (de && (de->fragbits == FRAGBITS_HAVE_MF) ) {
- DetectFragBitsFree(de);
+ DetectFragBitsFree(NULL, de);
return 1;
}
DetectFragBitsData *de = NULL;
de = DetectFragBitsParse("G");
if (de) {
- DetectFragBitsFree(de);
+ DetectFragBitsFree(NULL, de);
return 0;
}
Packet *, const Signature *, const SigMatchCtx *);
static int DetectFragOffsetSetup(DetectEngineCtx *, Signature *, const char *);
void DetectFragOffsetRegisterTests(void);
-void DetectFragOffsetFree(void *);
+void DetectFragOffsetFree(DetectEngineCtx *, void *);
static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterFragOffsetIsPrefilterable(const Signature *s);
/**
* \brief This function is used to parse fragoffset option passed via fragoffset: keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param fragoffsetstr Pointer to the user provided fragoffset options
*
* \retval fragoff pointer to DetectFragOffsetData on success
* \retval NULL on failure
*/
-static DetectFragOffsetData *DetectFragOffsetParse (const char *fragoffsetstr)
+static DetectFragOffsetData *DetectFragOffsetParse (DetectEngineCtx *de_ctx, const char *fragoffsetstr)
{
DetectFragOffsetData *fragoff = NULL;
char *substr[3] = {NULL, NULL, NULL};
for (i = 0; i < 3; i++) {
if (substr[i] != NULL) SCFree(substr[i]);
}
- if (fragoff != NULL) DetectFragOffsetFree(fragoff);
+ if (fragoff != NULL) DetectFragOffsetFree(de_ctx, fragoff);
return NULL;
}
DetectFragOffsetData *fragoff = NULL;
SigMatch *sm = NULL;
- fragoff = DetectFragOffsetParse(fragoffsetstr);
+ fragoff = DetectFragOffsetParse(de_ctx, fragoffsetstr);
if (fragoff == NULL) goto error;
sm = SigMatchAlloc();
return 0;
error:
- if (fragoff != NULL) DetectFragOffsetFree(fragoff);
+ if (fragoff != NULL) DetectFragOffsetFree(de_ctx, fragoff);
if (sm != NULL) SCFree(sm);
return -1;
*
* \param ptr pointer to DetectFragOffsetData
*/
-void DetectFragOffsetFree (void *ptr)
+void DetectFragOffsetFree (DetectEngineCtx *de_ctx, void *ptr)
{
DetectFragOffsetData *fragoff = (DetectFragOffsetData *)ptr;
SCFree(fragoff);
static int DetectFragOffsetParseTest01 (void)
{
DetectFragOffsetData *fragoff = NULL;
- fragoff = DetectFragOffsetParse("300");
+ fragoff = DetectFragOffsetParse(NULL, "300");
if (fragoff != NULL && fragoff->frag_off == 300) {
- DetectFragOffsetFree(fragoff);
+ DetectFragOffsetFree(NULL, fragoff);
return 1;
}
return 0;
static int DetectFragOffsetParseTest02 (void)
{
DetectFragOffsetData *fragoff = NULL;
- fragoff = DetectFragOffsetParse(">300");
+ fragoff = DetectFragOffsetParse(NULL, ">300");
if (fragoff != NULL && fragoff->frag_off == 300 && fragoff->mode == FRAG_MORE) {
- DetectFragOffsetFree(fragoff);
+ DetectFragOffsetFree(NULL, fragoff);
return 1;
}
return 0;
static int DetectFragOffsetParseTest03 (void)
{
DetectFragOffsetData *fragoff = NULL;
- fragoff = DetectFragOffsetParse("badc");
+ fragoff = DetectFragOffsetParse(NULL, "badc");
if (fragoff != NULL) {
- DetectFragOffsetFree(fragoff);
+ DetectFragOffsetFree(NULL, fragoff);
return 0;
}
return 1;
FAIL_IF(s->sm_lists[g_ftp_request_list_id] == NULL);
FAIL_IF_NOT(s->sm_lists[g_ftp_request_list_id]->type & DETECT_FTPBOUNCE);
- SigFree(s);
+ SigFree(de_ctx, s);
PASS;
}
Flow *, uint8_t, void *, void *,
const Signature *, const SigMatchCtx *);
static int DetectFtpdataSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectFtpdataFree (void *);
+static void DetectFtpdataFree (DetectEngineCtx *, void *);
static void DetectFtpdataRegisterTests (void);
static int DetectEngineInspectFtpdataGeneric(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectFtpdataFree(ftpcommandd);
+ DetectFtpdataFree(de_ctx, ftpcommandd);
return -1;
}
sm->type = DETECT_FTPDATA;
*
* \param ptr pointer to DetectFtpdataData
*/
-static void DetectFtpdataFree(void *ptr) {
+static void DetectFtpdataFree(DetectEngineCtx *de_ctx, void *ptr) {
DetectFtpdataData *ftpcommandd = (DetectFtpdataData *)ptr;
/* do more specific cleanup here, if needed */
DetectFtpdataData *ftpcommandd = DetectFtpdataParse("stor");
FAIL_IF_NULL(ftpcommandd);
FAIL_IF(!(ftpcommandd->command == FTP_COMMAND_STOR));
- DetectFtpdataFree(ftpcommandd);
+ DetectFtpdataFree(NULL, ftpcommandd);
PASS;
}
const Signature *, const SigMatchCtx *);
static int DetectGeoipSetup(DetectEngineCtx *, Signature *, const char *);
static void DetectGeoipRegisterTests(void);
-static void DetectGeoipDataFree(void *);
+static void DetectGeoipDataFree(DetectEngineCtx *, void *);
/**
* \brief Registration function for geoip keyword
/**
* \brief This function is used to parse geoipdata
*
+ * \param de_ctx Pointer to the detection engine context
* \param str Pointer to the geoipdata value string
*
* \retval pointer to DetectGeoipData on success
* \retval NULL on failure
*/
-static DetectGeoipData *DetectGeoipDataParse (const char *str)
+static DetectGeoipData *DetectGeoipDataParse (DetectEngineCtx *de_ctx, const char *str)
{
DetectGeoipData *geoipdata = NULL;
uint16_t pos = 0;
error:
if (geoipdata != NULL)
- DetectGeoipDataFree(geoipdata);
+ DetectGeoipDataFree(de_ctx, geoipdata);
return NULL;
}
DetectGeoipData *geoipdata = NULL;
SigMatch *sm = NULL;
- geoipdata = DetectGeoipDataParse(optstr);
+ geoipdata = DetectGeoipDataParse(de_ctx, optstr);
if (geoipdata == NULL)
goto error;
error:
if (geoipdata != NULL)
- DetectGeoipDataFree(geoipdata);
+ DetectGeoipDataFree(de_ctx, geoipdata);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param geoipdata pointer to DetectGeoipData
*/
-static void DetectGeoipDataFree(void *ptr)
+static void DetectGeoipDataFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr != NULL) {
DetectGeoipData *geoipdata = (DetectGeoipData *)ptr;
static int DetectHostbitMatch (DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectHostbitSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectHostbitFree (void *);
+void DetectHostbitFree (DetectEngineCtx *, void *);
void HostBitsRegisterTests(void);
void DetectHostbitsRegister (void)
return -1;
}
-void DetectHostbitFree (void *ptr)
+void DetectHostbitFree (DetectEngineCtx *de_ctx, void *ptr)
{
DetectXbitsData *fd = (DetectXbitsData *)ptr;
const Signature *, const SigMatchCtx *);
static int DetectIcmpIdSetup(DetectEngineCtx *, Signature *, const char *);
void DetectIcmpIdRegisterTests(void);
-void DetectIcmpIdFree(void *);
+void DetectIcmpIdFree(DetectEngineCtx *, void *);
static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterIcmpIdIsPrefilterable(const Signature *s);
/**
* \brief This function is used to parse icmp_id option passed via icmp_id: keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param icmpidstr Pointer to the user provided icmp_id options
*
* \retval iid pointer to DetectIcmpIdData on success
* \retval NULL on failure
*/
-static DetectIcmpIdData *DetectIcmpIdParse (const char *icmpidstr)
+static DetectIcmpIdData *DetectIcmpIdParse (DetectEngineCtx *de_ctx, const char *icmpidstr)
{
DetectIcmpIdData *iid = NULL;
char *substr[3] = {NULL, NULL, NULL};
for (i = 0; i < 3; i++) {
if (substr[i] != NULL) SCFree(substr[i]);
}
- if (iid != NULL) DetectIcmpIdFree(iid);
+ if (iid != NULL) DetectIcmpIdFree(de_ctx, iid);
return NULL;
}
DetectIcmpIdData *iid = NULL;
SigMatch *sm = NULL;
- iid = DetectIcmpIdParse(icmpidstr);
+ iid = DetectIcmpIdParse(de_ctx, icmpidstr);
if (iid == NULL) goto error;
sm = SigMatchAlloc();
return 0;
error:
- if (iid != NULL) DetectIcmpIdFree(iid);
+ if (iid != NULL) DetectIcmpIdFree(de_ctx, iid);
if (sm != NULL) SCFree(sm);
return -1;
*
* \param ptr pointer to DetectIcmpIdData
*/
-void DetectIcmpIdFree (void *ptr)
+void DetectIcmpIdFree (DetectEngineCtx *de_ctx, void *ptr)
{
DetectIcmpIdData *iid = (DetectIcmpIdData *)ptr;
SCFree(iid);
static int DetectIcmpIdParseTest01 (void)
{
DetectIcmpIdData *iid = NULL;
- iid = DetectIcmpIdParse("300");
+ iid = DetectIcmpIdParse(NULL, "300");
if (iid != NULL && iid->id == htons(300)) {
- DetectIcmpIdFree(iid);
+ DetectIcmpIdFree(NULL, iid);
return 1;
}
return 0;
static int DetectIcmpIdParseTest02 (void)
{
DetectIcmpIdData *iid = NULL;
- iid = DetectIcmpIdParse(" 300 ");
+ iid = DetectIcmpIdParse(NULL, " 300 ");
if (iid != NULL && iid->id == htons(300)) {
- DetectIcmpIdFree(iid);
+ DetectIcmpIdFree(NULL, iid);
return 1;
}
return 0;
static int DetectIcmpIdParseTest03 (void)
{
DetectIcmpIdData *iid = NULL;
- iid = DetectIcmpIdParse("\"300\"");
+ iid = DetectIcmpIdParse(NULL, "\"300\"");
if (iid != NULL && iid->id == htons(300)) {
- DetectIcmpIdFree(iid);
+ DetectIcmpIdFree(NULL, iid);
return 1;
}
return 0;
static int DetectIcmpIdParseTest04 (void)
{
DetectIcmpIdData *iid = NULL;
- iid = DetectIcmpIdParse(" \" 300 \"");
+ iid = DetectIcmpIdParse(NULL, " \" 300 \"");
if (iid != NULL && iid->id == htons(300)) {
- DetectIcmpIdFree(iid);
+ DetectIcmpIdFree(NULL, iid);
return 1;
}
return 0;
static int DetectIcmpIdParseTest05 (void)
{
DetectIcmpIdData *iid = NULL;
- iid = DetectIcmpIdParse("\"300");
+ iid = DetectIcmpIdParse(NULL, "\"300");
if (iid == NULL) {
- DetectIcmpIdFree(iid);
+ DetectIcmpIdFree(NULL, iid);
return 1;
}
return 0;
const Signature *, const SigMatchCtx *);
static int DetectIcmpSeqSetup(DetectEngineCtx *, Signature *, const char *);
void DetectIcmpSeqRegisterTests(void);
-void DetectIcmpSeqFree(void *);
+void DetectIcmpSeqFree(DetectEngineCtx *, void *);
static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterIcmpSeqIsPrefilterable(const Signature *s);
/**
* \brief This function is used to parse icmp_seq option passed via icmp_seq: keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param icmpseqstr Pointer to the user provided icmp_seq options
*
* \retval iseq pointer to DetectIcmpSeqData on success
* \retval NULL on failure
*/
-static DetectIcmpSeqData *DetectIcmpSeqParse (const char *icmpseqstr)
+static DetectIcmpSeqData *DetectIcmpSeqParse (DetectEngineCtx *de_ctx, const char *icmpseqstr)
{
DetectIcmpSeqData *iseq = NULL;
char *substr[3] = {NULL, NULL, NULL};
for (i = 0; i < 3; i++) {
if (substr[i] != NULL) SCFree(substr[i]);
}
- if (iseq != NULL) DetectIcmpSeqFree(iseq);
+ if (iseq != NULL) DetectIcmpSeqFree(de_ctx, iseq);
return NULL;
}
DetectIcmpSeqData *iseq = NULL;
SigMatch *sm = NULL;
- iseq = DetectIcmpSeqParse(icmpseqstr);
+ iseq = DetectIcmpSeqParse(de_ctx, icmpseqstr);
if (iseq == NULL) goto error;
sm = SigMatchAlloc();
return 0;
error:
- if (iseq != NULL) DetectIcmpSeqFree(iseq);
+ if (iseq != NULL) DetectIcmpSeqFree(de_ctx, iseq);
if (sm != NULL) SCFree(sm);
return -1;
*
* \param ptr pointer to DetectIcmpSeqData
*/
-void DetectIcmpSeqFree (void *ptr)
+void DetectIcmpSeqFree (DetectEngineCtx *de_ctx, void *ptr)
{
DetectIcmpSeqData *iseq = (DetectIcmpSeqData *)ptr;
SCFree(iseq);
static int DetectIcmpSeqParseTest01 (void)
{
DetectIcmpSeqData *iseq = NULL;
- iseq = DetectIcmpSeqParse("300");
+ iseq = DetectIcmpSeqParse(NULL, "300");
if (iseq != NULL && htons(iseq->seq) == 300) {
- DetectIcmpSeqFree(iseq);
+ DetectIcmpSeqFree(NULL, iseq);
return 1;
}
return 0;
static int DetectIcmpSeqParseTest02 (void)
{
DetectIcmpSeqData *iseq = NULL;
- iseq = DetectIcmpSeqParse(" 300 ");
+ iseq = DetectIcmpSeqParse(NULL, " 300 ");
if (iseq != NULL && htons(iseq->seq) == 300) {
- DetectIcmpSeqFree(iseq);
+ DetectIcmpSeqFree(NULL, iseq);
return 1;
}
return 0;
static int DetectIcmpSeqParseTest03 (void)
{
DetectIcmpSeqData *iseq = NULL;
- iseq = DetectIcmpSeqParse("badc");
+ iseq = DetectIcmpSeqParse(NULL, "badc");
if (iseq != NULL) {
- DetectIcmpSeqFree(iseq);
+ DetectIcmpSeqFree(NULL, iseq);
return 0;
}
return 1;
static int DetectICMPv6mtuMatch (DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectICMPv6mtuSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectICMPv6mtuFree (void *);
+void DetectICMPv6mtuFree (DetectEngineCtx *de_ctx, void *);
#ifdef UNITTESTS
void DetectICMPv6mtuRegisterTests (void);
#endif
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectICMPv6mtuFree(icmpv6mtud);
+ DetectICMPv6mtuFree(de_ctx, icmpv6mtud);
return -1;
}
*
* \param ptr pointer to DetectU32Data
*/
-void DetectICMPv6mtuFree(void *ptr)
+void DetectICMPv6mtuFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCFree(ptr);
}
const Signature *, const SigMatchCtx *);
static int DetectICodeSetup(DetectEngineCtx *, Signature *, const char *);
void DetectICodeRegisterTests(void);
-void DetectICodeFree(void *);
+void DetectICodeFree(DetectEngineCtx *, void *);
static int PrefilterSetupICode(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterICodeIsPrefilterable(const Signature *s);
/**
* \brief This function is used to parse icode options passed via icode: keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param icodestr Pointer to the user provided icode options
*
* \retval icd pointer to DetectICodeData on success
* \retval NULL on failure
*/
-static DetectICodeData *DetectICodeParse(const char *icodestr)
+static DetectICodeData *DetectICodeParse(DetectEngineCtx *de_ctx, const char *icodestr)
{
DetectICodeData *icd = NULL;
char *args[3] = {NULL, NULL, NULL};
SCFree(args[i]);
}
if (icd != NULL)
- DetectICodeFree(icd);
+ DetectICodeFree(de_ctx, icd);
return NULL;
}
DetectICodeData *icd = NULL;
SigMatch *sm = NULL;
- icd = DetectICodeParse(icodestr);
+ icd = DetectICodeParse(NULL, icodestr);
if (icd == NULL) goto error;
sm = SigMatchAlloc();
return 0;
error:
- if (icd != NULL) DetectICodeFree(icd);
+ if (icd != NULL) DetectICodeFree(de_ctx, icd);
if (sm != NULL) SCFree(sm);
return -1;
}
*
* \param ptr pointer to DetectICodeData
*/
-void DetectICodeFree(void *ptr)
+void DetectICodeFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectICodeData *icd = (DetectICodeData *)ptr;
SCFree(icd);
{
DetectICodeData *icd = NULL;
int result = 0;
- icd = DetectICodeParse("8");
+ icd = DetectICodeParse(NULL, "8");
if (icd != NULL) {
if (icd->code1 == 8 && icd->mode == DETECT_ICODE_EQ)
result = 1;
- DetectICodeFree(icd);
+ DetectICodeFree(NULL, icd);
}
return result;
}
{
DetectICodeData *icd = NULL;
int result = 0;
- icd = DetectICodeParse(">8");
+ icd = DetectICodeParse(NULL, ">8");
if (icd != NULL) {
if (icd->code1 == 8 && icd->mode == DETECT_ICODE_GT)
result = 1;
- DetectICodeFree(icd);
+ DetectICodeFree(NULL, icd);
}
return result;
}
{
DetectICodeData *icd = NULL;
int result = 0;
- icd = DetectICodeParse("<8");
+ icd = DetectICodeParse(NULL, "<8");
if (icd != NULL) {
if (icd->code1 == 8 && icd->mode == DETECT_ICODE_LT)
result = 1;
- DetectICodeFree(icd);
+ DetectICodeFree(NULL, icd);
}
return result;
}
{
DetectICodeData *icd = NULL;
int result = 0;
- icd = DetectICodeParse("8<>20");
+ icd = DetectICodeParse(NULL, "8<>20");
if (icd != NULL) {
if (icd->code1 == 8 && icd->code2 == 20 && icd->mode == DETECT_ICODE_RN)
result = 1;
- DetectICodeFree(icd);
+ DetectICodeFree(NULL, icd);
}
return result;
}
{
DetectICodeData *icd = NULL;
int result = 0;
- icd = DetectICodeParse(" 8 ");
+ icd = DetectICodeParse(NULL, " 8 ");
if (icd != NULL) {
if (icd->code1 == 8 && icd->mode == DETECT_ICODE_EQ)
result = 1;
- DetectICodeFree(icd);
+ DetectICodeFree(NULL, icd);
}
return result;
}
{
DetectICodeData *icd = NULL;
int result = 0;
- icd = DetectICodeParse(" > 8 ");
+ icd = DetectICodeParse(NULL, " > 8 ");
if (icd != NULL) {
if (icd->code1 == 8 && icd->mode == DETECT_ICODE_GT)
result = 1;
- DetectICodeFree(icd);
+ DetectICodeFree(NULL, icd);
}
return result;
}
{
DetectICodeData *icd = NULL;
int result = 0;
- icd = DetectICodeParse(" 8 <> 20 ");
+ icd = DetectICodeParse(NULL, " 8 <> 20 ");
if (icd != NULL) {
if (icd->code1 == 8 && icd->code2 == 20 && icd->mode == DETECT_ICODE_RN)
result = 1;
- DetectICodeFree(icd);
+ DetectICodeFree(NULL, icd);
}
return result;
}
static int DetectICodeParseTest08(void)
{
DetectICodeData *icd = NULL;
- icd = DetectICodeParse("> 8 <> 20");
+ icd = DetectICodeParse(NULL, "> 8 <> 20");
if (icd == NULL)
return 1;
- DetectICodeFree(icd);
+ DetectICodeFree(NULL, icd);
return 0;
}
const Signature *, const SigMatchCtx *);
static int DetectIdSetup (DetectEngineCtx *, Signature *, const char *);
void DetectIdRegisterTests(void);
-void DetectIdFree(void *);
+void DetectIdFree(DetectEngineCtx *, void *);
static int PrefilterSetupId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterIdIsPrefilterable(const Signature *s);
* and put it in the Signature. */
sm = SigMatchAlloc();
if (sm == NULL) {
- DetectIdFree(id_d);
+ DetectIdFree(de_ctx, id_d);
return -1;
}
*
* \param id_d pointer to DetectIdData
*/
-void DetectIdFree(void *ptr)
+void DetectIdFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectIdData *id_d = (DetectIdData *)ptr;
SCFree(id_d);
DetectIdData *id_d = NULL;
id_d = DetectIdParse(" 35402 ");
if (id_d != NULL &&id_d->id==35402) {
- DetectIdFree(id_d);
+ DetectIdFree(NULL, id_d);
return 1;
}
DetectIdData *id_d = NULL;
id_d = DetectIdParse("65537");
if (id_d == NULL) {
- DetectIdFree(id_d);
+ DetectIdFree(NULL, id_d);
return 1;
}
DetectIdData *id_d = NULL;
id_d = DetectIdParse("12what?");
if (id_d == NULL) {
- DetectIdFree(id_d);
+ DetectIdFree(NULL, id_d);
return 1;
}
/* yep, look if we trim blank spaces correctly and ignore "'s */
id_d = DetectIdParse(" \"35402\" ");
if (id_d != NULL &&id_d->id==35402) {
- DetectIdFree(id_d);
+ DetectIdFree(NULL, id_d);
return 1;
}
const Signature *, const SigMatchCtx *);
static int DetectIpOptsSetup (DetectEngineCtx *, Signature *, const char *);
void IpOptsRegisterTests(void);
-void DetectIpOptsFree(void *);
+void DetectIpOptsFree(DetectEngineCtx *, void *);
/**
* \brief Registration function for ipopts: keyword
*
* \param de pointer to DetectIpOptsData
*/
-void DetectIpOptsFree(void *de_ptr)
+void DetectIpOptsFree(DetectEngineCtx *de_ctx, void *de_ptr)
{
DetectIpOptsData *de = (DetectIpOptsData *)de_ptr;
if(de) SCFree(de);
DetectIpOptsData *de = NULL;
de = DetectIpOptsParse("lsrr");
if (de) {
- DetectIpOptsFree(de);
+ DetectIpOptsFree(NULL, de);
return 1;
}
DetectIpOptsData *de = NULL;
de = DetectIpOptsParse("invalidopt");
if (de) {
- DetectIpOptsFree(de);
+ DetectIpOptsFree(NULL, de);
return 0;
}
static int DetectIPProtoSetup(DetectEngineCtx *, Signature *, const char *);
static void DetectIPProtoRegisterTests(void);
-static void DetectIPProtoFree(void *);
+static void DetectIPProtoFree(DetectEngineCtx *, void *);
void DetectIPProtoRegister(void)
{
error:
- DetectIPProtoFree(data);
+ DetectIPProtoFree(de_ctx, data);
return -1;
}
-void DetectIPProtoRemoveAllSMs(Signature *s)
+void DetectIPProtoRemoveAllSMs(DetectEngineCtx *de_ctx, Signature *s)
{
SigMatch *sm = s->init_data->smlists[DETECT_SM_LIST_MATCH];
}
SigMatch *tmp_sm = sm->next;
SigMatchRemoveSMFromList(s, sm, DETECT_SM_LIST_MATCH);
- SigMatchFree(sm);
+ SigMatchFree(de_ctx, sm);
sm = tmp_sm;
}
return;
}
-static void DetectIPProtoFree(void *ptr)
+static void DetectIPProtoFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectIPProtoData *data = (DetectIPProtoData *)ptr;
if (data) {
for (i = (value / 8) + 1; i < (256 / 8); i++) {
FAIL_IF(sig->proto.proto[i] != 0);
}
- SigFree(sig);
+ SigFree(NULL, sig);
PASS;
}
end:
if (sig != NULL)
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
result = 1;
end:
- SigFree(sig);
+ SigFree(NULL, sig);
return result;
}
* \brief Registration function for ip_proto keyword.
*/
void DetectIPProtoRegister (void);
-void DetectIPProtoRemoveAllSMs(Signature *);
+void DetectIPProtoRemoveAllSMs(DetectEngineCtx *, Signature *);
#endif /* __DETECT_IPPROTO_H__ */
static int DetectIPRepMatch (DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectIPRepSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectIPRepFree (void *);
+void DetectIPRepFree (DetectEngineCtx *, void *);
void IPRepRegisterTests(void);
void DetectIPRepRegister (void)
return -1;
}
-void DetectIPRepFree (void *ptr)
+void DetectIPRepFree (DetectEngineCtx *de_ctx, void *ptr)
{
DetectIPRepData *fd = (DetectIPRepData *)ptr;
int DetectIsdataatSetup (DetectEngineCtx *, Signature *, const char *);
void DetectIsdataatRegisterTests(void);
-void DetectIsdataatFree(void *);
+void DetectIsdataatFree(DetectEngineCtx *, void *);
static int DetectEndsWithSetup (DetectEngineCtx *de_ctx, Signature *s, const char *nullstr);
/**
* \brief This function is used to parse isdataat options passed via isdataat: keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param isdataatstr Pointer to the user provided isdataat options
*
* \retval idad pointer to DetectIsdataatData on success
* \retval NULL on failure
*/
-static DetectIsdataatData *DetectIsdataatParse (const char *isdataatstr, char **offset)
+static DetectIsdataatData *DetectIsdataatParse (DetectEngineCtx *de_ctx, const char *isdataatstr, char **offset)
{
DetectIsdataatData *idad = NULL;
char *args[3] = {NULL,NULL,NULL};
}
if (idad != NULL)
- DetectIsdataatFree(idad);
+ DetectIsdataatFree(de_ctx, idad);
return NULL;
}
char *offset = NULL;
int ret = -1;
- idad = DetectIsdataatParse(isdataatstr, &offset);
+ idad = DetectIsdataatParse(de_ctx, isdataatstr, &offset);
if (idad == NULL)
return -1;
idad->dataat == 1 &&
(idad->flags & (ISDATAAT_RELATIVE|ISDATAAT_NEGATED)) == (ISDATAAT_RELATIVE|ISDATAAT_NEGATED))
{
- DetectIsdataatFree(idad);
+ DetectIsdataatFree(de_ctx, idad);
DetectContentData *cd = (DetectContentData *)prev_pm->ctx;
cd->flags |= DETECT_CONTENT_ENDS_WITH;
ret = 0;
if (offset)
SCFree(offset);
if (ret != 0)
- DetectIsdataatFree(idad);
+ DetectIsdataatFree(de_ctx, idad);
return ret;
}
*
* \param idad pointer to DetectIsdataatData
*/
-void DetectIsdataatFree(void *ptr)
+void DetectIsdataatFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectIsdataatData *idad = (DetectIsdataatData *)ptr;
SCFree(idad);
{
int result = 0;
DetectIsdataatData *idad = NULL;
- idad = DetectIsdataatParse("30 ", NULL);
+ idad = DetectIsdataatParse(NULL, "30 ", NULL);
if (idad != NULL) {
- DetectIsdataatFree(idad);
+ DetectIsdataatFree(NULL, idad);
result = 1;
}
{
int result = 0;
DetectIsdataatData *idad = NULL;
- idad = DetectIsdataatParse("30 , relative", NULL);
+ idad = DetectIsdataatParse(NULL, "30 , relative", NULL);
if (idad != NULL && idad->flags & ISDATAAT_RELATIVE && !(idad->flags & ISDATAAT_RAWBYTES)) {
- DetectIsdataatFree(idad);
+ DetectIsdataatFree(NULL, idad);
result = 1;
}
{
int result = 0;
DetectIsdataatData *idad = NULL;
- idad = DetectIsdataatParse("30,relative, rawbytes ", NULL);
+ idad = DetectIsdataatParse(NULL, "30,relative, rawbytes ", NULL);
if (idad != NULL && idad->flags & ISDATAAT_RELATIVE && idad->flags & ISDATAAT_RAWBYTES) {
- DetectIsdataatFree(idad);
+ DetectIsdataatFree(NULL, idad);
result = 1;
}
int result = 1;
if (DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0) {
- SigFree(s);
+ SigFree(NULL, s);
return 0;
}
result &= (DetectIsdataatSetup(NULL, s, "30") == 0);
result &= (s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
- SigFree(s);
+ SigFree(NULL, s);
s = SigAlloc();
if (DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0) {
- SigFree(s);
+ SigFree(NULL, s);
return 0;
}
/* failure since we have no preceding content/pcre/bytejump */
result &= (DetectIsdataatSetup(NULL, s, "30,relative") == 0);
result &= (s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
- SigFree(s);
+ SigFree(NULL, s);
return result;
}
const Signature *, const SigMatchCtx *);
static int DetectITypeSetup(DetectEngineCtx *, Signature *, const char *);
void DetectITypeRegisterTests(void);
-void DetectITypeFree(void *);
+void DetectITypeFree(DetectEngineCtx *, void *);
static int PrefilterSetupIType(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterITypeIsPrefilterable(const Signature *s);
/**
* \brief This function is used to parse itype options passed via itype: keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param itypestr Pointer to the user provided itype options
*
* \retval itd pointer to DetectITypeData on success
* \retval NULL on failure
*/
-static DetectITypeData *DetectITypeParse(const char *itypestr)
+static DetectITypeData *DetectITypeParse(DetectEngineCtx *de_ctx, const char *itypestr)
{
DetectITypeData *itd = NULL;
char *args[3] = {NULL, NULL, NULL};
SCFree(args[i]);
}
if (itd != NULL)
- DetectITypeFree(itd);
+ DetectITypeFree(de_ctx, itd);
return NULL;
}
DetectITypeData *itd = NULL;
SigMatch *sm = NULL;
- itd = DetectITypeParse(itypestr);
+ itd = DetectITypeParse(de_ctx, itypestr);
if (itd == NULL) goto error;
sm = SigMatchAlloc();
return 0;
error:
- if (itd != NULL) DetectITypeFree(itd);
+ if (itd != NULL) DetectITypeFree(de_ctx, itd);
if (sm != NULL) SCFree(sm);
return -1;
}
*
* \param ptr pointer to DetectITypeData
*/
-void DetectITypeFree(void *ptr)
+void DetectITypeFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectITypeData *itd = (DetectITypeData *)ptr;
SCFree(itd);
{
DetectITypeData *itd = NULL;
int result = 0;
- itd = DetectITypeParse("8");
+ itd = DetectITypeParse(NULL, "8");
if (itd != NULL) {
if (itd->type1 == 8 && itd->mode == DETECT_ITYPE_EQ)
result = 1;
- DetectITypeFree(itd);
+ DetectITypeFree(NULL, itd);
}
return result;
}
{
DetectITypeData *itd = NULL;
int result = 0;
- itd = DetectITypeParse(">8");
+ itd = DetectITypeParse(NULL, ">8");
if (itd != NULL) {
if (itd->type1 == 8 && itd->mode == DETECT_ITYPE_GT)
result = 1;
- DetectITypeFree(itd);
+ DetectITypeFree(NULL, itd);
}
return result;
}
{
DetectITypeData *itd = NULL;
int result = 0;
- itd = DetectITypeParse("<8");
+ itd = DetectITypeParse(NULL, "<8");
if (itd != NULL) {
if (itd->type1 == 8 && itd->mode == DETECT_ITYPE_LT)
result = 1;
- DetectITypeFree(itd);
+ DetectITypeFree(NULL, itd);
}
return result;
}
{
DetectITypeData *itd = NULL;
int result = 0;
- itd = DetectITypeParse("8<>20");
+ itd = DetectITypeParse(NULL, "8<>20");
if (itd != NULL) {
if (itd->type1 == 8 && itd->type2 == 20 && itd->mode == DETECT_ITYPE_RN)
result = 1;
- DetectITypeFree(itd);
+ DetectITypeFree(NULL, itd);
}
return result;
}
{
DetectITypeData *itd = NULL;
int result = 0;
- itd = DetectITypeParse(" 8 ");
+ itd = DetectITypeParse(NULL, " 8 ");
if (itd != NULL) {
if (itd->type1 == 8 && itd->mode == DETECT_ITYPE_EQ)
result = 1;
- DetectITypeFree(itd);
+ DetectITypeFree(NULL, itd);
}
return result;
}
{
DetectITypeData *itd = NULL;
int result = 0;
- itd = DetectITypeParse(" > 8 ");
+ itd = DetectITypeParse(NULL, " > 8 ");
if (itd != NULL) {
if (itd->type1 == 8 && itd->mode == DETECT_ITYPE_GT)
result = 1;
- DetectITypeFree(itd);
+ DetectITypeFree(NULL, itd);
}
return result;
}
{
DetectITypeData *itd = NULL;
int result = 0;
- itd = DetectITypeParse(" 8 <> 20 ");
+ itd = DetectITypeParse(NULL, " 8 <> 20 ");
if (itd != NULL) {
if (itd->type1 == 8 && itd->type2 == 20 && itd->mode == DETECT_ITYPE_RN)
result = 1;
- DetectITypeFree(itd);
+ DetectITypeFree(NULL, itd);
}
return result;
}
static int DetectITypeParseTest08(void)
{
DetectITypeData *itd = NULL;
- itd = DetectITypeParse("> 8 <> 20");
+ itd = DetectITypeParse(NULL, "> 8 <> 20");
if (itd == NULL)
return 1;
- DetectITypeFree(itd);
+ DetectITypeFree(NULL, itd);
return 0;
}
uint8_t, void *, void *, const Signature *,
const SigMatchCtx *);
static int DetectKrb5ErrCodeSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectKrb5ErrCodeFree (void *);
+static void DetectKrb5ErrCodeFree (DetectEngineCtx *, void *);
static void DetectKrb5ErrCodeRegisterTests (void);
static int DetectEngineInspectKRB5Generic(ThreadVars *tv,
error:
if (krb5d != NULL)
- DetectKrb5ErrCodeFree(krb5d);
+ DetectKrb5ErrCodeFree(de_ctx, krb5d);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param ptr pointer to DetectKrb5Data
*/
-static void DetectKrb5ErrCodeFree(void *ptr) {
+static void DetectKrb5ErrCodeFree(DetectEngineCtx *de_ctx, void *ptr) {
DetectKrb5ErrCodeData *krb5d = (DetectKrb5ErrCodeData *)ptr;
SCFree(krb5d);
DetectKrb5ErrCodeData *krb5d = DetectKrb5ErrCodeParse("10");
FAIL_IF_NULL(krb5d);
FAIL_IF(!(krb5d->err_code == 10));
- DetectKrb5ErrCodeFree(krb5d);
+ DetectKrb5ErrCodeFree(NULL, krb5d);
PASS;
}
uint8_t, void *, void *, const Signature *,
const SigMatchCtx *);
static int DetectKrb5MsgTypeSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectKrb5MsgTypeFree (void *);
+static void DetectKrb5MsgTypeFree (DetectEngineCtx *, void *);
static void DetectKrb5MsgTypeRegisterTests (void);
static int DetectEngineInspectKRB5Generic(ThreadVars *tv,
error:
if (krb5d != NULL)
- DetectKrb5MsgTypeFree(krb5d);
+ DetectKrb5MsgTypeFree(de_ctx, krb5d);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param ptr pointer to DetectKrb5Data
*/
-static void DetectKrb5MsgTypeFree(void *ptr) {
+static void DetectKrb5MsgTypeFree(DetectEngineCtx *de_ctx, void *ptr) {
DetectKrb5MsgTypeData *krb5d = (DetectKrb5MsgTypeData *)ptr;
SCFree(krb5d);
DetectKrb5MsgTypeData *krb5d = DetectKrb5MsgTypeParse("10");
FAIL_IF_NULL(krb5d);
FAIL_IF(!(krb5d->msg_type == 10));
- DetectKrb5MsgTypeFree(krb5d);
+ DetectKrb5MsgTypeFree(NULL, krb5d);
PASS;
}
const SigMatchCtx *ctx);
static int DetectLuaSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectLuaRegisterTests(void);
-static void DetectLuaFree(void *);
+static void DetectLuaFree(DetectEngineCtx *, void *);
static int g_smtp_generic_list_id = 0;
static int InspectSmtpGeneric(ThreadVars *tv,
/**
* \brief Parse the lua keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param str Pointer to the user provided option
*
* \retval lua pointer to DetectLuaData on success
* \retval NULL on failure
*/
-static DetectLuaData *DetectLuaParse (const DetectEngineCtx *de_ctx, const char *str)
+static DetectLuaData *DetectLuaParse (DetectEngineCtx *de_ctx, const char *str)
{
DetectLuaData *lua = NULL;
error:
if (lua != NULL)
- DetectLuaFree(lua);
+ DetectLuaFree(de_ctx, lua);
return NULL;
}
error:
if (lua != NULL)
- DetectLuaFree(lua);
+ DetectLuaFree(de_ctx, lua);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param ptr pointer to DetectLuaData
*/
-static void DetectLuaFree(void *ptr)
+static void DetectLuaFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr != NULL) {
DetectLuaData *lua = (DetectLuaData *)ptr;
static int DetectMarkSetup (DetectEngineCtx *, Signature *, const char *);
static int DetectMarkPacket(DetectEngineThreadCtx *det_ctx, Packet *p,
const Signature *s, const SigMatchCtx *ctx);
-void DetectMarkDataFree(void *ptr);
+void DetectMarkDataFree(DetectEngineCtx *, void *ptr);
/**
* \brief Registration function for nfq_set_mark: keyword
}
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectMarkDataFree(data);
+ DetectMarkDataFree(de_ctx, data);
return -1;
}
#endif
}
-void DetectMarkDataFree(void *ptr)
+void DetectMarkDataFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectMarkData *data = (DetectMarkData *)ptr;
SCFree(data);
return 0;
}
- DetectMarkDataFree(data);
+ DetectMarkDataFree(NULL, data);
return 1;
}
return 1;
}
- DetectMarkDataFree(data);
+ DetectMarkDataFree(NULL, data);
return 0;
}
return 0;
}
- DetectMarkDataFree(data);
+ DetectMarkDataFree(NULL, data);
return 1;
}
return 1;
}
- DetectMarkDataFree(data);
+ DetectMarkDataFree(NULL, data);
return 0;
}
*
* \param ptr pointer to DetectModbus
*/
-static void DetectModbusFree(void *ptr) {
+static void DetectModbusFree(DetectEngineCtx *de_ctx, void *ptr) {
SCEnter();
DetectModbus *modbus = (DetectModbus *) ptr;
*
* \brief This function is used to parse Modbus parameters in access mode
*
+ * \param de_ctx Pointer to the detection engine context
* \param str Pointer to the user provided id option
*
* \retval Pointer to DetectModbusData on success or NULL on failure
*/
-static DetectModbus *DetectModbusAccessParse(const char *str)
+static DetectModbus *DetectModbusAccessParse(DetectEngineCtx *de_ctx, const char *str)
{
SCEnter();
DetectModbus *modbus = NULL;
error:
if (modbus != NULL)
- DetectModbusFree(modbus);
+ DetectModbusFree(de_ctx, modbus);
SCReturnPtr(NULL, "DetectModbus");
}
* \retval id_d pointer to DetectModbusData on success
* \retval NULL on failure
*/
-static DetectModbus *DetectModbusFunctionParse(const char *str)
+static DetectModbus *DetectModbusFunctionParse(DetectEngineCtx *de_ctx, const char *str)
{
SCEnter();
DetectModbus *modbus = NULL;
error:
if (modbus != NULL)
- DetectModbusFree(modbus);
+ DetectModbusFree(de_ctx, modbus);
SCReturnPtr(NULL, "DetectModbus");
}
*
* \retval Pointer to DetectModbusUnit on success or NULL on failure
*/
-static DetectModbus *DetectModbusUnitIdParse(const char *str)
+static DetectModbus *DetectModbusUnitIdParse(DetectEngineCtx *de_ctx, const char *str)
{
SCEnter();
DetectModbus *modbus = NULL;
goto error;
}
- if ((modbus = DetectModbusFunctionParse(str_ptr)) == NULL) {
- if ((modbus = DetectModbusAccessParse(str_ptr)) == NULL) {
+ if ((modbus = DetectModbusFunctionParse(de_ctx, str_ptr)) == NULL) {
+ if ((modbus = DetectModbusAccessParse(de_ctx, str_ptr)) == NULL) {
SCLogError(SC_ERR_PCRE_MATCH, "invalid modbus option");
goto error;
}
error:
if (modbus != NULL)
- DetectModbusFree(modbus);
+ DetectModbusFree(de_ctx, modbus);
SCReturnPtr(NULL, "DetectModbus");
}
if (DetectSignatureSetAppProto(s, ALPROTO_MODBUS) != 0)
return -1;
- if ((modbus = DetectModbusUnitIdParse(str)) == NULL) {
- if ((modbus = DetectModbusFunctionParse(str)) == NULL) {
- if ((modbus = DetectModbusAccessParse(str)) == NULL) {
+ if ((modbus = DetectModbusUnitIdParse(de_ctx, str)) == NULL) {
+ if ((modbus = DetectModbusFunctionParse(de_ctx, str)) == NULL) {
+ if ((modbus = DetectModbusAccessParse(de_ctx, str)) == NULL) {
SCLogError(SC_ERR_PCRE_MATCH, "invalid modbus option");
goto error;
}
error:
if (modbus != NULL)
- DetectModbusFree(modbus);
+ DetectModbusFree(de_ctx, modbus);
if (sm != NULL)
SCFree(sm);
SCReturnInt(-1);
result = 1;
end:
if (sig != NULL)
- SigFree(sig);
+ SigFree(de_ctx, sig);
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
result = 1;
end:
if (sig != NULL)
- SigFree(sig);
+ SigFree(de_ctx, sig);
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
result = 1;
end:
if (sig != NULL)
- SigFree(sig);
+ SigFree(de_ctx, sig);
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
static DetectNfsProcedureData *DetectNfsProcedureParse (const char *);
static int DetectNfsProcedureSetup (DetectEngineCtx *, Signature *s, const char *str);
-static void DetectNfsProcedureFree(void *);
+static void DetectNfsProcedureFree(DetectEngineCtx *, void *);
static void DetectNfsProcedureRegisterTests(void);
static int g_nfs_request_buffer_id = 0;
return 0;
error:
- DetectNfsProcedureFree(dd);
+ DetectNfsProcedureFree(de_ctx, dd);
return -1;
}
*
* \param de_ptr Pointer to DetectNfsProcedureData.
*/
-void DetectNfsProcedureFree(void *ptr)
+void DetectNfsProcedureFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCFree(ptr);
}
dd = DetectNfsProcedureParse("1430000000");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->mode == PROCEDURE_EQ);
- DetectNfsProcedureFree(dd);
+ DetectNfsProcedureFree(NULL, dd);
PASS;
}
dd = DetectNfsProcedureParse(">1430000000");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->mode == PROCEDURE_GT);
- DetectNfsProcedureFree(dd);
+ DetectNfsProcedureFree(NULL, dd);
PASS;
}
dd = DetectNfsProcedureParse("<1430000000");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->mode == PROCEDURE_LT);
- DetectNfsProcedureFree(dd);
+ DetectNfsProcedureFree(NULL, dd);
PASS;
}
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->hi == 1470000000 &&
dd->mode == PROCEDURE_RA);
- DetectNfsProcedureFree(dd);
+ DetectNfsProcedureFree(NULL, dd);
PASS;
}
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->hi == 1490000000 &&
dd->mode == PROCEDURE_RA);
- DetectNfsProcedureFree(dd);
+ DetectNfsProcedureFree(NULL, dd);
PASS;
}
dd = DetectNfsProcedureParse("> 1430000000 ");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->mode == PROCEDURE_GT);
- DetectNfsProcedureFree(dd);
+ DetectNfsProcedureFree(NULL, dd);
PASS;
}
dd = DetectNfsProcedureParse("< 1490000000 ");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1490000000 && dd->mode == PROCEDURE_LT);
- DetectNfsProcedureFree(dd);
+ DetectNfsProcedureFree(NULL, dd);
PASS;
}
dd = DetectNfsProcedureParse(" 1490000000 ");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1490000000 && dd->mode == PROCEDURE_EQ);
- DetectNfsProcedureFree(dd);
+ DetectNfsProcedureFree(NULL, dd);
PASS;
}
static DetectNfsVersionData *DetectNfsVersionParse (const char *);
static int DetectNfsVersionSetup (DetectEngineCtx *, Signature *s, const char *str);
-static void DetectNfsVersionFree(void *);
+static void DetectNfsVersionFree(DetectEngineCtx *de_ctx, void *);
static void DetectNfsVersionRegisterTests(void);
static int g_nfs_request_buffer_id = 0;
return 0;
error:
- DetectNfsVersionFree(dd);
+ DetectNfsVersionFree(de_ctx, dd);
return -1;
}
*
* \param de_ptr Pointer to DetectNfsVersionData.
*/
-void DetectNfsVersionFree(void *ptr)
+void DetectNfsVersionFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCFree(ptr);
}
dd = DetectNfsVersionParse("1430000000");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->mode == PROCEDURE_EQ);
- DetectNfsVersionFree(dd);
+ DetectNfsVersionFree(NULL, dd);
PASS;
}
dd = DetectNfsVersionParse(">1430000000");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->mode == PROCEDURE_GT);
- DetectNfsVersionFree(dd);
+ DetectNfsVersionFree(NULL, dd);
PASS;
}
dd = DetectNfsVersionParse("<1430000000");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->mode == PROCEDURE_LT);
- DetectNfsVersionFree(dd);
+ DetectNfsVersionFree(NULL, dd);
PASS;
}
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->hi == 1470000000 &&
dd->mode == PROCEDURE_RA);
- DetectNfsVersionFree(dd);
+ DetectNfsVersionFree(NULL, dd);
PASS;
}
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->hi == 1490000000 &&
dd->mode == PROCEDURE_RA);
- DetectNfsVersionFree(dd);
+ DetectNfsVersionFree(NULL, dd);
PASS;
}
dd = DetectNfsVersionParse("> 1430000000 ");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1430000000 && dd->mode == PROCEDURE_GT);
- DetectNfsVersionFree(dd);
+ DetectNfsVersionFree(NULL, dd);
PASS;
}
dd = DetectNfsVersionParse("< 1490000000 ");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1490000000 && dd->mode == PROCEDURE_LT);
- DetectNfsVersionFree(dd);
+ DetectNfsVersionFree(NULL, dd);
PASS;
}
dd = DetectNfsVersionParse(" 1490000000 ");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->lo == 1490000000 && dd->mode == PROCEDURE_EQ);
- DetectNfsVersionFree(dd);
+ DetectNfsVersionFree(NULL, dd);
PASS;
}
/** \brief free a SigMatch
* \param sm SigMatch to free.
*/
-void SigMatchFree(SigMatch *sm)
+void SigMatchFree(DetectEngineCtx *de_ctx, SigMatch *sm)
{
if (sm == NULL)
return;
/** free the ctx, for that we call the Free func */
if (sm->ctx != NULL) {
if (sigmatch_table[sm->type].Free != NULL) {
- sigmatch_table[sm->type].Free(sm->ctx);
+ sigmatch_table[sm->type].Free(de_ctx, sm->ctx);
}
}
SCFree(sm);
} while (ret == 1);
}
- DetectIPProtoRemoveAllSMs(s);
+ DetectIPProtoRemoveAllSMs(de_ctx, s);
SCReturnInt(ret);
}
SCReturn;
}
-static void SigMatchFreeArrays(Signature *s, int ctxs)
+static void SigMatchFreeArrays(DetectEngineCtx *de_ctx, Signature *s, int ctxs)
{
if (s != NULL) {
int type;
SigMatchData *smd = s->sm_arrays[type];
while(1) {
if (sigmatch_table[smd->type].Free != NULL) {
- sigmatch_table[smd->type].Free(smd->ctx);
+ sigmatch_table[smd->type].Free(de_ctx, smd->ctx);
}
if (smd->is_last)
break;
}
}
-void SigFree(Signature *s)
+void SigFree(DetectEngineCtx *de_ctx, Signature *s)
{
if (s == NULL)
return;
SigMatch *sm = s->init_data->smlists[i];
while (sm != NULL) {
SigMatch *nsm = sm->next;
- SigMatchFree(sm);
+ SigMatchFree(de_ctx, sm);
sm = nsm;
}
}
}
- SigMatchFreeArrays(s, (s->init_data == NULL));
+ SigMatchFreeArrays(de_ctx, s, (s->init_data == NULL));
if (s->init_data) {
SCFree(s->init_data->smlists);
SCFree(s->init_data->smlists_tail);
SigRefFree(s);
SigMetadataFree(s);
- DetectEngineAppInspectionEngineSignatureFree(s);
+ DetectEngineAppInspectionEngineSignatureFree(de_ctx, s);
SCFree(s);
}
AppLayerProtoDetectSupportedIpprotos(sig->alproto, sig->proto.proto);
}
- ret = DetectAppLayerEventPrepare(sig);
+ ret = DetectAppLayerEventPrepare(de_ctx, sig);
if (ret == -3) {
de_ctx->sigerror_silent = true;
de_ctx->sigerror_ok = true;
error:
if (sig != NULL) {
- SigFree(sig);
+ SigFree(de_ctx, sig);
}
return NULL;
}
error:
if (sig != NULL) {
- SigFree(sig);
+ SigFree(de_ctx, sig);
}
/* if something failed, restore the old signum count
* since we didn't install it */
if (sw_dup->s->init_data->init_flags & SIG_FLAG_INIT_BIDIREC) {
sw_temp.s = sw_dup->s->next->next;
de_ctx->sig_list = sw_dup->s->next->next;
- SigFree(sw_dup->s->next);
+ SigFree(de_ctx, sw_dup->s->next);
} else {
sw_temp.s = sw_dup->s->next;
de_ctx->sig_list = sw_dup->s->next;
(void *)&sw_temp, 0);
sw_next->s_prev = sw_dup->s_prev;
}
- SigFree(sw_dup->s);
+ SigFree(de_ctx, sw_dup->s);
} else {
SigDuplWrapper sw_temp;
memset(&sw_temp, 0, sizeof(SigDuplWrapper));
if (sw_dup->s->init_data->init_flags & SIG_FLAG_INIT_BIDIREC) {
sw_temp.s = sw_dup->s->next->next;
sw_dup->s_prev->next = sw_dup->s->next->next;
- SigFree(sw_dup->s->next);
+ SigFree(de_ctx, sw_dup->s->next);
} else {
sw_temp.s = sw_dup->s->next;
sw_dup->s_prev->next = sw_dup->s->next;
(void *)&sw_temp, 0);
sw_next->s_prev = sw_dup->s_prev;;
}
- SigFree(sw_dup->s);
+ SigFree(de_ctx, sw_dup->s);
}
/* make changes to the entry to reflect the presence of the new sig */
error:
/* free the 2nd sig bidir may have set up */
if (sig != NULL && sig->next != NULL) {
- SigFree(sig->next);
+ SigFree(de_ctx, sig->next);
sig->next = NULL;
}
if (sig != NULL) {
- SigFree(sig);
+ SigFree(de_ctx, sig);
}
return NULL;
}
result = 0;
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
if (port != NULL)
DetectPortCleanupList(de_ctx, port);
if (sig != NULL)
- SigFree(sig);
+ SigFree(de_ctx, sig);
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
}
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
result = 0;
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
}
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
end:
if (sig != NULL)
- SigFree(sig);
+ SigFree(de_ctx, sig);
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
result = 1;
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
result = 1;
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
result = 1;
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
result = 1;
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
result = 1;
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
result = 1;
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
result = 1;
end:
- if (sig != NULL) SigFree(sig);
+ if (sig != NULL) SigFree(de_ctx, sig);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
return result;
}
s = SigInit(de_ctx,"alert tcp !any any -> any any (msg:\"SigTest41-01 src address is !any \"; classtype:misc-activity; sid:410001; rev:1;)");
if (s != NULL) {
- SigFree(s);
+ SigFree(de_ctx, s);
goto end;
}
s = SigInit(de_ctx,"alert tcp any !any -> any any (msg:\"SigTest41-02 src ip is !any \"; classtype:misc-activity; sid:410002; rev:1;)");
if (s != NULL) {
- SigFree(s);
+ SigFree(de_ctx, s);
goto end;
}
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(s);
+ SigFree(de_ctx, s);
goto end;
}
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(s);
+ SigFree(de_ctx, s);
goto end;
}
s = SigInit(de_ctx,"alert tcp any any -> [192.168.0.2,!192.168.0.2] any (msg:\"SigTest41-04 dst ip [192.168.0.2,!192.168.0.2] \"; classtype:misc-activity; sid:410004; rev:1;)");
if (s != NULL) {
- SigFree(s);
+ SigFree(de_ctx, s);
goto end;
}
s = SigInit(de_ctx,"alert tcp any any -> any [100:1000,!1:20000] (msg:\"SigTest41-05 dst port [100:1000,!1:20000] \"; classtype:misc-activity; sid:410005; rev:1;)");
if (s != NULL) {
- SigFree(s);
+ SigFree(de_ctx, s);
goto end;
}
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(s);
+ SigFree(de_ctx, s);
goto end;
}
result = 1;
end:
if (sig != NULL)
- SigFree(sig);
+ SigFree(de_ctx, sig);
DetectEngineCtxFree(de_ctx);
return result;
}
result = 1;
end:
if (sig != NULL)
- SigFree(sig);
+ SigFree(de_ctx, sig);
DetectEngineCtxFree(de_ctx);
return result;
}
result = 1;
end:
if (s != NULL)
- SigFree(s);
+ SigFree(de_ctx, s);
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
result = 1;
end:
if (s != NULL)
- SigFree(s);
+ SigFree(de_ctx, s);
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
s = SigInit(de_ctx,"alert tls any any -> any any (msg:\"SigParseTestAppLayerTLS03 \"; tls.version:2.5; sid:410006; rev:1;)");
if (s != NULL) {
- SigFree(s);
+ SigFree(de_ctx, s);
goto end;
}
FAIL_IF_NOT_NULL(s->next);
FAIL_IF(s->init_data->init_flags & SIG_FLAG_INIT_BIDIREC);
- SigFree(s);
+ SigFree(de_ctx, s);
s = SigInit(de_ctx,
"alert tcp any [80, 81] <> any [81, 80] (sid:1; rev:1;)");
FAIL_IF_NOT_NULL(s->next);
FAIL_IF(s->init_data->init_flags & SIG_FLAG_INIT_BIDIREC);
- SigFree(s);
+ SigFree(de_ctx, s);
s = SigInit(de_ctx,
"alert tcp [1.2.3.4, 5.6.7.8] [80, 81] <> [5.6.7.8, 1.2.3.4] [81, 80] (sid:1; rev:1;)");
FAIL_IF_NOT_NULL(s->next);
FAIL_IF(s->init_data->init_flags & SIG_FLAG_INIT_BIDIREC);
- SigFree(s);
+ SigFree(de_ctx, s);
PASS;
}
FAIL_IF_NULL(s->next);
FAIL_IF_NOT(s->init_data->init_flags & SIG_FLAG_INIT_BIDIREC);
- SigFree(s);
+ SigFree(de_ctx, s);
// Source is a subset of destinationn
s = SigInit(de_ctx,
FAIL_IF_NULL(s->next);
FAIL_IF_NOT(s->init_data->init_flags & SIG_FLAG_INIT_BIDIREC);
- SigFree(s);
+ SigFree(de_ctx, s);
// Source intersects with destination
s = SigInit(de_ctx,
FAIL_IF_NULL(s->next);
FAIL_IF_NOT(s->init_data->init_flags & SIG_FLAG_INIT_BIDIREC);
- SigFree(s);
+ SigFree(de_ctx, s);
PASS;
}
/* prototypes */
Signature *SigAlloc(void);
-void SigFree(Signature *s);
+void SigFree(DetectEngineCtx *de_ctx, Signature *s);
Signature *SigInit(DetectEngineCtx *, const char *sigstr);
Signature *SigInitReal(DetectEngineCtx *, const char *);
SigMatchData* SigMatchList2DataArray(SigMatch *head);
}
static int DetectPcreSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectPcreFree(void *);
+static void DetectPcreFree(DetectEngineCtx *, void *);
static void DetectPcreRegisterTests(void);
void DetectPcreRegister (void)
return pd;
error:
- DetectPcreFree(pd);
+ DetectPcreFree(de_ctx, pd);
return NULL;
}
uint8_t x;
for (x = 0; x < pd->idx; x++) {
- if (DetectFlowvarPostMatchSetup(s, pd->capids[x]) < 0)
+ if (DetectFlowvarPostMatchSetup(de_ctx, s, pd->capids[x]) < 0)
goto error_nofree;
}
ret = 0;
SCReturnInt(ret);
error:
- DetectPcreFree(pd);
+ DetectPcreFree(de_ctx, pd);
error_nofree:
SCReturnInt(ret);
}
-static void DetectPcreFree(void *ptr)
+static void DetectPcreFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr == NULL)
return;
FAIL_IF_NULL(pd);
FAIL_IF_NOT(alproto == ALPROTO_UNKNOWN);
- DetectPcreFree(pd);
+ DetectPcreFree(NULL, pd);
DetectEngineCtxFree(de_ctx);
return result;
}
FAIL_IF_NULL(pd);
FAIL_IF_NOT(alproto == ALPROTO_UNKNOWN);
- DetectPcreFree(pd);
+ DetectPcreFree(NULL, pd);
DetectEngineCtxFree(de_ctx);
return result;
}
FAIL_IF_NULL(pd);
FAIL_IF_NOT(alproto == ALPROTO_UNKNOWN);
- DetectPcreFree(pd);
+ DetectPcreFree(NULL, pd);
DetectEngineCtxFree(de_ctx);
return result;
}
FAIL_IF_NULL(pd);
FAIL_IF_NOT(alproto == ALPROTO_HTTP);
- DetectPcreFree(pd);
+ DetectPcreFree(NULL, pd);
DetectEngineCtxFree(de_ctx);
return result;
}
FAIL_IF_NULL(pd);
FAIL_IF_NOT(alproto == ALPROTO_UNKNOWN);
- DetectPcreFree(pd);
+ DetectPcreFree(NULL, pd);
DetectEngineCtxFree(de_ctx);
return result;
}
pd = DetectPcreParse(de_ctx, teststring, &list, NULL, 0, false, &alproto);
FAIL_IF_NULL(pd);
- DetectPcreFree(pd);
+ DetectPcreFree(NULL, pd);
DetectEngineCtxFree(de_ctx);
PASS;
}
FAIL_IF_NOT(DetectPcreSetup(de_ctx, s, "/bamboo/") == 0);
FAIL_IF_NOT(s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
- SigFree(s);
+ SigFree(de_ctx, s);
s = SigAlloc();
FAIL_IF_NULL(s);
FAIL_IF_NOT(DetectPcreSetup(de_ctx, s, "/bamboo/") == 0);
FAIL_IF_NOT(s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
- SigFree(s);
+ SigFree(de_ctx, s);
DetectEngineCtxFree(de_ctx);
PASS;
DetectPcreData *pd = DetectPcreParse(de_ctx, "/domain\\.com/W", &list, NULL, 0, false, &alproto);
FAIL_IF(pd == NULL);
- DetectPcreFree(pd);
+ DetectPcreFree(NULL, pd);
list = DETECT_SM_LIST_NOTSET;
pd = DetectPcreParse(de_ctx, "/dOmain\\.com/W", &list, NULL, 0, false, &alproto);
list = DETECT_SM_LIST_NOTSET;
pd = DetectPcreParse(de_ctx, "/domain\\D+\\.com/W", &list, NULL, 0, false, &alproto);
FAIL_IF(pd == NULL);
- DetectPcreFree(pd);
+ DetectPcreFree(NULL, pd);
/* This should not parse as the first \ escapes the second \, then
* we have a D. */
static int DetectPktvarMatch (DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectPktvarSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectPktvarFree(void *data);
+static void DetectPktvarFree(DetectEngineCtx *, void *data);
void DetectPktvarRegister (void)
{
return ret;
}
-static void DetectPktvarFree(void *ptr)
+static void DetectPktvarFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectPktvarData *data = ptr;
if (data != NULL) {
* and put it in the Signature. */
SigMatch *sm = SigMatchAlloc();
if (unlikely(sm == NULL)) {
- DetectPktvarFree(cd);
+ DetectPktvarFree(de_ctx, cd);
return -1;
}
sm->type = DETECT_PKTVAR;
const SigMatchCtx *ctx);
static int DetectRfbSecresultSetup (DetectEngineCtx *, Signature *, const char *);
void RfbSecresultRegisterTests(void);
-void DetectRfbSecresultFree(void *);
+void DetectRfbSecresultFree(DetectEngineCtx *, void *);
static int DetectEngineInspectRfbSecresultGeneric(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
*
* \param de pointer to DetectRfbSecresultData
*/
-void DetectRfbSecresultFree(void *de_ptr)
+void DetectRfbSecresultFree(DetectEngineCtx *de_ctx, void *de_ptr)
{
DetectRfbSecresultData *de = (DetectRfbSecresultData *)de_ptr;
if(de) SCFree(de);
DetectRfbSecresultData *de = NULL;
de = DetectRfbSecresultParse("fail");
if (de) {
- DetectRfbSecresultFree(de);
+ DetectRfbSecresultFree(NULL, de);
return 1;
}
DetectRfbSecresultData *de = NULL;
de = DetectRfbSecresultParse("invalidopt");
if (de) {
- DetectRfbSecresultFree(de);
+ DetectRfbSecresultFree(NULL, de);
return 0;
}
static DetectRfbSectypeData *DetectRfbSectypeParse (const char *);
static int DetectRfbSectypeSetup (DetectEngineCtx *, Signature *s, const char *str);
-static void DetectRfbSectypeFree(void *);
+static void DetectRfbSectypeFree(DetectEngineCtx *, void *);
static int g_rfb_sectype_buffer_id = 0;
static int DetectEngineInspectRfbSectypeGeneric(ThreadVars *tv,
return 0;
error:
- DetectRfbSectypeFree(dd);
+ DetectRfbSectypeFree(de_ctx, dd);
return -1;
}
*
* \param de_ptr Pointer to DetectRfbSectypeData.
*/
-static void DetectRfbSectypeFree(void *ptr)
+static void DetectRfbSectypeFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCFree(ptr);
}
const Signature *, const SigMatchCtx *);
static int DetectRpcSetup (DetectEngineCtx *, Signature *, const char *);
void DetectRpcRegisterTests(void);
-void DetectRpcFree(void *);
+void DetectRpcFree(DetectEngineCtx *, void *);
/**
* \brief Registration function for rpc keyword
/**
* \brief This function is used to parse rpc options passed via rpc keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param rpcstr Pointer to the user provided rpc options
*
* \retval rd pointer to DetectRpcData on success
* \retval NULL on failure
*/
-static DetectRpcData *DetectRpcParse (const char *rpcstr)
+static DetectRpcData *DetectRpcParse (DetectEngineCtx *de_ctx, const char *rpcstr)
{
DetectRpcData *rd = NULL;
char *args[3] = {NULL,NULL,NULL};
SCFree(args[i]);
}
if (rd != NULL)
- DetectRpcFree(rd);
+ DetectRpcFree(de_ctx, rd);
return NULL;
}
DetectRpcData *rd = NULL;
SigMatch *sm = NULL;
- rd = DetectRpcParse(rpcstr);
+ rd = DetectRpcParse(de_ctx, rpcstr);
if (rd == NULL) goto error;
sm = SigMatchAlloc();
return 0;
error:
- if (rd != NULL) DetectRpcFree(rd);
+ if (rd != NULL) DetectRpcFree(de_ctx, rd);
if (sm != NULL) SCFree(sm);
return -1;
*
* \param rd pointer to DetectRpcData
*/
-void DetectRpcFree(void *ptr)
+void DetectRpcFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCEnter();
{
int result = 0;
DetectRpcData *rd = NULL;
- rd = DetectRpcParse("123,444,555");
+ rd = DetectRpcParse(NULL, "123,444,555");
if (rd != NULL) {
- DetectRpcFree(rd);
+ DetectRpcFree(NULL, rd);
result = 1;
}
{
int result = 0;
DetectRpcData *rd = NULL;
- rd = DetectRpcParse("111,222,333");
+ rd = DetectRpcParse(NULL, "111,222,333");
if (rd != NULL) {
if (rd->flags & DETECT_RPC_CHECK_PROGRAM &&
rd->flags & DETECT_RPC_CHECK_VERSION &&
} else {
SCLogDebug("Error: Flags: %d; program: %u, version: %u, procedure: %u", rd->flags, rd->program, rd->program_version, rd->procedure);
}
- DetectRpcFree(rd);
+ DetectRpcFree(NULL, rd);
}
return result;
{
int result = 1;
DetectRpcData *rd = NULL;
- rd = DetectRpcParse("111,*,333");
+ rd = DetectRpcParse(NULL, "111,*,333");
if (rd == NULL)
return 0;
result = 0;
SCLogDebug("rd1 Flags: %d; program: %u, version: %u, procedure: %u", rd->flags, rd->program, rd->program_version, rd->procedure);
- DetectRpcFree(rd);
+ DetectRpcFree(NULL, rd);
- rd = DetectRpcParse("111,222,*");
+ rd = DetectRpcParse(NULL, "111,222,*");
if (rd == NULL)
return 0;
result = 0;
SCLogDebug("rd2 Flags: %d; program: %u, version: %u, procedure: %u", rd->flags, rd->program, rd->program_version, rd->procedure);
- DetectRpcFree(rd);
+ DetectRpcFree(NULL, rd);
- rd = DetectRpcParse("111,*,*");
+ rd = DetectRpcParse(NULL, "111,*,*");
if (rd == NULL)
return 0;
result = 0;
SCLogDebug("rd2 Flags: %d; program: %u, version: %u, procedure: %u", rd->flags, rd->program, rd->program_version, rd->procedure);
- DetectRpcFree(rd);
+ DetectRpcFree(NULL, rd);
- rd = DetectRpcParse("111,222");
+ rd = DetectRpcParse(NULL, "111,222");
if (rd == NULL)
return 0;
result = 0;
SCLogDebug("rd2 Flags: %d; program: %u, version: %u, procedure: %u", rd->flags, rd->program, rd->program_version, rd->procedure);
- DetectRpcFree(rd);
+ DetectRpcFree(NULL, rd);
- rd = DetectRpcParse("111");
+ rd = DetectRpcParse(NULL, "111");
if (rd == NULL)
return 0;
result = 0;
SCLogDebug("rd2 Flags: %d; program: %u, version: %u, procedure: %u", rd->flags, rd->program, rd->program_version, rd->procedure);
- DetectRpcFree(rd);
+ DetectRpcFree(NULL, rd);
return result;
}
{
int result = 0;
DetectRpcData *rd = NULL;
- rd = DetectRpcParse("");
+ rd = DetectRpcParse(NULL, "");
if (rd == NULL) {
result = 1;
} else {
SCLogDebug("Error: Flags: %d; program: %u, version: %u, procedure: %u", rd->flags, rd->program, rd->program_version, rd->procedure);
- DetectRpcFree(rd);
+ DetectRpcFree(NULL, rd);
}
return result;
{
int result = 0;
DetectRpcData *rd = NULL;
- rd = DetectRpcParse("111,aaa,*");
+ rd = DetectRpcParse(NULL, "111,aaa,*");
if (rd == NULL) {
result = 1;
} else {
SCLogDebug("Error: Flags: %d; program: %u, version: %u, procedure: %u", rd->flags, rd->program, rd->program_version, rd->procedure);
- DetectRpcFree(rd);
+ DetectRpcFree(NULL, rd);
}
return result;
static DetectSNMPPduTypeData *DetectSNMPPduTypeParse (const char *);
static int DetectSNMPPduTypeSetup (DetectEngineCtx *, Signature *s, const char *str);
-static void DetectSNMPPduTypeFree(void *);
+static void DetectSNMPPduTypeFree(DetectEngineCtx *, void *);
#ifdef UNITTESTS
static void DetectSNMPPduTypeRegisterTests(void);
#endif
return 0;
error:
- DetectSNMPPduTypeFree(dd);
+ DetectSNMPPduTypeFree(de_ctx, dd);
return -1;
}
*
* \param de_ptr Pointer to DetectSNMPPduTypeData.
*/
-static void DetectSNMPPduTypeFree(void *ptr)
+static void DetectSNMPPduTypeFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCFree(ptr);
}
static DetectSNMPVersionData *DetectSNMPVersionParse (const char *);
static int DetectSNMPVersionSetup (DetectEngineCtx *, Signature *s, const char *str);
-static void DetectSNMPVersionFree(void *);
+static void DetectSNMPVersionFree(DetectEngineCtx *, void *);
#ifdef UNITTESTS
static void DetectSNMPVersionRegisterTests(void);
#endif
return 0;
error:
- DetectSNMPVersionFree(dd);
+ DetectSNMPVersionFree(de_ctx, dd);
return -1;
}
*
* \param de_ptr Pointer to DetectSNMPVersionData.
*/
-static void DetectSNMPVersionFree(void *ptr)
+static void DetectSNMPVersionFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCFree(ptr);
}
const Signature *, const SigMatchCtx *);
static int DetectSshVersionSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectSshVersionRegisterTests(void);
-static void DetectSshVersionFree(void *);
+static void DetectSshVersionFree(DetectEngineCtx *, void *);
static int g_ssh_banner_list_id = 0;
/**
/**
* \brief This function is used to parse IPV4 ip_id passed via keyword: "id"
*
+ * \param de_ctx Pointer to the detection engine context
* \param idstr Pointer to the user provided id option
*
* \retval id_d pointer to DetectSshVersionData on success
* \retval NULL on failure
*/
-static DetectSshVersionData *DetectSshVersionParse (const char *str)
+static DetectSshVersionData *DetectSshVersionParse (DetectEngineCtx *de_ctx, const char *str)
{
DetectSshVersionData *ssh = NULL;
int ret = 0, res = 0;
error:
if (ssh != NULL)
- DetectSshVersionFree(ssh);
+ DetectSshVersionFree(de_ctx, ssh);
return NULL;
}
if (DetectSignatureSetAppProto(s, ALPROTO_SSH) != 0)
return -1;
- ssh = DetectSshVersionParse(str);
+ ssh = DetectSshVersionParse(de_ctx, str);
if (ssh == NULL)
goto error;
error:
if (ssh != NULL)
- DetectSshVersionFree(ssh);
+ DetectSshVersionFree(de_ctx, ssh);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param id_d pointer to DetectSshVersionData
*/
-void DetectSshVersionFree(void *ptr)
+void DetectSshVersionFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectSshVersionData *sshd = (DetectSshVersionData *)ptr;
SCFree(sshd->ver);
static int DetectSshVersionTestParse01 (void)
{
DetectSshVersionData *ssh = NULL;
- ssh = DetectSshVersionParse("1.0");
+ ssh = DetectSshVersionParse(NULL, "1.0");
if (ssh != NULL && strncmp((char *) ssh->ver, "1.0", 3) == 0) {
- DetectSshVersionFree(ssh);
+ DetectSshVersionFree(NULL, ssh);
return 1;
}
static int DetectSshVersionTestParse02 (void)
{
DetectSshVersionData *ssh = NULL;
- ssh = DetectSshVersionParse("2_compat");
+ ssh = DetectSshVersionParse(NULL, "2_compat");
if (ssh->flags & SSH_FLAG_PROTOVERSION_2_COMPAT) {
- DetectSshVersionFree(ssh);
+ DetectSshVersionFree(NULL, ssh);
return 1;
}
static int DetectSshVersionTestParse03 (void)
{
DetectSshVersionData *ssh = NULL;
- ssh = DetectSshVersionParse("2_com");
+ ssh = DetectSshVersionParse(NULL, "2_com");
if (ssh != NULL) {
- DetectSshVersionFree(ssh);
+ DetectSshVersionFree(NULL, ssh);
return 0;
}
- ssh = DetectSshVersionParse("");
+ ssh = DetectSshVersionParse(NULL, "");
if (ssh != NULL) {
- DetectSshVersionFree(ssh);
+ DetectSshVersionFree(NULL, ssh);
return 0;
}
- ssh = DetectSshVersionParse(".1");
+ ssh = DetectSshVersionParse(NULL, ".1");
if (ssh != NULL) {
- DetectSshVersionFree(ssh);
+ DetectSshVersionFree(NULL, ssh);
return 0;
}
- ssh = DetectSshVersionParse("lalala");
+ ssh = DetectSshVersionParse(NULL, "lalala");
if (ssh != NULL) {
- DetectSshVersionFree(ssh);
+ DetectSshVersionFree(NULL, ssh);
return 0;
}
const Signature *, const SigMatchCtx *);
static int DetectSshSoftwareVersionSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectSshSoftwareVersionRegisterTests(void);
-static void DetectSshSoftwareVersionFree(void *);
+static void DetectSshSoftwareVersionFree(DetectEngineCtx *de_ctx, void *);
static int g_ssh_banner_list_id = 0;
static int InspectSshBanner(ThreadVars *tv,
/**
* \brief This function is used to parse IPV4 ip_id passed via keyword: "id"
*
+ * \param de_ctx Pointer to the detection engine context
* \param idstr Pointer to the user provided id option
*
* \retval id_d pointer to DetectSshSoftwareVersionData on success
* \retval NULL on failure
*/
-static DetectSshSoftwareVersionData *DetectSshSoftwareVersionParse (const char *str)
+static DetectSshSoftwareVersionData *DetectSshSoftwareVersionParse (DetectEngineCtx *de_ctx, const char *str)
{
DetectSshSoftwareVersionData *ssh = NULL;
int ret = 0, res = 0;
error:
if (ssh != NULL)
- DetectSshSoftwareVersionFree(ssh);
+ DetectSshSoftwareVersionFree(de_ctx, ssh);
return NULL;
}
if (DetectSignatureSetAppProto(s, ALPROTO_SSH) != 0)
return -1;
- ssh = DetectSshSoftwareVersionParse(str);
+ ssh = DetectSshSoftwareVersionParse(NULL, str);
if (ssh == NULL)
goto error;
error:
if (ssh != NULL)
- DetectSshSoftwareVersionFree(ssh);
+ DetectSshSoftwareVersionFree(de_ctx, ssh);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param id_d pointer to DetectSshSoftwareVersionData
*/
-static void DetectSshSoftwareVersionFree(void *ptr)
+static void DetectSshSoftwareVersionFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr == NULL)
return;
static int DetectSshSoftwareVersionTestParse01 (void)
{
DetectSshSoftwareVersionData *ssh = NULL;
- ssh = DetectSshSoftwareVersionParse("PuTTY_1.0");
+ ssh = DetectSshSoftwareVersionParse(NULL, "PuTTY_1.0");
if (ssh != NULL && strncmp((char *) ssh->software_ver, "PuTTY_1.0", 9) == 0) {
- DetectSshSoftwareVersionFree(ssh);
+ DetectSshSoftwareVersionFree(NULL, ssh);
return 1;
}
static int DetectSshSoftwareVersionTestParse02 (void)
{
DetectSshSoftwareVersionData *ssh = NULL;
- ssh = DetectSshSoftwareVersionParse("\"SecureCRT-4.0\"");
+ ssh = DetectSshSoftwareVersionParse(NULL, "\"SecureCRT-4.0\"");
if (ssh != NULL && strncmp((char *) ssh->software_ver, "SecureCRT-4.0", 13) == 0) {
- DetectSshSoftwareVersionFree(ssh);
+ DetectSshSoftwareVersionFree(NULL, ssh);
return 1;
}
static int DetectSshSoftwareVersionTestParse03 (void)
{
DetectSshSoftwareVersionData *ssh = NULL;
- ssh = DetectSshSoftwareVersionParse("");
+ ssh = DetectSshSoftwareVersionParse(NULL, "");
if (ssh != NULL) {
- DetectSshSoftwareVersionFree(ssh);
+ DetectSshSoftwareVersionFree(NULL, ssh);
return 0;
}
#ifdef UNITTESTS
static void DetectSslStateRegisterTests(void);
#endif
-static void DetectSslStateFree(void *);
+static void DetectSslStateFree(DetectEngineCtx *, void *);
static int InspectTlsGeneric(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
error:
if (ssd != NULL)
- DetectSslStateFree(ssd);
+ DetectSslStateFree(de_ctx, ssd);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param ptr pointer to the data to be freed.
*/
-static void DetectSslStateFree(void *ptr)
+static void DetectSslStateFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr != NULL)
SCFree(ptr);
#ifdef UNITTESTS
static void DetectSslVersionRegisterTests(void);
#endif
-static void DetectSslVersionFree(void *);
+static void DetectSslVersionFree(DetectEngineCtx *, void *);
static int g_tls_generic_list_id = 0;
/**
* \brief This function is used to parse ssl_version data passed via
* keyword: "ssl_version"
*
+ * \param de_ctx Pointer to the detection engine context
* \param str Pointer to the user provided options
*
* \retval ssl pointer to DetectSslVersionData on success
* \retval NULL on failure
*/
-static DetectSslVersionData *DetectSslVersionParse(const char *str)
+static DetectSslVersionData *DetectSslVersionParse(DetectEngineCtx *de_ctx, const char *str)
{
DetectSslVersionData *ssl = NULL;
int ret = 0, res = 0;
error:
if (ssl != NULL)
- DetectSslVersionFree(ssl);
+ DetectSslVersionFree(de_ctx, ssl);
return NULL;
}
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) != 0)
return -1;
- ssl = DetectSslVersionParse(str);
+ ssl = DetectSslVersionParse(de_ctx, str);
if (ssl == NULL)
goto error;
error:
if (ssl != NULL)
- DetectSslVersionFree(ssl);
+ DetectSslVersionFree(de_ctx, ssl);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param id_d pointer to DetectSslVersionData
*/
-void DetectSslVersionFree(void *ptr)
+void DetectSslVersionFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr != NULL)
SCFree(ptr);
static int DetectStreamSizeMatch (DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectStreamSizeSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectStreamSizeFree(void *);
+void DetectStreamSizeFree(DetectEngineCtx *de_ctx, void *);
void DetectStreamSizeRegisterTests(void);
/**
/**
* \brief This function is used to parse stream options passed via stream_size: keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param streamstr Pointer to the user provided stream_size options
*
* \retval sd pointer to DetectStreamSizeData on success
* \retval NULL on failure
*/
-static DetectStreamSizeData *DetectStreamSizeParse (const char *streamstr)
+static DetectStreamSizeData *DetectStreamSizeParse (DetectEngineCtx *de_ctx, const char *streamstr)
{
DetectStreamSizeData *sd = NULL;
if (value != NULL)
SCFree(value);
if (sd != NULL)
- DetectStreamSizeFree(sd);
+ DetectStreamSizeFree(de_ctx, sd);
return NULL;
}
DetectStreamSizeData *sd = NULL;
SigMatch *sm = NULL;
- sd = DetectStreamSizeParse(streamstr);
+ sd = DetectStreamSizeParse(de_ctx, streamstr);
if (sd == NULL)
goto error;
return 0;
error:
- if (sd != NULL) DetectStreamSizeFree(sd);
+ if (sd != NULL) DetectStreamSizeFree(de_ctx, sd);
if (sm != NULL) SCFree(sm);
return -1;
}
*
* \param ptr pointer to DetectStreamSizeData
*/
-void DetectStreamSizeFree(void *ptr)
+void DetectStreamSizeFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectStreamSizeData *sd = (DetectStreamSizeData *)ptr;
SCFree(sd);
{
int result = 0;
DetectStreamSizeData *sd = NULL;
- sd = DetectStreamSizeParse("server,<,6");
+ sd = DetectStreamSizeParse(NULL, "server,<,6");
if (sd != NULL) {
if (sd->flags & STREAM_SIZE_SERVER && sd->mode == DETECTSSIZE_LT && sd->ssize == 6)
result = 1;
- DetectStreamSizeFree(sd);
+ DetectStreamSizeFree(NULL, sd);
}
return result;
{
int result = 1;
DetectStreamSizeData *sd = NULL;
- sd = DetectStreamSizeParse("invalidoption,<,6");
+ sd = DetectStreamSizeParse(NULL, "invalidoption,<,6");
if (sd != NULL) {
printf("expected: NULL got 0x%02X %" PRIu32 ": ",sd->flags, sd->ssize);
result = 0;
- DetectStreamSizeFree(sd);
+ DetectStreamSizeFree(NULL, sd);
}
return result;
memset(&f, 0, sizeof(Flow));
memset(&tcph, 0, sizeof(TCPHdr));
- sd = DetectStreamSizeParse("client,>,8");
+ sd = DetectStreamSizeParse(NULL, "client,>,8");
if (sd != NULL) {
if (!(sd->flags & STREAM_SIZE_CLIENT)) {
printf("sd->flags not STREAM_SIZE_CLIENT: ");
- DetectStreamSizeFree(sd);
+ DetectStreamSizeFree(NULL, sd);
SCFree(p);
return 0;
}
if (sd->mode != DETECTSSIZE_GT) {
printf("sd->mode not DETECTSSIZE_GT: ");
- DetectStreamSizeFree(sd);
+ DetectStreamSizeFree(NULL, sd);
SCFree(p);
return 0;
}
if (sd->ssize != 8) {
printf("sd->ssize is %"PRIu32", not 8: ", sd->ssize);
- DetectStreamSizeFree(sd);
+ DetectStreamSizeFree(NULL, sd);
SCFree(p);
return 0;
}
if (result == 0) {
printf("result 0 != 1: ");
}
- DetectStreamSizeFree(sd);
+ DetectStreamSizeFree(NULL, sd);
SCFree(p);
return result;
}
memset(&f, 0, sizeof(Flow));
memset(&ip4h, 0, sizeof(IPV4Hdr));
- sd = DetectStreamSizeParse(" client , > , 8 ");
+ sd = DetectStreamSizeParse(NULL, " client , > , 8 ");
if (sd != NULL) {
if (!(sd->flags & STREAM_SIZE_CLIENT) && sd->mode != DETECTSSIZE_GT && sd->ssize != 8) {
SCFree(p);
const Signature *, const SigMatchCtx *);
static int DetectTagSetup(DetectEngineCtx *, Signature *, const char *);
void DetectTagRegisterTests(void);
-void DetectTagDataFree(void *);
+void DetectTagDataFree(DetectEngineCtx *, void *);
/**
* \brief Registration function for keyword tag
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectTagDataFree(td);
+ DetectTagDataFree(de_ctx, td);
return -1;
}
*
* \param td pointer to DetectTagData
*/
-void DetectTagDataFree(void *ptr)
+void DetectTagDataFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectTagData *td = (DetectTagData *)ptr;
SCFree(td);
if (td != NULL && td->type == DETECT_TAG_TYPE_SESSION
&& td->count == 123
&& td->metric == DETECT_TAG_METRIC_PACKET) {
- DetectTagDataFree(td);
+ DetectTagDataFree(NULL, td);
result = 1;
}
&& td->metric == DETECT_TAG_METRIC_BYTES
&& td->direction == DETECT_TAG_DIR_SRC) {
result = 1;
- DetectTagDataFree(td);
+ DetectTagDataFree(NULL, td);
}
return result;
&& td->metric == DETECT_TAG_METRIC_BYTES
&& td->direction == DETECT_TAG_DIR_DST) {
result = 1;
- DetectTagDataFree(td);
+ DetectTagDataFree(NULL, td);
}
return result;
&& td->count == DETECT_TAG_MAX_PKTS
&& td->metric == DETECT_TAG_METRIC_PACKET) {
result = 1;
- DetectTagDataFree(td);
+ DetectTagDataFree(NULL, td);
}
return result;
&& td->metric == DETECT_TAG_METRIC_PACKET
&& td->direction == DETECT_TAG_DIR_DST) {
result = 1;
- DetectTagDataFree(td);
+ DetectTagDataFree(NULL, td);
}
return result;
#define TAG_ENTRY_FLAG_SKIPPED_FIRST 0x04
/* prototypes */
+struct DetectEngineCtx_ ;
void DetectTagRegister(void);
-void DetectTagDataFree(void *ptr);
+void DetectTagDataFree(struct DetectEngineCtx_ *, void *ptr);
void DetectTagDataListFree(void *ptr);
#endif /* __DETECT_TAG_H__ */
static int DetectAckMatch(DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static void DetectAckRegisterTests(void);
-static void DetectAckFree(void *);
+static void DetectAckFree(DetectEngineCtx *, void *);
static int PrefilterSetupTcpAck(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterTcpAckIsPrefilterable(const Signature *s);
if (data)
SCFree(data);
if (sm)
- SigMatchFree(sm);
+ SigMatchFree(de_ctx, sm);
return -1;
}
*
* \param data pointer to ack configuration data
*/
-static void DetectAckFree(void *ptr)
+static void DetectAckFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectAckData *data = (DetectAckData *)ptr;
SCFree(data);
static int DetectFlagsMatch (DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectFlagsSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectFlagsFree(void *);
+static void DetectFlagsFree(DetectEngineCtx *, void *);
static bool PrefilterTcpFlagsIsPrefilterable(const Signature *s);
static int PrefilterSetupTcpFlags(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
*
* \param de pointer to DetectFlagsData
*/
-static void DetectFlagsFree(void *de_ptr)
+static void DetectFlagsFree(DetectEngineCtx *de_ctx, void *de_ptr)
{
DetectFlagsData *de = (DetectFlagsData *)de_ptr;
if(de) SCFree(de);
DetectFlagsData *de = DetectFlagsParse("S");
FAIL_IF_NULL(de);
FAIL_IF_NOT(de->flags == TH_SYN);
- DetectFlagsFree(de);
+ DetectFlagsFree(NULL, de);
PASS;
}
DetectFlagsData *de = NULL;
de = DetectFlagsParse("G");
if (de) {
- DetectFlagsFree(de);
+ DetectFlagsFree(NULL, de);
return 0;
}
DetectFlagsData *de = NULL;
de = DetectFlagsParse("+S*");
if (de != NULL) {
- DetectFlagsFree(de);
+ DetectFlagsFree(NULL, de);
return 0;
}
{
DetectFlagsData *de = DetectFlagsParse("CE");
if (de != NULL && (de->flags == (TH_CWR | TH_ECN)) ) {
- DetectFlagsFree(de);
+ DetectFlagsFree(NULL, de);
return 1;
}
static int DetectSeqMatch(DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static void DetectSeqRegisterTests(void);
-static void DetectSeqFree(void *);
+static void DetectSeqFree(DetectEngineCtx *, void *);
static int PrefilterSetupTcpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static bool PrefilterTcpSeqIsPrefilterable(const Signature *s);
if (data)
SCFree(data);
if (sm)
- SigMatchFree(sm);
+ SigMatchFree(de_ctx, sm);
return -1;
}
*
* \param data pointer to seq configuration data
*/
-static void DetectSeqFree(void *ptr)
+static void DetectSeqFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectSeqData *data = (DetectSeqData *)ptr;
SCFree(data);
const Signature *, const SigMatchCtx *);
static int DetectWindowSetup(DetectEngineCtx *, Signature *, const char *);
void DetectWindowRegisterTests(void);
-void DetectWindowFree(void *);
+void DetectWindowFree(DetectEngineCtx *, void *);
/**
* \brief Registration function for window: keyword
/**
* \brief This function is used to parse window options passed via window: keyword
*
+ * \param de_ctx Pointer to the detection engine context
* \param windowstr Pointer to the user provided window options (negation! and size)
*
* \retval wd pointer to DetectWindowData on success
* \retval NULL on failure
*/
-static DetectWindowData *DetectWindowParse(const char *windowstr)
+static DetectWindowData *DetectWindowParse(DetectEngineCtx *de_ctx, const char *windowstr)
{
DetectWindowData *wd = NULL;
int ret = 0, res = 0;
error:
if (wd != NULL)
- DetectWindowFree(wd);
+ DetectWindowFree(de_ctx, wd);
return NULL;
}
DetectWindowData *wd = NULL;
SigMatch *sm = NULL;
- wd = DetectWindowParse(windowstr);
+ wd = DetectWindowParse(de_ctx, windowstr);
if (wd == NULL) goto error;
/* Okay so far so good, lets get this into a SigMatch
return 0;
error:
- if (wd != NULL) DetectWindowFree(wd);
+ if (wd != NULL) DetectWindowFree(de_ctx, wd);
if (sm != NULL) SCFree(sm);
return -1;
*
* \param wd pointer to DetectWindowData
*/
-void DetectWindowFree(void *ptr)
+void DetectWindowFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectWindowData *wd = (DetectWindowData *)ptr;
SCFree(wd);
{
int result = 0;
DetectWindowData *wd = NULL;
- wd = DetectWindowParse("35402");
+ wd = DetectWindowParse(NULL, "35402");
if (wd != NULL &&wd->size==35402) {
- DetectWindowFree(wd);
+ DetectWindowFree(NULL, wd);
result = 1;
}
{
int result = 0;
DetectWindowData *wd = NULL;
- wd = DetectWindowParse("!35402");
+ wd = DetectWindowParse(NULL, "!35402");
if (wd != NULL) {
if (wd->negated == 1 && wd->size==35402) {
result = 1;
} else {
printf("expected wd->negated=1 and wd->size=35402\n");
}
- DetectWindowFree(wd);
+ DetectWindowFree(NULL, wd);
}
return result;
{
int result = 0;
DetectWindowData *wd = NULL;
- wd = DetectWindowParse("");
+ wd = DetectWindowParse(NULL, "");
if (wd == NULL) {
result = 1;
} else {
printf("expected a NULL pointer (It was an empty string)\n");
}
- DetectWindowFree(wd);
+ DetectWindowFree(NULL, wd);
return result;
}
{
int result = 0;
DetectWindowData *wd = NULL;
- wd = DetectWindowParse("1235402");
+ wd = DetectWindowParse(NULL, "1235402");
if (wd != NULL) {
printf("expected a NULL pointer (It was exceeding the MAX window size)\n");
- DetectWindowFree(wd);
+ DetectWindowFree(NULL, wd);
}else
result=1;
static int DetectTcpmssMatch (DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectTcpmssSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectTcpmssFree (void *);
+void DetectTcpmssFree (DetectEngineCtx *, void *);
#ifdef UNITTESTS
void DetectTcpmssRegisterTests (void);
#endif
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectTcpmssFree(tcpmssd);
+ DetectTcpmssFree(de_ctx, tcpmssd);
return -1;
}
*
* \param ptr pointer to DetectTcpmssData
*/
-void DetectTcpmssFree(void *ptr)
+void DetectTcpmssFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectTcpmssData *tcpmssd = (DetectTcpmssData *)ptr;
SCFree(tcpmssd);
static int DetectTemplateMatch (DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static int DetectTemplateSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectTemplateFree (void *);
+static void DetectTemplateFree (DetectEngineCtx *, void *);
#ifdef UNITTESTS
static void DetectTemplateRegisterTests (void);
#endif
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectTemplateFree(templated);
+ DetectTemplateFree(de_ctx, templated);
return -1;
}
*
* \param ptr pointer to DetectTemplateData
*/
-static void DetectTemplateFree(void *ptr)
+static void DetectTemplateFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectTemplateData *templated = (DetectTemplateData *)ptr;
static int DetectTemplate2Match (DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectTemplate2Setup (DetectEngineCtx *, Signature *, const char *);
-void DetectTemplate2Free (void *);
+void DetectTemplate2Free (DetectEngineCtx *, void *);
#ifdef UNITTESTS
void DetectTemplate2RegisterTests (void);
#endif
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectTemplate2Free(template2d);
+ DetectTemplate2Free(de_ctx, template2d);
return -1;
}
*
* \param ptr pointer to DetectTemplate2Data
*/
-void DetectTemplate2Free(void *ptr)
+void DetectTemplate2Free(DetectEngineCtx *de_ctx, void *ptr)
{
DetectTemplate2Data *template2d = (DetectTemplate2Data *)ptr;
SCFree(template2d);
static int DetectThresholdMatch(DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectThresholdSetup(DetectEngineCtx *, Signature *, const char *);
-static void DetectThresholdFree(void *);
+static void DetectThresholdFree(DetectEngineCtx *, void *);
/**
* \brief Registration function for threshold: keyword
*
* \param de pointer to DetectThresholdData
*/
-static void DetectThresholdFree(void *de_ptr)
+static void DetectThresholdFree(DetectEngineCtx *de_ctx, void *de_ptr)
{
DetectThresholdData *de = (DetectThresholdData *)de_ptr;
if (de) {
DetectThresholdData *de = NULL;
de = DetectThresholdParse("type limit,track by_dst,count 10,seconds 60");
if (de && (de->type == TYPE_LIMIT) && (de->track == TRACK_DST) && (de->count == 10) && (de->seconds == 60)) {
- DetectThresholdFree(de);
+ DetectThresholdFree(NULL, de);
return 1;
}
DetectThresholdData *de = NULL;
de = DetectThresholdParse("type any,track by_dst,count 10,seconds 60");
if (de && (de->type == TYPE_LIMIT) && (de->track == TRACK_DST) && (de->count == 10) && (de->seconds == 60)) {
- DetectThresholdFree(de);
+ DetectThresholdFree(NULL, de);
return 0;
}
DetectThresholdData *de = NULL;
de = DetectThresholdParse("track by_dst, type limit, seconds 60, count 10");
if (de && (de->type == TYPE_LIMIT) && (de->track == TRACK_DST) && (de->count == 10) && (de->seconds == 60)) {
- DetectThresholdFree(de);
+ DetectThresholdFree(NULL, de);
return 1;
}
DetectThresholdData *de = NULL;
de = DetectThresholdParse("count 10, track by_dst, seconds 60, type both, count 10");
if (de && (de->type == TYPE_BOTH) && (de->track == TRACK_DST) && (de->count == 10) && (de->seconds == 60)) {
- DetectThresholdFree(de);
+ DetectThresholdFree(NULL, de);
return 0;
}
DetectThresholdData *de = NULL;
de = DetectThresholdParse("count 10, track by_dst, seconds 60, type both");
if (de && (de->type == TYPE_BOTH) && (de->track == TRACK_DST) && (de->count == 10) && (de->seconds == 60)) {
- DetectThresholdFree(de);
+ DetectThresholdFree(NULL, de);
return 1;
}
FAIL_IF_NOT(de->track == TRACK_BOTH);
FAIL_IF_NOT(de->count == 10);
FAIL_IF_NOT(de->seconds == 60);
- DetectThresholdFree(de);
+ DetectThresholdFree(NULL, de);
PASS;
}
FAIL_IF_NOT(de->track == TRACK_RULE);
FAIL_IF_NOT(de->count == 10);
FAIL_IF_NOT(de->seconds == 60);
- DetectThresholdFree(de);
+ DetectThresholdFree(NULL, de);
PASS;
}
static void TlsExpiredRegisterTests(void);
static void TlsValidRegisterTests(void);
#endif /* UNITTESTS */
-static void DetectTlsValidityFree(void *);
+static void DetectTlsValidityFree(DetectEngineCtx *, void *);
static int g_tls_validity_buffer_id = 0;
static int DetectEngineInspectTlsValidity(ThreadVars *tv,
return 0;
error:
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(de_ctx, dd);
if (sm)
SCFree(sm);
return -1;
return 0;
error:
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(de_ctx, dd);
if (sm)
SCFree(sm);
return -1;
return 0;
error:
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(de_ctx, dd);
if (sm)
SCFree(sm);
return -1;
*
* \param de_ptr Pointer to DetectTlsValidityData.
*/
-void DetectTlsValidityFree(void *de_ptr)
+void DetectTlsValidityFree(DetectEngineCtx *de_ctx, void *de_ptr)
{
DetectTlsValidityData *dd = (DetectTlsValidityData *)de_ptr;
if (dd)
#ifdef UNITTESTS
static void DetectTlsVersionRegisterTests(void);
#endif
-static void DetectTlsVersionFree(void *);
+static void DetectTlsVersionFree(DetectEngineCtx *, void *);
static int g_tls_generic_list_id = 0;
/**
/**
* \brief This function is used to parse IPV4 ip_id passed via keyword: "id"
*
+ * \param de_ctx Pointer to the detection engine context
* \param idstr Pointer to the user provided id option
*
* \retval id_d pointer to DetectTlsVersionData on success
* \retval NULL on failure
*/
-static DetectTlsVersionData *DetectTlsVersionParse (const char *str)
+static DetectTlsVersionData *DetectTlsVersionParse (DetectEngineCtx *de_ctx, const char *str)
{
uint16_t temp;
DetectTlsVersionData *tls = NULL;
error:
if (tls != NULL)
- DetectTlsVersionFree(tls);
+ DetectTlsVersionFree(de_ctx, tls);
return NULL;
}
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) != 0)
return -1;
- tls = DetectTlsVersionParse(str);
+ tls = DetectTlsVersionParse(de_ctx, str);
if (tls == NULL)
goto error;
error:
if (tls != NULL)
- DetectTlsVersionFree(tls);
+ DetectTlsVersionFree(de_ctx, tls);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param id_d pointer to DetectTlsVersionData
*/
-static void DetectTlsVersionFree(void *ptr)
+static void DetectTlsVersionFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectTlsVersionData *id_d = (DetectTlsVersionData *)ptr;
SCFree(id_d);
const Signature *, const SigMatchCtx *);
static int DetectTlsSubjectSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectTlsSubjectRegisterTests(void);
-static void DetectTlsSubjectFree(void *);
+static void DetectTlsSubjectFree(DetectEngineCtx *, void *);
static int DetectTlsIssuerDNMatch (DetectEngineThreadCtx *,
Flow *, uint8_t, void *, void *,
const Signature *, const SigMatchCtx *);
static int DetectTlsIssuerDNSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectTlsIssuerDNRegisterTests(void);
-static void DetectTlsIssuerDNFree(void *);
+static void DetectTlsIssuerDNFree(DetectEngineCtx *, void *);
static int DetectTlsFingerprintMatch (DetectEngineThreadCtx *,
Flow *, uint8_t, void *, void *,
const Signature *, const SigMatchCtx *);
static int DetectTlsFingerprintSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectTlsFingerprintFree(void *);
+static void DetectTlsFingerprintFree(DetectEngineCtx *, void *);
static int DetectTlsStoreSetup (DetectEngineCtx *, Signature *, const char *);
static int DetectTlsStorePostMatch (DetectEngineThreadCtx *det_ctx,
/**
* \brief This function is used to parse IPV4 ip_id passed via keyword: "id"
*
- * \param idstr Pointer to the user provided id option
+ * \param de_ctx Pointer to the detection engine context
+ * \param str Pointer to the user provided id option
*
* \retval id_d pointer to DetectTlsData on success
* \retval NULL on failure
*/
-static DetectTlsData *DetectTlsSubjectParse (const char *str, bool negate)
+static DetectTlsData *DetectTlsSubjectParse (DetectEngineCtx *de_ctx, const char *str, bool negate)
{
DetectTlsData *tls = NULL;
int ret = 0, res = 0;
if (orig != NULL)
SCFree(orig);
if (tls != NULL)
- DetectTlsSubjectFree(tls);
+ DetectTlsSubjectFree(de_ctx, tls);
return NULL;
}
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) != 0)
return -1;
- tls = DetectTlsSubjectParse(str, s->init_data->negated);
+ tls = DetectTlsSubjectParse(de_ctx, str, s->init_data->negated);
if (tls == NULL)
goto error;
error:
if (tls != NULL)
- DetectTlsSubjectFree(tls);
+ DetectTlsSubjectFree(de_ctx, tls);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param id_d pointer to DetectTlsData
*/
-static void DetectTlsSubjectFree(void *ptr)
+static void DetectTlsSubjectFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectTlsData *id_d = (DetectTlsData *)ptr;
if (ptr == NULL)
/**
* \brief This function is used to parse IPV4 ip_id passed via keyword: "id"
*
- * \param idstr Pointer to the user provided id option
+ * \param de_ctx Pointer to the detection engine context
+ * \param str Pointer to the user provided id option
*
* \retval id_d pointer to DetectTlsData on success
* \retval NULL on failure
*/
-static DetectTlsData *DetectTlsIssuerDNParse(const char *str, bool negate)
+static DetectTlsData *DetectTlsIssuerDNParse(DetectEngineCtx *de_ctx, const char *str, bool negate)
{
DetectTlsData *tls = NULL;
int ret = 0, res = 0;
if (orig != NULL)
SCFree(orig);
if (tls != NULL)
- DetectTlsIssuerDNFree(tls);
+ DetectTlsIssuerDNFree(de_ctx, tls);
return NULL;
}
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) != 0)
return -1;
- tls = DetectTlsIssuerDNParse(str, s->init_data->negated);
+ tls = DetectTlsIssuerDNParse(de_ctx, str, s->init_data->negated);
if (tls == NULL)
goto error;
error:
if (tls != NULL)
- DetectTlsIssuerDNFree(tls);
+ DetectTlsIssuerDNFree(de_ctx, tls);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param id_d pointer to DetectTlsData
*/
-static void DetectTlsIssuerDNFree(void *ptr)
+static void DetectTlsIssuerDNFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectTlsData *id_d = (DetectTlsData *)ptr;
SCFree(id_d->issuerdn);
/**
* \brief This function is used to parse fingerprint passed via keyword: "fingerprint"
*
- * \param idstr Pointer to the user provided fingerprint option
+ * \param de_ctx Pointer to the detection engine context
+ * \param str Pointer to the user provided fingerprint option
*
* \retval pointer to DetectTlsData on success
* \retval NULL on failure
*/
-static DetectTlsData *DetectTlsFingerprintParse (const char *str, bool negate)
+static DetectTlsData *DetectTlsFingerprintParse (DetectEngineCtx *de_ctx, const char *str, bool negate)
{
DetectTlsData *tls = NULL;
int ret = 0, res = 0;
error:
if (tls != NULL)
- DetectTlsFingerprintFree(tls);
+ DetectTlsFingerprintFree(de_ctx, tls);
return NULL;
}
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) != 0)
return -1;
- tls = DetectTlsFingerprintParse(str, s->init_data->negated);
+ tls = DetectTlsFingerprintParse(de_ctx, str, s->init_data->negated);
if (tls == NULL)
goto error;
error:
if (tls != NULL)
- DetectTlsFingerprintFree(tls);
+ DetectTlsFingerprintFree(de_ctx, tls);
if (sm != NULL)
SCFree(sm);
return -1;
*
* \param pointer to DetectTlsData
*/
-static void DetectTlsFingerprintFree(void *ptr)
+static void DetectTlsFingerprintFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectTlsData *id_d = (DetectTlsData *)ptr;
if (id_d->fingerprint)
static int DetectTosMatch(DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static void DetectTosRegisterTests(void);
-static void DetectTosFree(void *);
+static void DetectTosFree(DetectEngineCtx *, void *);
#define DETECT_IPTOS_MIN 0
#define DETECT_IPTOS_MAX 255
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectTosFree(tosd);
+ DetectTosFree(de_ctx, tosd);
return -1;
}
*
* \param tosd Data to be freed.
*/
-static void DetectTosFree(void *tosd)
+static void DetectTosFree(DetectEngineCtx *de_ctx, void *tosd)
{
SCFree(tosd);
}
DetectTosData *tosd = NULL;
tosd = DetectTosParse("12", false);
if (tosd != NULL && tosd->tos == 12 && !tosd->negated) {
- DetectTosFree(tosd);
+ DetectTosFree(NULL, tosd);
return 1;
}
DetectTosData *tosd = NULL;
tosd = DetectTosParse("123", false);
if (tosd != NULL && tosd->tos == 123 && !tosd->negated) {
- DetectTosFree(tosd);
+ DetectTosFree(NULL, tosd);
return 1;
}
DetectTosData *tosd = NULL;
tosd = DetectTosParse("256", false);
if (tosd != NULL) {
- DetectTosFree(tosd);
+ DetectTosFree(NULL, tosd);
return 0;
}
DetectTosData *tosd = NULL;
tosd = DetectTosParse("boom", false);
if (tosd != NULL) {
- DetectTosFree(tosd);
+ DetectTosFree(NULL, tosd);
return 0;
}
DetectTosData *tosd = NULL;
tosd = DetectTosParse("x12", false);
if (tosd != NULL && tosd->tos == 0x12 && !tosd->negated) {
- DetectTosFree(tosd);
+ DetectTosFree(NULL, tosd);
return 1;
}
DetectTosData *tosd = NULL;
tosd = DetectTosParse("X12", false);
if (tosd != NULL && tosd->tos == 0x12 && !tosd->negated) {
- DetectTosFree(tosd);
+ DetectTosFree(NULL, tosd);
return 1;
}
DetectTosData *tosd = NULL;
tosd = DetectTosParse("x121", false);
if (tosd != NULL) {
- DetectTosFree(tosd);
+ DetectTosFree(NULL, tosd);
return 0;
}
DetectTosData *tosd = NULL;
tosd = DetectTosParse("12", true);
if (tosd != NULL && tosd->tos == 12 && tosd->negated) {
- DetectTosFree(tosd);
+ DetectTosFree(NULL, tosd);
return 1;
}
DetectTosData *tosd = NULL;
tosd = DetectTosParse("x12", true);
if (tosd != NULL && tosd->tos == 0x12 && tosd->negated) {
- DetectTosFree(tosd);
+ DetectTosFree(NULL, tosd);
return 1;
}
static int DetectTtlMatch (DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectTtlSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectTtlFree (void *);
+void DetectTtlFree (DetectEngineCtx *, void *);
#ifdef UNITTESTS
void DetectTtlRegisterTests (void);
#endif
SigMatch *sm = SigMatchAlloc();
if (sm == NULL) {
- DetectTtlFree(ttld);
+ DetectTtlFree(de_ctx, ttld);
return -1;
}
*
* \param ptr pointer to DetectTtlData
*/
-void DetectTtlFree(void *ptr)
+void DetectTtlFree(DetectEngineCtx *de_ctx, void *ptr)
{
DetectTtlData *ttld = (DetectTtlData *)ptr;
SCFree(ttld);
/* prototypes */
static int DetectUricontentSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectUricontentRegisterTests(void);
-static void DetectUricontentFree(void *);
+static void DetectUricontentFree(DetectEngineCtx *de_ctx, void *);
static int g_http_uri_buffer_id = 0;
*
* \param cd pointer to DetectUricotentData
*/
-void DetectUricontentFree(void *ptr)
+void DetectUricontentFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCEnter();
DetectContentData *cd = (DetectContentData *)ptr;
/*prototypes*/
static int DetectUrilenSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectUrilenFree (void *);
+void DetectUrilenFree (DetectEngineCtx *, void *);
void DetectUrilenRegisterTests (void);
static int g_http_uri_buffer_id = 0;
SCReturnInt(0);
error:
- DetectUrilenFree(urilend);
+ DetectUrilenFree(de_ctx, urilend);
SCReturnInt(-1);
}
*
* \param ptr pointer to DetectUrilenData
*/
-void DetectUrilenFree(void *ptr)
+void DetectUrilenFree(DetectEngineCtx *de_ctx, void *ptr)
{
if (ptr == NULL)
return;
!urilend->raw_buffer)
ret = 1;
- DetectUrilenFree(urilend);
+ DetectUrilenFree(NULL, urilend);
}
return ret;
}
!urilend->raw_buffer)
ret = 1;
- DetectUrilenFree(urilend);
+ DetectUrilenFree(NULL, urilend);
}
return ret;
}
!urilend->raw_buffer)
ret = 1;
- DetectUrilenFree(urilend);
+ DetectUrilenFree(NULL, urilend);
}
return ret;
}
!urilend->raw_buffer)
ret = 1;
- DetectUrilenFree(urilend);
+ DetectUrilenFree(NULL, urilend);
}
return ret;
}
!urilend->raw_buffer)
ret = 1;
- DetectUrilenFree(urilend);
+ DetectUrilenFree(NULL, urilend);
}
return ret;
}
urilend->raw_buffer)
ret = 1;
- DetectUrilenFree(urilend);
+ DetectUrilenFree(NULL, urilend);
}
return ret;
}
!urilend->raw_buffer)
ret = 1;
- DetectUrilenFree(urilend);
+ DetectUrilenFree(NULL, urilend);
}
return ret;
}
!urilend->raw_buffer)
ret = 1;
- DetectUrilenFree(urilend);
+ DetectUrilenFree(NULL, urilend);
}
return ret;
}
urilend->raw_buffer)
ret = 1;
- DetectUrilenFree(urilend);
+ DetectUrilenFree(NULL, urilend);
}
return ret;
}
urilend->raw_buffer)
ret = 1;
- DetectUrilenFree(urilend);
+ DetectUrilenFree(NULL, urilend);
}
return ret;
}
static int DetectXbitMatch (DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *);
static int DetectXbitSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectXbitFree (void *);
+void DetectXbitFree (DetectEngineCtx *, void *);
void XBitsRegisterTests(void);
void DetectXbitsRegister (void)
return -1;
}
-void DetectXbitFree (void *ptr)
+void DetectXbitFree (DetectEngineCtx *de_ctx, void *ptr)
{
DetectXbitsData *fd = (DetectXbitsData *)ptr;
FAIL_IF_NOT(cd->tracker == (trk)); \
FAIL_IF_NOT(cd->type == (typ)); \
FAIL_IF_NOT(cd->expire == (exp)); \
- DetectXbitFree(cd); \
+ DetectXbitFree(NULL, cd); \
cd = NULL;
GOOD_INPUT("set,abc,track ip_pair",
bool (*SupportsPrefilter)(const Signature *s);
int (*SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh);
- void (*Free)(void *);
+ void (*Free)(DetectEngineCtx *, void *);
void (*RegisterTests)(void);
uint16_t flags;
void SigMatchSignaturesBuildMatchArray(DetectEngineThreadCtx *,
Packet *, SignatureMask,
uint16_t);
-void SigMatchFree(SigMatch *sm);
+void SigMatchFree(DetectEngineCtx *, SigMatch *sm);
void SigRegisterTests(void);
void TmModuleDetectRegister (void);
DetectBsizeData *bsz = DetectBsizeParse((str)); \
FAIL_IF_NULL(bsz); \
FAIL_IF_NOT(bsz->mode == (m)); \
- DetectBsizeFree(bsz); \
+ DetectBsizeFree(NULL, bsz); \
SCLogDebug("str %s OK", (str)); \
}
#define TEST_FAIL(str) { \
dd = DetectSNMPPduTypeParse("2");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->pdu_type == 2);
- DetectSNMPPduTypeFree(dd);
+ DetectSNMPPduTypeFree(NULL, dd);
PASS;
}
dd = DetectSNMPVersionParse("2");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->version == 2 && dd->mode == PROCEDURE_EQ);
- DetectSNMPVersionFree(dd);
+ DetectSNMPVersionFree(NULL, dd);
PASS;
}
dd = DetectSNMPVersionParse(">2");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->version == 2 && dd->mode == PROCEDURE_GT);
- DetectSNMPVersionFree(dd);
+ DetectSNMPVersionFree(NULL, dd);
PASS;
}
static int DetectSslVersionTestParse01(void)
{
DetectSslVersionData *ssl = NULL;
- ssl = DetectSslVersionParse("SSlv3");
+ ssl = DetectSslVersionParse(NULL, "SSlv3");
FAIL_IF_NULL(ssl);
FAIL_IF_NOT(ssl->data[SSLv3].ver == SSL_VERSION_3);
- DetectSslVersionFree(ssl);
+ DetectSslVersionFree(NULL, ssl);
PASS;
}
static int DetectSslVersionTestParse02(void)
{
DetectSslVersionData *ssl = NULL;
- ssl = DetectSslVersionParse("2.5");
+ ssl = DetectSslVersionParse(NULL, "2.5");
FAIL_IF_NOT_NULL(ssl);
- DetectSslVersionFree(ssl);
+ DetectSslVersionFree(NULL, ssl);
PASS;
}
static int DetectSslVersionTestParse03(void)
{
DetectSslVersionData *ssl = NULL;
- ssl = DetectSslVersionParse("SSlv3,tls1.0, !tls1.2");
+ ssl = DetectSslVersionParse(NULL, "SSlv3,tls1.0, !tls1.2");
FAIL_IF_NULL(ssl);
FAIL_IF_NOT(ssl->data[SSLv3].ver == SSL_VERSION_3);
FAIL_IF_NOT(ssl->data[TLS10].ver == TLS_VERSION_10);
FAIL_IF_NOT(ssl->data[TLS12].ver == TLS_VERSION_12);
FAIL_IF_NOT(ssl->data[TLS12].flags & DETECT_SSL_VERSION_NEGATED);
- DetectSslVersionFree(ssl);
+ DetectSslVersionFree(NULL, ssl);
PASS;
}
FAIL_IF_NOT(tcpmssd->arg1 == 10);
FAIL_IF_NOT(tcpmssd->mode == DETECT_TCPMSS_EQ);
- DetectTcpmssFree(tcpmssd);
+ DetectTcpmssFree(NULL, tcpmssd);
PASS;
}
FAIL_IF_NOT(tcpmssd->arg1 == 10);
FAIL_IF_NOT(tcpmssd->mode == DETECT_TCPMSS_LT);
- DetectTcpmssFree(tcpmssd);
+ DetectTcpmssFree(NULL, tcpmssd);
PASS;
}
FAIL_IF_NOT(tcpmssd->arg1 == 1);
FAIL_IF_NOT(tcpmssd->mode == DETECT_TCPMSS_RA);
- DetectTcpmssFree(tcpmssd);
+ DetectTcpmssFree(NULL, tcpmssd);
PASS;
}
FAIL_IF_NOT(tcpmssd->arg1 == 10);
FAIL_IF_NOT(tcpmssd->mode == DETECT_TCPMSS_GT);
- DetectTcpmssFree(tcpmssd);
+ DetectTcpmssFree(NULL, tcpmssd);
PASS;
}
FAIL_IF_NOT(tcpmssd->arg2 == 2);
FAIL_IF_NOT(tcpmssd->mode == DETECT_TCPMSS_RA);
- DetectTcpmssFree(tcpmssd);
+ DetectTcpmssFree(NULL, tcpmssd);
PASS;
}
DetectTemplateData *templated = DetectTemplateParse("1,10");
FAIL_IF_NULL(templated);
FAIL_IF(!(templated->arg1 == 1 && templated->arg2 == 10));
- DetectTemplateFree(templated);
+ DetectTemplateFree(NULL, templated);
PASS;
}
FAIL_IF_NOT(template2d->arg1 == 10);
FAIL_IF_NOT(template2d->mode == DETECT_TEMPLATE2_EQ);
- DetectTemplate2Free(template2d);
+ DetectTemplate2Free(NULL, template2d);
PASS;
}
FAIL_IF_NOT(template2d->arg1 == 10);
FAIL_IF_NOT(template2d->mode == DETECT_TEMPLATE2_LT);
- DetectTemplate2Free(template2d);
+ DetectTemplate2Free(NULL, template2d);
PASS;
}
FAIL_IF_NOT(template2d->arg1 == 1);
FAIL_IF_NOT(template2d->mode == DETECT_TEMPLATE2_RA);
- DetectTemplate2Free(template2d);
+ DetectTemplate2Free(NULL, template2d);
PASS;
}
FAIL_IF_NOT(template2d->arg1 == 10);
FAIL_IF_NOT(template2d->mode == DETECT_TEMPLATE2_GT);
- DetectTemplate2Free(template2d);
+ DetectTemplate2Free(NULL, template2d);
PASS;
}
FAIL_IF_NOT(template2d->arg2 == 2);
FAIL_IF_NOT(template2d->mode == DETECT_TEMPLATE2_RA);
- DetectTemplate2Free(template2d);
+ DetectTemplate2Free(NULL, template2d);
PASS;
}
dd = DetectTlsValidityParse("1430000000");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1430000000 && dd->mode == DETECT_TLS_VALIDITY_EQ);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse(">1430000000");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1430000000 && dd->mode == DETECT_TLS_VALIDITY_GT);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse("<1430000000");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1430000000 && dd->mode == DETECT_TLS_VALIDITY_LT);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1430000000 && dd->epoch2 == 1470000000 &&
dd->mode == DETECT_TLS_VALIDITY_RA);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1430000000 && dd->epoch2 == 1490000000 &&
dd->mode == DETECT_TLS_VALIDITY_RA);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse("> 1430000000 ");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1430000000 && dd->mode == DETECT_TLS_VALIDITY_GT);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse("< 1490000000 ");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1490000000 && dd->mode == DETECT_TLS_VALIDITY_LT);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse(" 1490000000 ");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1490000000 && dd->mode == DETECT_TLS_VALIDITY_EQ);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse("2015-10");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1443657600 && dd->mode == DETECT_TLS_VALIDITY_EQ);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse(">2015-10-22");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1445472000 && dd->mode == DETECT_TLS_VALIDITY_GT);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse("<2015-10-22 23");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1445554800 && dd->mode == DETECT_TLS_VALIDITY_LT);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse("2015-10-22 23:59");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1445558340 && dd->mode == DETECT_TLS_VALIDITY_EQ);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse("2015-10-22 23:59:59");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1445558399 && dd->mode == DETECT_TLS_VALIDITY_EQ);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse("2015-10-22T23");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1445554800 && dd->mode == DETECT_TLS_VALIDITY_EQ);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse("2015-10-22T23:59");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1445558340 && dd->mode == DETECT_TLS_VALIDITY_EQ);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
dd = DetectTlsValidityParse("2015-10-22T23:59:59");
FAIL_IF_NULL(dd);
FAIL_IF_NOT(dd->epoch == 1445558399 && dd->mode == DETECT_TLS_VALIDITY_EQ);
- DetectTlsValidityFree(dd);
+ DetectTlsValidityFree(NULL, dd);
PASS;
}
static int DetectTlsVersionTestParse01 (void)
{
DetectTlsVersionData *tls = NULL;
- tls = DetectTlsVersionParse("1.0");
+ tls = DetectTlsVersionParse(NULL, "1.0");
FAIL_IF_NULL(tls);
FAIL_IF_NOT(tls->ver == TLS_VERSION_10);
- DetectTlsVersionFree(tls);
+ DetectTlsVersionFree(NULL, tls);
PASS;
}
static int DetectTlsVersionTestParse02 (void)
{
DetectTlsVersionData *tls = NULL;
- tls = DetectTlsVersionParse("2.5");
+ tls = DetectTlsVersionParse(NULL, "2.5");
FAIL_IF_NOT_NULL(tls);
- DetectTlsVersionFree(tls);
+ DetectTlsVersionFree(NULL, tls);
PASS;
}
FAIL_IF_NULL(ttld);
FAIL_IF_NOT(ttld->ttl1 == 10);
FAIL_IF_NOT(ttld->mode == DETECT_TTL_EQ);
- DetectTtlFree(ttld);
+ DetectTtlFree(NULL, ttld);
PASS;
}
FAIL_IF_NULL(ttld);
FAIL_IF_NOT(ttld->ttl1 == 10);
FAIL_IF_NOT(ttld->mode == DETECT_TTL_LT);
- DetectTtlFree(ttld);
+ DetectTtlFree(NULL, ttld);
PASS;
}
FAIL_IF_NOT(ttld->ttl1 == 1);
FAIL_IF_NOT(ttld->ttl2 == 2);
FAIL_IF_NOT(ttld->mode == DETECT_TTL_RA);
- DetectTtlFree(ttld);
+ DetectTtlFree(NULL, ttld);
PASS;
}
FAIL_IF_NULL(ttld);
FAIL_IF_NOT(ttld->ttl1 == 10);
FAIL_IF_NOT(ttld->mode == DETECT_TTL_GT);
- DetectTtlFree(ttld);
+ DetectTtlFree(NULL, ttld);
PASS;
}
FAIL_IF_NOT(ttld->ttl1 == 1);
FAIL_IF_NOT(ttld->ttl2 == 2);
FAIL_IF_NOT(ttld->mode == DETECT_TTL_RA);
- DetectTtlFree(ttld);
+ DetectTtlFree(NULL, ttld);
PASS;
}
Signature *s = SigInit(de_ctx, buffer);
free(buffer);
if (s && s->next) {
- SigFree(s->next);
+ SigFree(de_ctx, s->next);
s->next = NULL;
}
- SigFree(s);
+ SigFree(de_ctx, s);
}
return 0;
s = SigInit(de_ctx, "alert tcp [$HTTP_SERVERS,$HOME_NET,192.168.2.5] $HTTP_PORTS -> $EXTERNAL_NET [80,[!$HTTP_PORTS,$ORACLE_PORTS]] (msg:\"Rule Vars Test\"; sid:1;)");
if (s == NULL)
goto end;
- SigFree(s);
+ SigFree(de_ctx, s);
result = 1;
s = SigInit(de_ctx, "alert tcp $http_servers any -> any any (msg:\"Rule Vars Test\"; sid:1;)");
if (s != NULL)
goto end;
- SigFree(s);
+ SigFree(de_ctx, s);
s = SigInit(de_ctx, "alert tcp $http_servers any -> any $HTTP_PORTS (msg:\"Rule Vars Test\"; sid:1;)");
if (s != NULL)
goto end;
- SigFree(s);
+ SigFree(de_ctx, s);
s = SigInit(de_ctx, "alert tcp !$TELNET_SERVERS !80 -> any !$SSH_PORTS (msg:\"Rule Vars Test\"; sid:1;)");
if (s != NULL)
goto end;
- SigFree(s);
+ SigFree(de_ctx, s);
result = 1;
DETECT_THRESHOLD, DETECT_DETECTION_FILTER, -1);
if (sm != NULL) {
SigMatchRemoveSMFromList(s, sm, DETECT_SM_LIST_THRESHOLD);
- SigMatchFree(sm);
+ SigMatchFree(de_ctx, sm);
sm = NULL;
}
}