]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect-tls-cert-serial: add warning if nocase is used
authorMats Klepsland <mats.klepsland@gmail.com>
Sat, 24 Mar 2018 22:07:04 +0000 (23:07 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 3 May 2018 12:50:47 +0000 (14:50 +0200)
src/detect-tls-cert-serial.c

index 17a2e340e15bd02ba101aca8404c2593b143cf7c..3ae70875f782458f140d1168558576ddc3fd13a7 100644 (file)
@@ -153,7 +153,14 @@ static _Bool DetectTlsSerialValidateCallback(const Signature *s,
         if (sm->type != DETECT_CONTENT)
             continue;
 
-        DetectContentData *cd = (DetectContentData *)sm->ctx;
+        const DetectContentData *cd = (DetectContentData *)sm->ctx;
+
+        if (cd->flags & DETECT_CONTENT_NOCASE) {
+            *sigerror = "tls_cert_serial should not be used together "
+                        "with nocase, since the rule is automatically "
+                        "uppercased anyway which makes nocase redundant.";
+            SCLogWarning(SC_WARN_POOR_RULE, "rule %u: %s", s->id, *sigerror);
+        }
 
         /* no need to worry about this if the content is short enough */
         if (cd->content_len <= 2)