From: Victor Julien Date: Thu, 9 Aug 2018 09:51:07 +0000 (+0200) Subject: detect: cleanup direct SIG_FLAG_STATE_MATCH use X-Git-Tag: suricata-4.1.0-rc2~143 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5879dafe55852191cd71d2a6f8ba24cce918195c;p=thirdparty%2Fsuricata.git detect: cleanup direct SIG_FLAG_STATE_MATCH use This flag should normally not be set manually. It will be set by the code registering the app engines in a signature. --- diff --git a/src/detect-ftpdata.c b/src/detect-ftpdata.c index 7c93c84c13..38838bc1d9 100644 --- a/src/detect-ftpdata.c +++ b/src/detect-ftpdata.c @@ -215,7 +215,6 @@ static int DetectFtpdataSetup(DetectEngineCtx *de_ctx, Signature *s, const char sm->type = DETECT_FTPDATA; sm->ctx = (void *)ftpcommandd; - s->flags |= SIG_FLAG_STATE_MATCH; SigMatchAppendSMToList(s, sm, g_ftpdata_buffer_id); return 0; diff --git a/src/detect-krb5-errcode.c b/src/detect-krb5-errcode.c index 57e46a5ad3..fb61819544 100644 --- a/src/detect-krb5-errcode.c +++ b/src/detect-krb5-errcode.c @@ -202,7 +202,6 @@ static int DetectKrb5ErrCodeSetup (DetectEngineCtx *de_ctx, Signature *s, const sm->type = DETECT_AL_KRB5_ERRCODE; sm->ctx = (void *)krb5d; - s->flags |= SIG_FLAG_STATE_MATCH; SigMatchAppendSMToList(s, sm, g_krb5_err_code_list_id); return 0; diff --git a/src/detect-krb5-msgtype.c b/src/detect-krb5-msgtype.c index d1a27634ad..9ec9449709 100644 --- a/src/detect-krb5-msgtype.c +++ b/src/detect-krb5-msgtype.c @@ -199,7 +199,6 @@ static int DetectKrb5MsgTypeSetup (DetectEngineCtx *de_ctx, Signature *s, const sm->type = DETECT_AL_KRB5_MSGTYPE; sm->ctx = (void *)krb5d; - s->flags |= SIG_FLAG_STATE_MATCH; SigMatchAppendSMToList(s, sm, g_krb5_msg_type_list_id); return 0; diff --git a/src/detect-nfs-procedure.c b/src/detect-nfs-procedure.c index b62d42ad18..a547e7f302 100644 --- a/src/detect-nfs-procedure.c +++ b/src/detect-nfs-procedure.c @@ -364,7 +364,6 @@ static int DetectNfsProcedureSetup (DetectEngineCtx *de_ctx, Signature *s, sm->type = DETECT_AL_NFS_PROCEDURE; sm->ctx = (void *)dd; - s->flags |= SIG_FLAG_STATE_MATCH; SCLogDebug("low %u hi %u", dd->lo, dd->hi); SigMatchAppendSMToList(s, sm, g_nfs_request_buffer_id); return 0; diff --git a/src/detect-nfs-version.c b/src/detect-nfs-version.c index 88e9ae4ad2..72d7ed8c6a 100644 --- a/src/detect-nfs-version.c +++ b/src/detect-nfs-version.c @@ -356,7 +356,6 @@ static int DetectNfsVersionSetup (DetectEngineCtx *de_ctx, Signature *s, sm->type = DETECT_AL_NFS_VERSION; sm->ctx = (void *)dd; - s->flags |= SIG_FLAG_STATE_MATCH; SCLogDebug("low %u hi %u", dd->lo, dd->hi); SigMatchAppendSMToList(s, sm, g_nfs_request_buffer_id); return 0; diff --git a/src/detect-parse.c b/src/detect-parse.c index d3c445a42b..34a3f75881 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -1644,44 +1644,6 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s) SCReturnInt(0); } - //if (s->alproto != ALPROTO_UNKNOWN) { - // if (s->flags & SIG_FLAG_STATE_MATCH) { - // if (s->alproto == ALPROTO_DNS) { - // if (al_proto_table[ALPROTO_DNS_UDP].to_server == 0 || - // al_proto_table[ALPROTO_DNS_UDP].to_client == 0 || - // al_proto_table[ALPROTO_DNS_TCP].to_server == 0 || - // al_proto_table[ALPROTO_DNS_TCP].to_client == 0) { - // SCLogInfo("Signature uses options that need the app layer " - // "parser for dns, but the parser's disabled " - // "for the protocol. Please check if you have " - // "disabled it through the option " - // "\"app-layer.protocols.dcerpc[udp|tcp].enabled\"" - // "or internally the parser has been disabled in " - // "the code. Invalidating signature."); - // SCReturnInt(0); - // } - // } else { - // if (al_proto_table[s->alproto].to_server == 0 || - // al_proto_table[s->alproto].to_client == 0) { - // const char *proto_name = AppProtoToString(s->alproto); - // SCLogInfo("Signature uses options that need the app layer " - // "parser for \"%s\", but the parser's disabled " - // "for the protocol. Please check if you have " - // "disabled it through the option " - // "\"app-layer.protocols.%s.enabled\" or internally " - // "there the parser has been disabled in the code. " - // "Invalidating signature.", proto_name, proto_name); - // SCReturnInt(0); - // } - // } - // } - // - // - // - // - // - //} - if (s->flags & SIG_FLAG_REQUIRE_PACKET) { pm = DetectGetLastSMFromLists(s, DETECT_REPLACE, -1); if (pm != NULL && SigMatchListSMBelongsTo(s, pm) != DETECT_SM_LIST_PMATCH) {