]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: remove the AMATCH list
authorVictor Julien <victor@inliniac.net>
Thu, 22 Dec 2016 19:31:38 +0000 (20:31 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 16 Feb 2017 09:35:42 +0000 (10:35 +0100)
src/detect-app-layer-protocol.c
src/detect-dce-stub-data.c
src/detect-engine.c
src/detect-parse.c
src/detect.c
src/detect.h

index 7e4560ffacbf44a2fbd29fad51c5c67322dd855a..5761d2b87ddd8ced0a7f9cc921e2aa0a4daea40e 100644 (file)
@@ -355,7 +355,6 @@ static int DetectAppLayerProtocolTest04(void)
     FAIL_IF(s->alproto != ALPROTO_UNKNOWN);
     FAIL_IF(s->flags & SIG_FLAG_APPLAYER);
 
-    FAIL_IF_NOT(s->sm_lists[DETECT_SM_LIST_AMATCH] == NULL);
     FAIL_IF_NULL(s->sm_lists[DETECT_SM_LIST_MATCH]);
     FAIL_IF_NULL(s->sm_lists[DETECT_SM_LIST_MATCH]->ctx);
 
@@ -382,7 +381,6 @@ static int DetectAppLayerProtocolTest05(void)
     FAIL_IF(s->alproto != ALPROTO_UNKNOWN);
     FAIL_IF(s->flags & SIG_FLAG_APPLAYER);
 
-    FAIL_IF_NOT(s->sm_lists[DETECT_SM_LIST_AMATCH] == NULL);
     FAIL_IF_NULL(s->sm_lists[DETECT_SM_LIST_MATCH]);
     FAIL_IF_NULL(s->sm_lists[DETECT_SM_LIST_MATCH]->ctx);
 
index 418ab8fcafe9a4fc4336b193281a76c1b1a8dd54..bc4831ebb3fe8ad5c6422495535f5b7f6b51013c 100644 (file)
@@ -110,7 +110,6 @@ static int DetectDceStubDataTestParse01(void)
     Signature *s = DetectEngineAppendSig(de_ctx,
             "alert tcp any any -> any any (dce_stub_data; content:\"1\"; sid:1;)");
     FAIL_IF_NULL(s);
-    FAIL_IF_NOT_NULL(s->sm_lists[DETECT_SM_LIST_AMATCH]);
     FAIL_IF_NULL(s->sm_lists[DETECT_SM_LIST_DMATCH]);
     DetectEngineCtxFree(de_ctx);
     PASS;
index 24da4209060553c04ccd5b74db4acb08f661dafb..b8ed69605824fcef72b525a41382bdae265e769f 100644 (file)
@@ -2906,8 +2906,6 @@ const char *DetectSigmatchListEnumToString(enum DetectSigmatchListEnum type)
         case DETECT_SM_LIST_PMATCH:
             return "packet/stream payload";
 
-        case DETECT_SM_LIST_AMATCH:
-            return "generic app layer";
         case DETECT_SM_LIST_DMATCH:
             return "dcerpc";
         case DETECT_SM_LIST_TMATCH:
index 64aaff96e53a9adadb691fa3e42921d81ec20fa5..7bce331188baca59ab5587a223ed45f9c8af6a68 100644 (file)
@@ -141,7 +141,6 @@ const char *DetectListToHumanString(int list)
     switch (list) {
         CASE_CODE_STRING(DETECT_SM_LIST_MATCH, "packet");
         CASE_CODE_STRING(DETECT_SM_LIST_PMATCH, "payload");
-        CASE_CODE_STRING(DETECT_SM_LIST_AMATCH, "app-layer");
         CASE_CODE_STRING(DETECT_SM_LIST_DMATCH, "dcerpc");
         CASE_CODE_STRING(DETECT_SM_LIST_TMATCH, "tag");
         CASE_CODE_STRING(DETECT_SM_LIST_POSTMATCH, "postmatch");
@@ -159,7 +158,6 @@ const char *DetectListToString(int list)
     switch (list) {
         CASE_CODE(DETECT_SM_LIST_MATCH);
         CASE_CODE(DETECT_SM_LIST_PMATCH);
-        CASE_CODE(DETECT_SM_LIST_AMATCH);
         CASE_CODE(DETECT_SM_LIST_DMATCH);
         CASE_CODE(DETECT_SM_LIST_TMATCH);
         CASE_CODE(DETECT_SM_LIST_POSTMATCH);
@@ -1461,19 +1459,6 @@ int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
         }
     }
 
-    for (sm = s->init_data->smlists[DETECT_SM_LIST_AMATCH]; sm != NULL; sm = sm->next) {
-        if (sm->type != DETECT_AL_APP_LAYER_PROTOCOL)
-            continue;
-        if (((DetectAppLayerProtocolData *)sm->ctx)->negated)
-            break;
-    }
-    if (sm != NULL && s->alproto != ALPROTO_UNKNOWN) {
-        SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "We can't have "
-                   "the rule match on a fixed alproto and at the same time"
-                   "have an app-layer-protocol keyword set.");
-        SCReturnInt(0);
-    }
-
     /* TCP: pkt vs stream vs depth/offset */
     if (s->proto.proto[IPPROTO_TCP / 8] & (1 << (IPPROTO_TCP % 8))) {
         if (!(s->flags & (SIG_FLAG_REQUIRE_PACKET | SIG_FLAG_REQUIRE_STREAM))) {
@@ -1613,13 +1598,8 @@ static Signature *SigInitHelper(DetectEngineCtx *de_ctx, char *sigstr,
         }
     }
 
-    if (sig->init_data->smlists[DETECT_SM_LIST_AMATCH] != NULL)
-        sig->flags |= SIG_FLAG_APPLAYER;
-
     if (sig->init_data->smlists[DETECT_SM_LIST_DMATCH])
         sig->flags |= SIG_FLAG_STATE_MATCH;
-    if (sig->init_data->smlists[DETECT_SM_LIST_AMATCH])
-        sig->flags |= SIG_FLAG_STATE_MATCH;
     /* for other lists this flag is set when the inspect engines
      * are registered */
 
index 8f34641d8aabcdabd09e62fd295ee2be817307de..bd58de6567de51174268ccd329bdff441d403115 100644 (file)
@@ -1914,9 +1914,6 @@ int SignatureIsIPOnly(DetectEngineCtx *de_ctx, const Signature *s)
     if (s->init_data->smlists[DETECT_SM_LIST_PMATCH] != NULL)
         return 0;
 
-    if (s->init_data->smlists[DETECT_SM_LIST_AMATCH] != NULL)
-        return 0;
-
     /* for now assume that all registered buffer types are incompatible */
     const int nlists = DetectBufferTypeMaxId();
     for (int i = 0; i < nlists; i++) {
@@ -1986,9 +1983,6 @@ static int SignatureIsPDOnly(const Signature *s)
     if (s->init_data->smlists[DETECT_SM_LIST_PMATCH] != NULL)
         return 0;
 
-    if (s->init_data->smlists[DETECT_SM_LIST_AMATCH] != NULL)
-        return 0;
-
     /* for now assume that all registered buffer types are incompatible */
     const int nlists = DetectBufferTypeMaxId();
     for (int i = 0; i < nlists; i++) {
@@ -2084,8 +2078,7 @@ static int SignatureIsDEOnly(DetectEngineCtx *de_ctx, const Signature *s)
         SCReturnInt(0);
     }
 
-    if (s->init_data->smlists[DETECT_SM_LIST_PMATCH] != NULL ||
-        s->init_data->smlists[DETECT_SM_LIST_AMATCH] != NULL)
+    if (s->init_data->smlists[DETECT_SM_LIST_PMATCH] != NULL)
     {
         SCReturnInt(0);
     }
@@ -2239,19 +2232,6 @@ static int SignatureCreateMask(Signature *s)
     }
 
     SigMatch *sm;
-    for (sm = s->init_data->smlists[DETECT_SM_LIST_AMATCH] ; sm != NULL; sm = sm->next) {
-        switch(sm->type) {
-            case DETECT_AL_URILEN:
-            case DETECT_AL_HTTP_URI:
-                s->mask |= SIG_MASK_REQUIRE_HTTP_STATE;
-                SCLogDebug("sig requires dce http state");
-                break;
-            case DETECT_AL_APP_LAYER_EVENT:
-                s->mask |= SIG_MASK_REQUIRE_ENGINE_EVENT;
-                break;
-        }
-    }
-
     for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) {
         switch(sm->type) {
             case DETECT_FLOWBITS:
@@ -2390,11 +2370,6 @@ static int SignatureCreateMask(Signature *s)
         SCLogDebug("sig requires flow");
     }
 
-    if (s->init_data->smlists[DETECT_SM_LIST_AMATCH] != NULL) {
-        s->mask |= SIG_MASK_REQUIRE_FLOW;
-        SCLogDebug("sig requires flow");
-    }
-
     if (s->flags & SIG_FLAG_APPLAYER) {
         s->mask |= SIG_MASK_REQUIRE_FLOW;
         SCLogDebug("sig requires flow");
index f448f7163a10602c2a650b8921d05765209f9f85..0580fa779af8efa6fa048f4980c62429bbab0760 100644 (file)
@@ -88,9 +88,6 @@ enum DetectSigmatchListEnum {
     DETECT_SM_LIST_MATCH = 0,
     DETECT_SM_LIST_PMATCH,
 
-    /* list for per flow matches. Deprecated. */
-    DETECT_SM_LIST_AMATCH,
-
     /* list for DCE matches */
     DETECT_SM_LIST_DMATCH,