mirror of
https://github.com/SELinuxProject/selinux
synced 2025-04-11 04:01:46 +00:00
python/sepolicy: Fix "info" to search aliases as well
Restore previous behaviour of "sepolicy.info()". Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
This commit is contained in:
parent
d3c359ee82
commit
448f5a9257
@ -168,15 +168,21 @@ except ValueError as e:
|
||||
def info(setype, name=None):
|
||||
if setype == TYPE:
|
||||
q = setools.TypeQuery(_pol)
|
||||
if name:
|
||||
q.name = name
|
||||
q.name = name
|
||||
results = list(q.results())
|
||||
|
||||
if name and len(results) < 1:
|
||||
# type not found, try alias
|
||||
q.name = None
|
||||
q.alias = name
|
||||
results = list(q.results())
|
||||
|
||||
return ({
|
||||
'aliases': list(map(str, x.aliases())),
|
||||
'name': str(x),
|
||||
'permissive': bool(x.ispermissive),
|
||||
'attributes': list(map(str, x.attributes()))
|
||||
} for x in q.results())
|
||||
} for x in results)
|
||||
|
||||
elif setype == ROLE:
|
||||
q = setools.RoleQuery(_pol)
|
||||
|
Loading…
Reference in New Issue
Block a user