From 5d611f1cd9edd680432c0ca5fcd7965341ae9352 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Nov 26 2018 17:28:25 +0000 Subject: Ticket 49814 - dscreate should handle selinux ports that are in a range Description: If the server port is within a selinux policy range do not try to add or remove the port as it will cause a failure during removal (even though the removal actually worked) https://pagure.io/389-ds-base/issue/49814 Reviewed by: spichugi(Thanks!) --- diff --git a/src/lib389/lib389/utils.py b/src/lib389/lib389/utils.py index 2dc3c5a..02967b9 100644 --- a/src/lib389/lib389/utils.py +++ b/src/lib389/lib389/utils.py @@ -198,6 +198,11 @@ def selinux_label_port(port, remove_label=False): for policy in policies: if "ldap_port_t" == policy['type']: label_set = True # Port already has our label + if policy['low'] != policy['high']: + # We have a range + if port in range(policy['low'], policy['high'] + 1): + # The port is within the range, just return + return break else: # Port belongs to someone else (bad)