mirror of
https://github.com/SELinuxProject/selinux
synced 2025-04-24 19:58:02 +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):
|
def info(setype, name=None):
|
||||||
if setype == TYPE:
|
if setype == TYPE:
|
||||||
q = setools.TypeQuery(_pol)
|
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 ({
|
return ({
|
||||||
'aliases': list(map(str, x.aliases())),
|
'aliases': list(map(str, x.aliases())),
|
||||||
'name': str(x),
|
'name': str(x),
|
||||||
'permissive': bool(x.ispermissive),
|
'permissive': bool(x.ispermissive),
|
||||||
'attributes': list(map(str, x.attributes()))
|
'attributes': list(map(str, x.attributes()))
|
||||||
} for x in q.results())
|
} for x in results)
|
||||||
|
|
||||||
elif setype == ROLE:
|
elif setype == ROLE:
|
||||||
q = setools.RoleQuery(_pol)
|
q = setools.RoleQuery(_pol)
|
||||||
|
Loading…
Reference in New Issue
Block a user