From bf622ae28b9a759161cbe6dda9c425d72408feaa Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Thu, 4 Feb 2021 11:15:14 -0500 Subject: [clean] Fix hostnames not being obfuscated when host plugin wasn't run It was discovered that if a report was generated without the host plugin being run, then the hostname parser would not obfuscate the localhost hostname or domain at all. This was due to the fact that while the default_mapping values were being read into the parser's map's dataset correctly, they weren't being loaded into the 'intermediary' dicts that the parser uses to separate short names from domain names. Fix this by reading the contents of the map's dataset dict (which is populated by the map file) into those intermediary dicts that the parser uses. Additionally, safeguard against overloading domain and host obfuscation numbers when loading this way by setting the respective counts to the next-highest number after the map loading is complete. Resolves: #2406 Signed-off-by: Jake Hunsaker --- tests/cleaner_tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/cleaner_tests.py') diff --git a/tests/cleaner_tests.py b/tests/cleaner_tests.py index 43545126..5510dd80 100644 --- a/tests/cleaner_tests.py +++ b/tests/cleaner_tests.py @@ -24,7 +24,8 @@ class CleanerMapTests(unittest.TestCase): def setUp(self): self.mac_map = SoSMacMap() self.ip_map = SoSIPMap() - self.host_map = SoSHostnameMap(['redhat.com']) + self.host_map = SoSHostnameMap() + self.host_map.load_domains_from_options(['redhat.com']) self.kw_map = SoSKeywordMap() def test_mac_map_obfuscate_valid_v4(self): -- cgit