From e047971a308616c79a308dfb59172ae3b1a45970 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Thu, 1 Jul 2010 21:08:58 +0530 Subject: [PATCH] pcre recursive matching not implemented --- src/detect-engine-payload.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/src/detect-engine-payload.c b/src/detect-engine-payload.c index ce1c0dc..6f6c9e6 100644 --- a/src/detect-engine-payload.c +++ b/src/detect-engine-payload.c @@ -538,6 +538,31 @@ end: return result; } +/** + * \test Test pcre recursive matching. + */ +static int PayloadTestSig08(void) +{ + uint8_t *buf = (uint8_t *)"this is a super nova in super nova now"; + uint16_t buflen = strlen((char *)buf); + Packet *p = UTHBuildPacket( buf, buflen, IPPROTO_TCP); + int result = 0; + + char sig[] = "alert tcp any any -> any any (msg:\"dummy\"; " + "pcre:/super/; content:nova; within:7; sid:1;)"; + + if (UTHPacketMatchSigMpm(p, sig, MPM_B2G) == 0) { + result = 0; + goto end; + } + + result = 1; +end: + if (p != NULL) + UTHFreePacket(p); + return result; +} + #endif /* UNITTESTS */ void PayloadRegisterTests(void) { @@ -549,5 +574,6 @@ void PayloadRegisterTests(void) { UtRegisterTest("PayloadTestSig05", PayloadTestSig05, 1); UtRegisterTest("PayloadTestSig06", PayloadTestSig06, 1); UtRegisterTest("PayloadTestSig07", PayloadTestSig07, 1); + UtRegisterTest("PayloadTestSig08", PayloadTestSig08, 1); #endif /* UNITTESTS */ } -- 1.7.0.2