Skip to content

Commit ac90929

Browse files
committed
semanage: list all ports even if not attributed with port_type
Show also ports which are not attributed with `port_type`. Such ports may exist in custom policies and even the attribute `port_type` may not be defined. This fixes the following error: Traceback (most recent call last): File "/usr/sbin/semanage", line 975, in <module> do_parser() File "/usr/sbin/semanage", line 947, in do_parser args.func(args) File "/usr/sbin/semanage", line 441, in handlePort OBJECT = object_dict['port'](args) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/seobject.py", line 1057, in __init__ self.valid_types = list(list(sepolicy.info(sepolicy.ATTRIBUTE, "port_type"))[0]["types"]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^ IndexError: list index out of range Signed-off-by: Topi Miettinen <[email protected]>
1 parent 820f019 commit ac90929

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/semanage/seobject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ class portRecords(semanageRecords):
10551055
def __init__(self, args = None):
10561056
semanageRecords.__init__(self, args)
10571057
try:
1058-
self.valid_types = list(list(sepolicy.info(sepolicy.ATTRIBUTE, "port_type"))[0]["types"])
1058+
self.valid_types = list(list(sepolicy.info(sepolicy.PORT))[0]["type"])
10591059
except RuntimeError:
10601060
pass
10611061

0 commit comments

Comments
 (0)