/*This was submitted as a patch for bug #11. But this impliments incorrect behavior as !
if(cd->negated==1){
*insideofquotesshouldbetreatedasnormalmatch.*/
SCLogDebug("Invalid negated content. \"!\" located twice at the "
//if (str[0] == '!') {
"start of the contet string: %s",contentstr);
// if (cd->negated == 1) {
gotoerror;
// SCLogDebug("Invalid negated content. \"!\" located twice at the "
}else{
// "start of the contet string: %s", contentstr);
temp=str;
// goto error;
if((str=strdup(temp+1))==NULL)
// } else {
gotoerror;
// temp = str;
cd->negated=1;
// if ( (str = strdup(temp + 1)) == NULL)
free(temp);
// goto error;
temp=NULL;
// cd->negated = 1;
}
// free(temp);
}
// temp = NULL;
// }
//}
len=strlen(str);
len=strlen(str);
if(len==0)
if(len==0)
@ -2659,7 +2661,7 @@ int DetectContentParseNegTest12(void) {
intDetectContentParseNegTest13(void){
intDetectContentParseNegTest13(void){
intresult=0;
intresult=0;
DetectContentData*cd=NULL;
DetectContentData*cd=NULL;
char*teststring="\"!boo\"";
char*teststring="!\"boo\"";
cd=DetectContentParse(teststring);
cd=DetectContentParse(teststring);
if(cd!=NULL){
if(cd!=NULL){
@ -2676,7 +2678,7 @@ int DetectContentParseNegTest14(void) {
cd=DetectContentParse(teststring);
cd=DetectContentParse(teststring);
if(cd!=NULL){
if(cd!=NULL){
result=(cd->negated==1);
result=(cd->negated==0);
DetectContentFree(cd);
DetectContentFree(cd);
}
}
returnresult;
returnresult;
@ -3056,7 +3058,7 @@ static int SigTest74TestNegatedContent(void)
staticintSigTest75TestNegatedContent(void)
staticintSigTest75TestNegatedContent(void)
{
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"USER\"; content:\"!PASS\"; sid:1;)",(uint8_t*)"USER apple");
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"USER\"; content:\"!PASS\"; sid:1;)",(uint8_t*)"USER !PASS");