Patch: fix seports to allow integers or string (#65134)

Signed-off-by: Joshua Schmidlkofer <joshua@joshuainnovates.us>
This commit is contained in:
Joshua Schmidlkofer 2019-12-12 00:45:33 -08:00 committed by Abhijeet Kasurde
parent 4a54873023
commit 570c82f068

View file

@ -156,9 +156,13 @@ def semanage_port_get_type(seport, port, proto):
:rtype: tuple :rtype: tuple
:return: Tuple containing the SELinux type and MLS/MCS level, or None if not found. :return: Tuple containing the SELinux type and MLS/MCS level, or None if not found.
""" """
ports = port.split('-', 1) if isinstance(port, str):
if len(ports) == 1: ports = port.split('-', 1)
ports.extend(ports) if len(ports) == 1:
ports.extend(ports)
else:
ports = (port, port)
key = (int(ports[0]), int(ports[1]), proto) key = (int(ports[0]), int(ports[1]), proto)
records = seport.get_all() records = seport.get_all()