]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
issue 2551: python3 issue loading disable.conf 41/head
authorJason Ish <ish@unx.ca>
Mon, 23 Jul 2018 22:02:19 +0000 (16:02 -0600)
committerJason Ish <ish@unx.ca>
Mon, 23 Jul 2018 22:11:36 +0000 (16:11 -0600)
... and likely other related files.

The failing disable.conf has been added to the integration
tests.

Issue:
https://redmine.openinfosecfoundation.org/issues/2551

CHANGELOG.md
suricata/update/main.py
tests/integration_tests.py
tests/test_matchers.py

index a9293ac5ea1daea36362661f1ae003bcf189ed08..bf2914f73dbd47b563c7d36cff810ead1014dff4 100644 (file)
@@ -5,6 +5,8 @@
   https://redmine.openinfosecfoundation.org/issues/2549
 - Fix interactive input for add-source command.
   https://redmine.openinfosecfoundation.org/issues/2550
+- Python fix for loading disable.conf (and other files).
+  https://redmine.openinfosecfoundation.org/issues/2551
 
 ## 1.0.0rc1 - 2018-07-17
 - Python 3 fixes.
index e4c64baee86da8b94792c186c87e365d65a10185..2bdf197c61366becf79e822ed3ecfc848150236f 100644 (file)
@@ -469,7 +469,7 @@ def parse_matchers(fileobj):
     matchers = []
 
     for line in fileobj:
-        line = line.decode().strip()
+        line = line.strip()
         if not line or line.startswith("#"):
             continue
         line = line.rsplit(" #")[0]
index f104e80870e54cf744f737905ffe6cbb76c206da..0c61e62def843e4d53c6a19ce6d5c67ad3fb4c5a 100755 (executable)
@@ -36,7 +36,8 @@ common_args = [
 common_update_args = [
     "--no-test",
     "--no-reload",
-    "--disable-conf", "./tests/empty",
+    "--suricata-conf", "./tests/suricata.yaml",
+    "--disable-conf", "./tests/disable.conf",
     "--enable-conf", "./tests/empty",
     "--drop-conf", "./tests/empty",
     "--modify-conf", "./tests/empty",
index c0df407532c3c742f17ad999dedfe0adf1424d23..f7966bb96d19fb929260e8b4c04201de9e532259 100644 (file)
@@ -56,10 +56,10 @@ class LoadMatchersTestCase(unittest.TestCase):
 
     def test_trailing_comment(self):
         """Test loading matchers with a trailing comment."""
-        matchers = main.parse_matchers(io.BytesIO("""filename: */trojan.rules
+        matchers = main.parse_matchers(io.StringIO(u"""filename: */trojan.rules
 re:.# This is a comment*
 1:100 # Trailing comment.
-""".encode()))
+"""))
         self.assertEquals(
             matchers[0].__class__, suricata.update.main.FilenameMatcher)
         self.assertEquals(