From 1c38d0e34068f38256baa01b6dc91f8ee202da37 Mon Sep 17 00:00:00 2001 From: Lukas Sismis Date: Wed, 23 Aug 2023 13:32:26 +0200 Subject: [PATCH] tests: add a test for bug 6278 tests include: - non-existent user - NULL user (empty user string) --- tests/bug-6278-1/suricata.yaml | 5 +++++ tests/bug-6278-1/test.yaml | 12 ++++++++++++ tests/bug-6278-2/suricata.yaml | 6 ++++++ tests/bug-6278-2/test.yaml | 17 +++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 tests/bug-6278-1/suricata.yaml create mode 100644 tests/bug-6278-1/test.yaml create mode 100644 tests/bug-6278-2/suricata.yaml create mode 100644 tests/bug-6278-2/test.yaml diff --git a/tests/bug-6278-1/suricata.yaml b/tests/bug-6278-1/suricata.yaml new file mode 100644 index 000000000..0ec8a4c7b --- /dev/null +++ b/tests/bug-6278-1/suricata.yaml @@ -0,0 +1,5 @@ +%YAML 1.1 +--- + +run-as: + user: totally-not-existing-user diff --git a/tests/bug-6278-1/test.yaml b/tests/bug-6278-1/test.yaml new file mode 100644 index 000000000..4f6635427 --- /dev/null +++ b/tests/bug-6278-1/test.yaml @@ -0,0 +1,12 @@ +requires: + min-version: 6 + +pcap: false +exit-code: 1 +args: + - --engine-analysis + +checks: + - shell: + args: grep -c 'unable to get the user ID' stderr + expect: 1 \ No newline at end of file diff --git a/tests/bug-6278-2/suricata.yaml b/tests/bug-6278-2/suricata.yaml new file mode 100644 index 000000000..9581e25c6 --- /dev/null +++ b/tests/bug-6278-2/suricata.yaml @@ -0,0 +1,6 @@ +%YAML 1.1 +--- + +run-as: + user: # null user + group: diff --git a/tests/bug-6278-2/test.yaml b/tests/bug-6278-2/test.yaml new file mode 100644 index 000000000..b4312e197 --- /dev/null +++ b/tests/bug-6278-2/test.yaml @@ -0,0 +1,17 @@ +requires: + min-version: 6 + +pcap: false +exit-code: 1 +args: + - --engine-analysis + +checks: + - shell: + args: grep -c 'user name cannot be set to an empty value' stderr + expect: 1 + version: 7 + - shell: + args: grep -c 'unable to get the user ID' stderr + expect: 1 + version: 6 \ No newline at end of file