@ -895,10 +895,11 @@ static int SigParseOptions(DetectEngineCtx *de_ctx, Signature *s, char *optstr,
}
}
optname = optstr ;
optname = optstr ;
if ( requires ) {
/* Check for options that are only to be processed during the
if ( strcmp ( optname , " requires " ) ) {
* first " requires " pass . */
goto finish ;
bool requires_only = strcmp ( optname , " requires " ) = = 0 | | strcmp ( optname , " sid " ) = = 0 ;
}
if ( ( requires & & ! requires_only ) | | ( ! requires & & requires_only ) ) {
goto finish ;
}
}
/* Call option parsing */
/* Call option parsing */
@ -2136,10 +2137,7 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
AppLayerHtpNeedFileInspection ( ) ;
AppLayerHtpNeedFileInspection ( ) ;
}
}
}
}
if ( s - > id = = 0 ) {
SCLogError ( " Signature missing required value \" sid \" . " ) ;
SCReturnInt ( 0 ) ;
}
SCReturnInt ( 1 ) ;
SCReturnInt ( 1 ) ;
}
}
@ -2180,6 +2178,12 @@ static Signature *SigInitHelper(DetectEngineCtx *de_ctx, const char *sigstr,
goto error ;
goto error ;
}
}
/* Check for a SID before continuuing. */
if ( sig - > id = = 0 ) {
SCLogError ( " Signature missing required value \" sid \" . " ) ;
goto error ;
}
/* Now completely parse the rule. */
/* Now completely parse the rule. */
ret = SigParse ( de_ctx , sig , sigstr , dir , & parser , false ) ;
ret = SigParse ( de_ctx , sig , sigstr , dir , & parser , false ) ;
BUG_ON ( ret = = - 4 ) ;
BUG_ON ( ret = = - 4 ) ;