diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2022-10-27 18:00:28 +0200 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2022-10-28 11:19:26 -0400 |
commit | 21101d80610c43a7c00de3dfaa5ff043d1f8324a (patch) | |
tree | 238a84898f2b18b1a4ea2097b9008e5c77495911 /tests | |
parent | 814c3283bdaa7b8a10ccea88cef40ac47005cf44 (diff) | |
download | sos-21101d80610c43a7c00de3dfaa5ff043d1f8324a.tar.gz |
[cleaner] Apply compile_regexes after a regular parse line
Hostname parser treats strings like 'host.domain.com' with precompiled
domain 'domain.com' in a wrong way. It first obfuscates the domain while
subsequent _parse_line skips host obfuscation.
Calling _parse_line before _parse_line_with_compiled_regexes does clean
both the host name and the domain name well.
Adding a unittest with a reproducer.
Resolves: #3054
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/cleaner_tests.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/unittests/cleaner_tests.py b/tests/unittests/cleaner_tests.py index d27481c1..9759b38a 100644 --- a/tests/unittests/cleaner_tests.py +++ b/tests/unittests/cleaner_tests.py @@ -172,6 +172,13 @@ class CleanerParserTests(unittest.TestCase): _test = self.host_parser.parse_line(line)[0] self.assertNotEqual(line, _test) + def test_obfuscate_whole_fqdn_for_given_domainname(self): + self.host_parser.load_hostname_into_map('sostestdomain.domain') + line = 'let obfuscate soshost.sostestdomain.domain' + _test = self.host_parser.parse_line(line)[0] + self.assertFalse('soshost' in _test) + self.assertFalse('sostestdomain' in _test) + def test_hostname_no_obfuscate_underscore(self): line = 'pam_env.so _why.not_' _test = self.host_parser.parse_line(line)[0] |