@ -2132,6 +2132,186 @@ end:
return result ;
}
/**
* \ test packet / stream sig
*/
static int SigParseTest13 ( void ) {
int result = 0 ;
DetectEngineCtx * de_ctx = DetectEngineCtxInit ( ) ;
if ( de_ctx = = NULL )
goto end ;
Signature * s = NULL ;
s = DetectEngineAppendSig ( de_ctx , " alert tcp any any -> any any (content: \" abc \" ; sid:1;) " ) ;
if ( s = = NULL ) {
printf ( " sig 1 invalidated: failure " ) ;
goto end ;
}
if ( ! ( s - > flags & SIG_FLAG_REQUIRE_STREAM ) ) {
printf ( " sig doesn't have stream flag set \n " ) ;
goto end ;
}
if ( s - > flags & SIG_FLAG_REQUIRE_PACKET ) {
printf ( " sig has packet flag set \n " ) ;
goto end ;
}
result = 1 ;
end :
if ( de_ctx ! = NULL )
DetectEngineCtxFree ( de_ctx ) ;
return result ;
}
/**
* \ test packet / stream sig
*/
static int SigParseTest14 ( void ) {
int result = 0 ;
DetectEngineCtx * de_ctx = DetectEngineCtxInit ( ) ;
if ( de_ctx = = NULL )
goto end ;
Signature * s = NULL ;
s = DetectEngineAppendSig ( de_ctx , " alert tcp any any -> any any (content: \" abc \" ; dsize:>0; sid:1;) " ) ;
if ( s = = NULL ) {
printf ( " sig 1 invalidated: failure " ) ;
goto end ;
}
if ( ! ( s - > flags & SIG_FLAG_REQUIRE_PACKET ) ) {
printf ( " sig doesn't have packet flag set \n " ) ;
goto end ;
}
if ( s - > flags & SIG_FLAG_REQUIRE_STREAM ) {
printf ( " sig has stream flag set \n " ) ;
goto end ;
}
result = 1 ;
end :
if ( de_ctx ! = NULL )
DetectEngineCtxFree ( de_ctx ) ;
return result ;
}
/**
* \ test packet / stream sig
*/
static int SigParseTest15 ( void ) {
int result = 0 ;
DetectEngineCtx * de_ctx = DetectEngineCtxInit ( ) ;
if ( de_ctx = = NULL )
goto end ;
Signature * s = NULL ;
s = DetectEngineAppendSig ( de_ctx , " alert tcp any any -> any any (content: \" abc \" ; offset:5; sid:1;) " ) ;
if ( s = = NULL ) {
printf ( " sig 1 invalidated: failure " ) ;
goto end ;
}
if ( ! ( s - > flags & SIG_FLAG_REQUIRE_PACKET ) ) {
printf ( " sig doesn't have packet flag set \n " ) ;
goto end ;
}
if ( ! ( s - > flags & SIG_FLAG_REQUIRE_STREAM ) ) {
printf ( " sig doesn't have stream flag set \n " ) ;
goto end ;
}
result = 1 ;
end :
if ( de_ctx ! = NULL )
DetectEngineCtxFree ( de_ctx ) ;
return result ;
}
/**
* \ test packet / stream sig
*/
static int SigParseTest16 ( void ) {
int result = 0 ;
DetectEngineCtx * de_ctx = DetectEngineCtxInit ( ) ;
if ( de_ctx = = NULL )
goto end ;
Signature * s = NULL ;
s = DetectEngineAppendSig ( de_ctx , " alert tcp any any -> any any (content: \" abc \" ; depth:5; sid:1;) " ) ;
if ( s = = NULL ) {
printf ( " sig 1 invalidated: failure " ) ;
goto end ;
}
if ( ! ( s - > flags & SIG_FLAG_REQUIRE_PACKET ) ) {
printf ( " sig doesn't have packet flag set \n " ) ;
goto end ;
}
if ( ! ( s - > flags & SIG_FLAG_REQUIRE_STREAM ) ) {
printf ( " sig doesn't have stream flag set \n " ) ;
goto end ;
}
result = 1 ;
end :
if ( de_ctx ! = NULL )
DetectEngineCtxFree ( de_ctx ) ;
return result ;
}
/**
* \ test packet / stream sig
*/
static int SigParseTest17 ( void ) {
int result = 0 ;
DetectEngineCtx * de_ctx = DetectEngineCtxInit ( ) ;
if ( de_ctx = = NULL )
goto end ;
Signature * s = NULL ;
s = DetectEngineAppendSig ( de_ctx , " alert tcp any any -> any any (content: \" abc \" ; offset:1; depth:5; sid:1;) " ) ;
if ( s = = NULL ) {
printf ( " sig 1 invalidated: failure " ) ;
goto end ;
}
if ( ! ( s - > flags & SIG_FLAG_REQUIRE_PACKET ) ) {
printf ( " sig doesn't have packet flag set \n " ) ;
goto end ;
}
if ( ! ( s - > flags & SIG_FLAG_REQUIRE_STREAM ) ) {
printf ( " sig doesn't have stream flag set \n " ) ;
goto end ;
}
result = 1 ;
end :
if ( de_ctx ! = NULL )
DetectEngineCtxFree ( de_ctx ) ;
return result ;
}
/** \test Direction operator validation (invalid) */
int SigParseBidirecTest06 ( void ) {
int result = 1 ;
@ -3006,6 +3186,11 @@ void SigParseRegisterTests(void) {
UtRegisterTest ( " SigParseTest10 " , SigParseTest10 , 1 ) ;
UtRegisterTest ( " SigParseTest11 " , SigParseTest11 , 1 ) ;
UtRegisterTest ( " SigParseTest12 " , SigParseTest12 , 1 ) ;
UtRegisterTest ( " SigParseTest13 " , SigParseTest13 , 1 ) ;
UtRegisterTest ( " SigParseTest14 " , SigParseTest14 , 1 ) ;
UtRegisterTest ( " SigParseTest15 " , SigParseTest15 , 1 ) ;
UtRegisterTest ( " SigParseTest16 " , SigParseTest16 , 1 ) ;
UtRegisterTest ( " SigParseTest17 " , SigParseTest17 , 1 ) ;
UtRegisterTest ( " SigParseBidirecTest06 " , SigParseBidirecTest06 , 1 ) ;
UtRegisterTest ( " SigParseBidirecTest07 " , SigParseBidirecTest07 , 1 ) ;