From b65fc010314aa40fcd2871058139b1d20468a1ed Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 17 Aug 2018 17:02:45 +0100 Subject: [PATCH 8/9] Add more test coverage for config file parsing minimal.conf is a valid config file added to make it obvious why the new invalid config files are invalid. Signed-off-by: Simon McVittie --- test/Makefile.am | 22 +++++++++++++++++++ .../apparmor-bad-attribute.conf | 4 ++++ .../apparmor-bad-mode.conf | 4 ++++ .../invalid-config-files/bad-attribute-2.conf | 3 +++ .../invalid-config-files/bad-attribute.conf | 4 ++++ .../invalid-config-files/bad-element.conf | 4 ++++ test/data/invalid-config-files/bad-limit.conf | 4 ++++ .../double-attribute.conf | 4 ++++ .../invalid-config-files/limit-no-name.conf | 4 ++++ .../invalid-config-files/ludicrous-limit.conf | 5 +++++ .../invalid-config-files/negative-limit.conf | 4 ++++ .../non-numeric-limit.conf | 4 ++++ .../policy-bad-at-console.conf | 4 ++++ .../policy-bad-attribute.conf | 4 ++++ .../policy-bad-context.conf | 4 ++++ .../policy-bad-rule-attribute.conf | 6 +++++ .../policy-contradiction.conf | 4 ++++ .../policy-member-no-path.conf | 6 +++++ .../invalid-config-files/policy-mixed.conf | 6 +++++ .../policy-no-attributes.conf | 4 ++++ .../policy-no-rule-attribute.conf | 6 +++++ .../invalid-config-files/unknown-limit.conf | 4 ++++ .../valid-config-files-system/many-rules.conf | 5 +++++ test/data/valid-config-files/minimal.conf | 3 +++ 24 files changed, 122 insertions(+) create mode 100644 test/data/invalid-config-files/apparmor-bad-attribute.conf create mode 100644 test/data/invalid-config-files/apparmor-bad-mode.conf create mode 100644 test/data/invalid-config-files/bad-attribute-2.conf create mode 100644 test/data/invalid-config-files/bad-attribute.conf create mode 100644 test/data/invalid-config-files/bad-element.conf create mode 100644 test/data/invalid-config-files/bad-limit.conf create mode 100644 test/data/invalid-config-files/double-attribute.conf create mode 100644 test/data/invalid-config-files/limit-no-name.conf create mode 100644 test/data/invalid-config-files/ludicrous-limit.conf create mode 100644 test/data/invalid-config-files/negative-limit.conf create mode 100644 test/data/invalid-config-files/non-numeric-limit.conf create mode 100644 test/data/invalid-config-files/policy-bad-at-console.conf create mode 100644 test/data/invalid-config-files/policy-bad-attribute.conf create mode 100644 test/data/invalid-config-files/policy-bad-context.conf create mode 100644 test/data/invalid-config-files/policy-bad-rule-attribute.conf create mode 100644 test/data/invalid-config-files/policy-contradiction.conf create mode 100644 test/data/invalid-config-files/policy-member-no-path.conf create mode 100644 test/data/invalid-config-files/policy-mixed.conf create mode 100644 test/data/invalid-config-files/policy-no-attributes.conf create mode 100644 test/data/invalid-config-files/policy-no-rule-attribute.conf create mode 100644 test/data/invalid-config-files/unknown-limit.conf create mode 100644 test/data/valid-config-files/minimal.conf diff --git a/test/Makefile.am b/test/Makefile.am index 2f338913..f373585c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -500,15 +500,36 @@ static_data = \ data/equiv-config-files/entities/basic.d/basic.conf \ data/equiv-config-files/entities/entities-1.conf \ data/equiv-config-files/entities/entities-2.conf \ + data/invalid-config-files/apparmor-bad-attribute.conf \ + data/invalid-config-files/apparmor-bad-mode.conf \ + data/invalid-config-files/bad-attribute.conf \ + data/invalid-config-files/bad-attribute-2.conf \ + data/invalid-config-files/bad-element.conf \ + data/invalid-config-files/bad-limit.conf \ data/invalid-config-files/badselinux-1.conf \ data/invalid-config-files/badselinux-2.conf \ data/invalid-config-files/circular-1.conf \ data/invalid-config-files/circular-2.conf \ data/invalid-config-files/circular-3.conf \ + data/invalid-config-files/double-attribute.conf \ data/invalid-config-files/impossible-send.conf \ + data/invalid-config-files/limit-no-name.conf \ + data/invalid-config-files/ludicrous-limit.conf \ + data/invalid-config-files/negative-limit.conf \ + data/invalid-config-files/non-numeric-limit.conf \ data/invalid-config-files/not-well-formed.conf \ + data/invalid-config-files/policy-bad-at-console.conf \ + data/invalid-config-files/policy-bad-attribute.conf \ + data/invalid-config-files/policy-bad-context.conf \ + data/invalid-config-files/policy-bad-rule-attribute.conf \ + data/invalid-config-files/policy-contradiction.conf \ + data/invalid-config-files/policy-member-no-path.conf \ + data/invalid-config-files/policy-mixed.conf \ + data/invalid-config-files/policy-no-attributes.conf \ + data/invalid-config-files/policy-no-rule-attribute.conf \ data/invalid-config-files/truncated-file.conf \ data/invalid-config-files/send-and-receive.conf \ + data/invalid-config-files/unknown-limit.conf \ data/invalid-messages/boolean-has-no-value.message-raw \ data/sha-1/Readme.txt \ data/sha-1/bit-hashes.sha1 \ @@ -527,6 +548,7 @@ static_data = \ data/valid-config-files/entities.conf \ data/valid-config-files/listen-unix-runtime.conf \ data/valid-config-files/many-rules.conf \ + data/valid-config-files/minimal.conf \ data/valid-config-files/standard-session-dirs.conf \ data/valid-config-files-system/many-rules.conf \ data/valid-config-files-system/system.d/test.conf \ diff --git a/test/data/invalid-config-files/apparmor-bad-attribute.conf b/test/data/invalid-config-files/apparmor-bad-attribute.conf new file mode 100644 index 00000000..16a10e8a --- /dev/null +++ b/test/data/invalid-config-files/apparmor-bad-attribute.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + + diff --git a/test/data/invalid-config-files/apparmor-bad-mode.conf b/test/data/invalid-config-files/apparmor-bad-mode.conf new file mode 100644 index 00000000..2398ee53 --- /dev/null +++ b/test/data/invalid-config-files/apparmor-bad-mode.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + + diff --git a/test/data/invalid-config-files/bad-attribute-2.conf b/test/data/invalid-config-files/bad-attribute-2.conf new file mode 100644 index 00000000..cc430f54 --- /dev/null +++ b/test/data/invalid-config-files/bad-attribute-2.conf @@ -0,0 +1,3 @@ + + tcp:port=1234 + diff --git a/test/data/invalid-config-files/bad-attribute.conf b/test/data/invalid-config-files/bad-attribute.conf new file mode 100644 index 00000000..993dd3cf --- /dev/null +++ b/test/data/invalid-config-files/bad-attribute.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + 5000 + diff --git a/test/data/invalid-config-files/bad-element.conf b/test/data/invalid-config-files/bad-element.conf new file mode 100644 index 00000000..77067ebd --- /dev/null +++ b/test/data/invalid-config-files/bad-element.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + + diff --git a/test/data/invalid-config-files/bad-limit.conf b/test/data/invalid-config-files/bad-limit.conf new file mode 100644 index 00000000..9b7b3177 --- /dev/null +++ b/test/data/invalid-config-files/bad-limit.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + as many as you like + diff --git a/test/data/invalid-config-files/double-attribute.conf b/test/data/invalid-config-files/double-attribute.conf new file mode 100644 index 00000000..514fda40 --- /dev/null +++ b/test/data/invalid-config-files/double-attribute.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + 5000 + diff --git a/test/data/invalid-config-files/limit-no-name.conf b/test/data/invalid-config-files/limit-no-name.conf new file mode 100644 index 00000000..390a4af1 --- /dev/null +++ b/test/data/invalid-config-files/limit-no-name.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + + diff --git a/test/data/invalid-config-files/ludicrous-limit.conf b/test/data/invalid-config-files/ludicrous-limit.conf new file mode 100644 index 00000000..d78f0b5d --- /dev/null +++ b/test/data/invalid-config-files/ludicrous-limit.conf @@ -0,0 +1,5 @@ + + tcp:port=1234 + + 3123123123 + diff --git a/test/data/invalid-config-files/negative-limit.conf b/test/data/invalid-config-files/negative-limit.conf new file mode 100644 index 00000000..de10d1a2 --- /dev/null +++ b/test/data/invalid-config-files/negative-limit.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + -1 + diff --git a/test/data/invalid-config-files/non-numeric-limit.conf b/test/data/invalid-config-files/non-numeric-limit.conf new file mode 100644 index 00000000..99b4429e --- /dev/null +++ b/test/data/invalid-config-files/non-numeric-limit.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + bees + diff --git a/test/data/invalid-config-files/policy-bad-at-console.conf b/test/data/invalid-config-files/policy-bad-at-console.conf new file mode 100644 index 00000000..1994cb91 --- /dev/null +++ b/test/data/invalid-config-files/policy-bad-at-console.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + + diff --git a/test/data/invalid-config-files/policy-bad-attribute.conf b/test/data/invalid-config-files/policy-bad-attribute.conf new file mode 100644 index 00000000..03baeb08 --- /dev/null +++ b/test/data/invalid-config-files/policy-bad-attribute.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + + diff --git a/test/data/invalid-config-files/policy-bad-context.conf b/test/data/invalid-config-files/policy-bad-context.conf new file mode 100644 index 00000000..18ac25e0 --- /dev/null +++ b/test/data/invalid-config-files/policy-bad-context.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + + diff --git a/test/data/invalid-config-files/policy-bad-rule-attribute.conf b/test/data/invalid-config-files/policy-bad-rule-attribute.conf new file mode 100644 index 00000000..b28a7b30 --- /dev/null +++ b/test/data/invalid-config-files/policy-bad-rule-attribute.conf @@ -0,0 +1,6 @@ + + tcp:port=1234 + + + + diff --git a/test/data/invalid-config-files/policy-contradiction.conf b/test/data/invalid-config-files/policy-contradiction.conf new file mode 100644 index 00000000..88bd73f6 --- /dev/null +++ b/test/data/invalid-config-files/policy-contradiction.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + + diff --git a/test/data/invalid-config-files/policy-member-no-path.conf b/test/data/invalid-config-files/policy-member-no-path.conf new file mode 100644 index 00000000..9e6c89fd --- /dev/null +++ b/test/data/invalid-config-files/policy-member-no-path.conf @@ -0,0 +1,6 @@ + + tcp:port=1234 + + + + diff --git a/test/data/invalid-config-files/policy-mixed.conf b/test/data/invalid-config-files/policy-mixed.conf new file mode 100644 index 00000000..5549f239 --- /dev/null +++ b/test/data/invalid-config-files/policy-mixed.conf @@ -0,0 +1,6 @@ + + tcp:port=1234 + + + + diff --git a/test/data/invalid-config-files/policy-no-attributes.conf b/test/data/invalid-config-files/policy-no-attributes.conf new file mode 100644 index 00000000..d10c4964 --- /dev/null +++ b/test/data/invalid-config-files/policy-no-attributes.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + + diff --git a/test/data/invalid-config-files/policy-no-rule-attribute.conf b/test/data/invalid-config-files/policy-no-rule-attribute.conf new file mode 100644 index 00000000..08ae4376 --- /dev/null +++ b/test/data/invalid-config-files/policy-no-rule-attribute.conf @@ -0,0 +1,6 @@ + + tcp:port=1234 + + + + diff --git a/test/data/invalid-config-files/unknown-limit.conf b/test/data/invalid-config-files/unknown-limit.conf new file mode 100644 index 00000000..43f8b290 --- /dev/null +++ b/test/data/invalid-config-files/unknown-limit.conf @@ -0,0 +1,4 @@ + + tcp:port=1234 + 5000 + diff --git a/test/data/valid-config-files-system/many-rules.conf b/test/data/valid-config-files-system/many-rules.conf index 8537fd90..8e893065 100644 --- a/test/data/valid-config-files-system/many-rules.conf +++ b/test/data/valid-config-files-system/many-rules.conf @@ -26,6 +26,7 @@ + @@ -46,6 +47,10 @@ + + + + 5000 5000 300 diff --git a/test/data/valid-config-files/minimal.conf b/test/data/valid-config-files/minimal.conf new file mode 100644 index 00000000..3fd2d341 --- /dev/null +++ b/test/data/valid-config-files/minimal.conf @@ -0,0 +1,3 @@ + + tcp:port=1234 + -- 2.19.0.rc1