Project

General

Profile

Bug #252 » 0001-give-error-on-duplicate-signature-telling-the-same.patch

Gurvinder Singh, 12/16/2010 07:10 PM

View differences:

src/detect-parse.c
* \param de_ctx Pointer to the Detection Engine Context.
* \param sigstr Pointer to a character string containing the signature to be
* parsed.
* \param sig_file Pointer to a character string containing the filename from
* which signature is read
* \param lineno Line number from where signature is read
*
* \retval Pointer to the head Signature in the detection engine ctx sig_list
* on success; NULL on failure.
*/
Signature *DetectEngineAppendSig(DetectEngineCtx *de_ctx, char *sigstr) {
Signature *DetectEngineAppendSig(DetectEngineCtx *de_ctx, char *sigstr)
{
Signature *sig = SigInitReal(de_ctx, sigstr);
if (sig == NULL)
if (sig == NULL) {
return NULL;
}
/* checking for the status of duplicate signature */
int dup_sig = DetectEngineSignatureIsDuplicate(de_ctx, sig);
/* a duplicate signature that should be chucked out. Check the previously
* called function details to understand the different return values */
if (dup_sig == 1)
if (dup_sig == 1) {
SCLogError(SC_ERR_DUPLICATE_SIG, "Duplicate signature \"%s\"", sigstr);
goto error;
}
if (sig->flags & SIG_FLAG_BIDIREC) {
if (sig->next != NULL) {
src/util-error.c
CASE_CODE (SC_ERR_DCERPC);
CASE_CODE (SC_ERR_AHO_CORASICK);
CASE_CODE (SC_ERR_REFERENCE_CONFIG);
CASE_CODE (SC_ERR_DUPLICATE_SIG);
default:
return "UNKNOWN_ERROR";
src/util-error.h
SC_ERR_DETECT_PREPARE, /**< preparing the detection engine failed */
SC_ERR_AHO_CORASICK,
SC_ERR_REFERENCE_CONFIG,
SC_ERR_DUPLICATE_SIG, /**< Error to indicate that signature is duplicate */
} SCError;
const char *SCErrorToString(SCError);
(1-1/2)