]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
uricontent: move debug func into unittests
authorVictor Julien <victor@inliniac.net>
Tue, 23 Oct 2018 12:43:35 +0000 (14:43 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 1 Nov 2018 14:46:10 +0000 (15:46 +0100)
Cleanup header, which lead to the app-layer-htp.h header needing to
be added in a few other places.

src/app-layer-detect-proto.c
src/detect-bypass.c
src/detect-filestore.c
src/detect-lua.c
src/detect-parse.c
src/detect-uricontent.c
src/detect-uricontent.h

index c0c0d21678d013620d5074d8d48a99777abb3dd5..acb769a0718e88f380013d08d05e2c8c4bb24bd0 100644 (file)
@@ -1873,6 +1873,8 @@ void AppLayerProtoDetectSupportedAppProtocols(AppProto *alprotos)
 
 #ifdef UNITTESTS
 
+#include "app-layer-htp.h"
+
 static AppLayerProtoDetectCtx alpd_ctx_ut;
 
 void AppLayerProtoDetectUnittestCtxBackup(void)
index f415d65299f5589ac8bdd50bbef66f98584a69d3..cd672a916050c12be962475c5a2375f260a87e40 100644 (file)
@@ -101,6 +101,8 @@ static int DetectBypassMatch(ThreadVars *tv, DetectEngineThreadCtx *det_ctx, Pac
 }
 
 #ifdef UNITTESTS
+#include "app-layer-htp.h"
+
 static int callback_var = 0;
 
 static int BypassCallback(Packet *p)
index 7edf8b7d01684c0703f6a60f2aedafa78cc6de05..221e8595d4765e6c3007afe3c5f3195c8c3a0307 100644 (file)
@@ -46,6 +46,7 @@
 
 #include "app-layer.h"
 #include "app-layer-parser.h"
+#include "app-layer-htp.h"
 
 #include "stream-tcp.h"
 
index 1e3c4c6c7cc014162c079e9a062d0ccd161bb7b9..cd15c32a5a63bb69c28cb68f211a36930ce8feec 100644 (file)
@@ -49,6 +49,7 @@
 
 #include "app-layer.h"
 #include "app-layer-parser.h"
+#include "app-layer-htp.h"
 
 #include "stream-tcp.h"
 
index 00428374be2d218918291ec31b4feeeda51a4cb4..d208694a4d1c701a707aee32cdc56eafdb1b9b53 100644 (file)
@@ -58,6 +58,7 @@
 #include "app-layer.h"
 #include "app-layer-protos.h"
 #include "app-layer-parser.h"
+#include "app-layer-htp.h"
 
 #include "util-classification-config.h"
 #include "util-unittest.h"
index 4886bacccb65e697ff1e3962ad539dc95ddd78a2..8663387832f4d690d814e8c0d3ff3186b16c3378 100644 (file)
@@ -97,50 +97,6 @@ void DetectUricontentFree(void *ptr)
     SCReturn;
 }
 
-/**
- * \brief Helper function to print a DetectContentData
- */
-void DetectUricontentPrint(DetectContentData *cd)
-{
-    int i = 0;
-    if (cd == NULL) {
-        SCLogDebug("Detect UricontentData \"cd\" is NULL");
-        return;
-    }
-    char *tmpstr = SCMalloc(sizeof(char) * cd->content_len + 1);
-    if (unlikely(tmpstr == NULL))
-        return;
-
-    if (tmpstr != NULL) {
-        for (i = 0; i < cd->content_len; i++) {
-            if (isprint(cd->content[i]))
-                tmpstr[i] = cd->content[i];
-            else
-                tmpstr[i] = '.';
-        }
-        tmpstr[i] = '\0';
-        SCLogDebug("Uricontent: \"%s\"", tmpstr);
-        SCFree(tmpstr);
-    } else {
-        SCLogDebug("Uricontent: ");
-        for (i = 0; i < cd->content_len; i++)
-            SCLogDebug("%c", cd->content[i]);
-    }
-
-    SCLogDebug("Uricontent_id: %"PRIu32, cd->id);
-    SCLogDebug("Uricontent_len: %"PRIu16, cd->content_len);
-    SCLogDebug("Depth: %"PRIu16, cd->depth);
-    SCLogDebug("Offset: %"PRIu16, cd->offset);
-    SCLogDebug("Within: %"PRIi32, cd->within);
-    SCLogDebug("Distance: %"PRIi32, cd->distance);
-    SCLogDebug("flags: %u ", cd->flags);
-    SCLogDebug("negated: %s ",
-            cd->flags & DETECT_CONTENT_NEGATED ? "true" : "false");
-    SCLogDebug("relative match next: %s ",
-            cd->flags & DETECT_CONTENT_RELATIVE_NEXT ? "true" : "false");
-    SCLogDebug("-----------");
-}
-
 /**
  * \brief Creates a SigMatch for the uricontent keyword being sent as argument,
  *        and appends it to the Signature(s).
@@ -195,6 +151,50 @@ error:
 #include "detect-isdataat.h"
 #include "stream-tcp-reassemble.h"
 
+/**
+ * \brief Helper function to print a DetectContentData
+ */
+static void DetectUricontentPrint(DetectContentData *cd)
+{
+    int i = 0;
+    if (cd == NULL) {
+        SCLogDebug("Detect UricontentData \"cd\" is NULL");
+        return;
+    }
+    char *tmpstr = SCMalloc(sizeof(char) * cd->content_len + 1);
+    if (unlikely(tmpstr == NULL))
+        return;
+
+    if (tmpstr != NULL) {
+        for (i = 0; i < cd->content_len; i++) {
+            if (isprint(cd->content[i]))
+                tmpstr[i] = cd->content[i];
+            else
+                tmpstr[i] = '.';
+        }
+        tmpstr[i] = '\0';
+        SCLogDebug("Uricontent: \"%s\"", tmpstr);
+        SCFree(tmpstr);
+    } else {
+        SCLogDebug("Uricontent: ");
+        for (i = 0; i < cd->content_len; i++)
+            SCLogDebug("%c", cd->content[i]);
+    }
+
+    SCLogDebug("Uricontent_id: %"PRIu32, cd->id);
+    SCLogDebug("Uricontent_len: %"PRIu16, cd->content_len);
+    SCLogDebug("Depth: %"PRIu16, cd->depth);
+    SCLogDebug("Offset: %"PRIu16, cd->offset);
+    SCLogDebug("Within: %"PRIi32, cd->within);
+    SCLogDebug("Distance: %"PRIi32, cd->distance);
+    SCLogDebug("flags: %u ", cd->flags);
+    SCLogDebug("negated: %s ",
+            cd->flags & DETECT_CONTENT_NEGATED ? "true" : "false");
+    SCLogDebug("relative match next: %s ",
+            cd->flags & DETECT_CONTENT_RELATIVE_NEXT ? "true" : "false");
+    SCLogDebug("-----------");
+}
+
 /** \test Test case where path traversal has been sent as a path string in the
  *        HTTP URL and normalized path string is checked */
 static int HTTPUriTest01(void)
index 1729e58f3e3d88c9dda50c637974dfc2dd3f1d9b..289afff33a4f2be32464373cf7ff2fce47ac9680 100644 (file)
 #ifndef __DETECT_URICONTENT_H__
 #define __DETECT_URICONTENT_H__
 
-#include "detect-content.h"
-
-#include "app-layer-htp.h"
-
 /* prototypes */
 void DetectUricontentRegister (void);
-void DetectUricontentPrint(DetectContentData *);
 
 #endif /* __DETECT_URICONTENT_H__ */