printf("IP-ONLY (%"PRIu32"): source %s, dest %s\n",s->id,
@ -6201,7 +6168,7 @@ static int SigTest40IPOnly01 (void) {
if(SignatureIsIPOnly(&de_ctx,s))
result=1;
else
printf("SigTest40IPOnly01: Failed: Expecting a IPOnly signature\n");
printf("expected a IPOnly signature: ");
SigFree(s);
end:
@ -6226,7 +6193,7 @@ static int SigTest40IPOnly02 (void) {
if(!SignatureIsIPOnly(&de_ctx,s))
result=1;
else
printf("SigTest40IPOnly02: Failed: Got a IPOnly signature\n");
printf("got a IPOnly signature: ");
SigFree(s);
@ -6241,122 +6208,125 @@ end:
staticintSigTest40IPOnly03(void){
intresult=1;
DetectEngineCtxde_ctx;
DetectEngineCtx*de_ctx;
Signature*s=NULL;
de_ctx.flags|=DE_QUIET;
de_ctx=DetectEngineCtxInit();
if(de_ctx==NULL)
gotoend;
de_ctx->flags|=DE_QUIET;
/* combination of pcre and content */
s=SigInit(&de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (pcre and content) \"; content:\"php\"; pcre:\"/require(_once)?/i\"; classtype:misc-activity; sid:400001; rev:1;)");
s=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (pcre and content) \"; content:\"php\"; pcre:\"/require(_once)?/i\"; classtype:misc-activity; sid:400001; rev:1;)");
if(s==NULL){
gotoend;
}
if(SignatureIsIPOnly(&de_ctx,s))
if(SignatureIsIPOnly(de_ctx,s))
{
printf("SigTest40IPOnly03: Failed: Got a IPOnly signature (content)\n");
printf("got a IPOnly signature (content): ");
result=0;
}
SigFree(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;)");
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;)");
if(s==NULL){
gotoend;
}
if(SignatureIsIPOnly(&de_ctx,s))
if(SignatureIsIPOnly(de_ctx,s))
{
printf("SigTest40IPOnly03: Failed: Got a IPOnly signature (content)\n");
printf("got a IPOnly signature (content): ");
result=0;
}
SigFree(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;)");
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;)");
if(s==NULL){
gotoend;
}
if(SignatureIsIPOnly(&de_ctx,s))
if(SignatureIsIPOnly(de_ctx,s))
{
printf("SigTest40IPOnly03: Failed: Got a IPOnly signature (uricontent)\n");
printf("got a IPOnly signature (uricontent): ");
result=0;
}
SigFree(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;)");
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;)");
if(s==NULL){
gotoend;
}
if(SignatureIsIPOnly(&de_ctx,s))
if(SignatureIsIPOnly(de_ctx,s))
{
printf("SigTest40IPOnly03: Failed: Got a IPOnly signature (pcre)\n");
printf("got a IPOnly signature (pcre): ");
result=0;
}
SigFree(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;)");
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;)");
if(s==NULL){
gotoend;
}
if(SignatureIsIPOnly(&de_ctx,s))
if(SignatureIsIPOnly(de_ctx,s))
{
printf("SigTest40IPOnly03: Failed: Got a IPOnly signature (flow)\n");
printf("got a IPOnly signature (flow): ");
result=0;
}
SigFree(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;)");
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;)");
if(s==NULL){
gotoend;
}
if(SignatureIsIPOnly(&de_ctx,s))
if(SignatureIsIPOnly(de_ctx,s))
{
printf("SigTest40IPOnly03: Failed: Got a IPOnly signature (dsize)\n");
printf("got a IPOnly signature (dsize): ");
result=0;
}
SigFree(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;)");
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;)");
if(s==NULL){
gotoend;
}
if(SignatureIsIPOnly(&de_ctx,s))
if(SignatureIsIPOnly(de_ctx,s))
{
printf("SigTest40IPOnly03: Failed: Got a IPOnly signature (flowbits)\n");
printf("got a IPOnly signature (flowbits): ");
result=0;
}
SigFree(s);
/* flowvar
s=SigInit(&de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (flowvar) \"; flowvar:XXXXXX; classtype:misc-activity; sid:400001; rev:1;)");
/* 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;)");
if(s==NULL){
gotoend;
}
if(SignatureIsIPOnly(&de_ctx,s))
if(SignatureIsIPOnly(de_ctx,s))
{
printf("SigTest40IPOnly03: Failed: Got a IPOnly signature (flowvar)\n");
printf("got a IPOnly signature (flowvar): ");
result=0;
}
SigFree(s);
*/
/* pktvar
s=SigInit(&de_ctx,"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (pktvar) \"; pktvar:XXXX; classtype:misc-activity; sid:400001; rev:1;)");
/* 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;)");
if(s==NULL){
gotoend;
}
if(SignatureIsIPOnly(&de_ctx,s))
if(SignatureIsIPOnly(de_ctx,s))
{
printf("SigTest40IPOnly03: Failed: Got a IPOnly signature (pktvar)\n");