From c55edb36ca68a783f7b61d306e81163b8d464325 Mon Sep 17 00:00:00 2001 From: Vit Mojzis Date: Aug 30 2019 11:13:31 +0000 Subject: framework: Fix AVC.__typeMatch to handle aliases properly Fixes: Aliases where not evaluated properly when used as arguments of avc.matches_*_types() As a result plugins where no longer triggered if a type they specified was transformed to an alias. --- diff --git a/framework/src/setroubleshoot/audit_data.py b/framework/src/setroubleshoot/audit_data.py index 0d07911..9185c85 100644 --- a/framework/src/setroubleshoot/audit_data.py +++ b/framework/src/setroubleshoot/audit_data.py @@ -732,9 +732,18 @@ class AVC: return False def __typeMatch(self, context, type_list): + # get array of context type and it's aliases + try: + _info = info(TYPE, context.type)[0] + ctypes = _info.get('aliases', []) + ctypes.append(_info['name']) + except (RuntimeError, IndexError): + ctypes = [context.type] + for type in type_list: - if re.match(type, context.type): - return True + for t in ctypes: + if re.match(type, t): + return True return False def matches_source_types(self, type_list):