return 0;
}
-/**
- * \brief This function is used to parse bsize options passed via bsize: keyword
- *
- * \param bsizestr Pointer to the user provided bsize options
- *
- * \retval bsized pointer to DetectU64Data on success
- * \retval NULL on failure
- */
-
-static DetectU64Data *DetectBsizeParse(const char *str)
-{
- return DetectU64Parse(str);
-}
-
static int SigParseGetMaxBsize(const DetectU64Data *bsz)
{
switch (bsz->mode) {
if (list == DETECT_SM_LIST_NOTSET)
SCReturnInt(-1);
- DetectU64Data *bsz = DetectBsizeParse(sizestr);
+ DetectU64Data *bsz = DetectU64Parse(sizestr);
if (bsz == NULL)
- goto error;
+ SCReturnInt(-1);
if (SigMatchAppendSMToList(de_ctx, s, DETECT_BSIZE, (SigMatchCtx *)bsz, list) == NULL) {
goto error;
if (DetectGetLastSMFromLists(s, DETECT_DSIZE, -1)) {
SCLogError("Can't use 2 or more dsizes in "
"the same sig. Invalidating signature.");
- goto error;
+ return -1;
}
SCLogDebug("\'%s\'", rawstr);
dd = DetectU16Parse(rawstr);
if (dd == NULL) {
SCLogError("Parsing \'%s\' failed", rawstr);
- goto error;
+ return -1;
}
/* Okay so far so good, lets get this into a SigMatch
de_ctx, s, DETECT_DSIZE, (SigMatchCtx *)dd, DETECT_SM_LIST_MATCH);
if (sm == NULL) {
rs_detect_u16_free(dd);
- goto error;
+ return -1;
}
SCLogDebug("dd->arg1 %" PRIu16 ", dd->arg2 %" PRIu16 ", dd->mode %" PRIu8 "", dd->arg1,
}
return 0;
-
-error:
- return -1;
}
/**
return DetectU8Match(pitype, itd);
}
-/**
- * \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 DetectU8Data on success
- * \retval NULL on failure
- */
-static DetectU8Data *DetectITypeParse(DetectEngineCtx *de_ctx, const char *itypestr)
-{
- return DetectU8Parse(itypestr);
-}
-
/**
* \brief this function is used to add the parsed itype data into the current signature
*
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(de_ctx, itypestr);
- if (itd == NULL) goto error;
+ itd = DetectU8Parse(itypestr);
+ if (itd == NULL)
+ return -1;
if (SigMatchAppendSMToList(de_ctx, s, DETECT_ITYPE, (SigMatchCtx *)itd, DETECT_SM_LIST_MATCH) ==
NULL) {
- goto error;
+ DetectITypeFree(de_ctx, itd);
+ return -1;
}
s->flags |= SIG_FLAG_REQUIRE_PACKET;
return 0;
-
-error:
- if (itd != NULL)
- DetectITypeFree(de_ctx, itd);
- return -1;
}
/**
static int DetectITypeParseTest01(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, "8");
+ itd = DetectU8Parse("8");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->mode == DETECT_UINT_EQ);
static int DetectITypeParseTest02(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, ">8");
+ itd = DetectU8Parse(">8");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->mode == DETECT_UINT_GT);
static int DetectITypeParseTest03(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, "<8");
+ itd = DetectU8Parse("<8");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->mode == DETECT_UINT_LT);
static int DetectITypeParseTest04(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, "8<>20");
+ itd = DetectU8Parse("8<>20");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->arg2 == 20);
static int DetectITypeParseTest05(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, " 8 ");
+ itd = DetectU8Parse(" 8 ");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->mode == DETECT_UINT_EQ);
static int DetectITypeParseTest06(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, " > 8 ");
+ itd = DetectU8Parse(" > 8 ");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->mode == DETECT_UINT_GT);
static int DetectITypeParseTest07(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, " 8 <> 20 ");
+ itd = DetectU8Parse(" 8 <> 20 ");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->arg2 == 20);
static int DetectITypeParseTest08(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, "> 8 <> 20");
+ itd = DetectU8Parse("> 8 <> 20");
FAIL_IF_NOT_NULL(itd);
PASS;
SCReturnInt(0);
}
-/**
- * \internal
- * \brief Function to parse options passed via rfb.sectype keywords.
- *
- * \param rawstr Pointer to the user provided options.
- *
- * \retval dd pointer to DetectU32Data on success.
- * \retval NULL on failure.
- */
-static DetectU32Data *DetectRfbSectypeParse(const char *rawstr)
-{
- return DetectU32Parse(rawstr);
-}
-
/**
* \brief Function to add the parsed RFB security type field into the current signature.
*
if (DetectSignatureSetAppProto(s, ALPROTO_RFB) != 0)
return -1;
- DetectU32Data *dd = DetectRfbSectypeParse(rawstr);
+ DetectU32Data *dd = DetectU32Parse(rawstr);
if (dd == NULL) {
SCLogError("Parsing \'%s\' failed", rawstr);
- goto error;
+ return -1;
}
/* okay so far so good, lets get this into a SigMatch