From a9e653ca36a0829ae59cd204e7388d7a6c91e082 Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Fri, 13 Sep 2024 09:58:36 +0200 Subject: [PATCH] UnsafeIPAddress: pass flag=0 to IPNetwork When parsing a string, the constructor tries to parse the value as an IP Address first, or falls back to an IPNetwork with the flags INET_PTON. Use the flag 0 instead for an IPNetwork. Fixes: https://pagure.io/freeipa/issue/9645 Signed-off-by: Florence Blanc-Renaud Reviewed-By: Alexander Bokovoy --- ipapython/ipautil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index 3e98bfd6a66f24933e7e4de8efb79f4f5bf8bd0e..c237d59fb4b8be4187fb0efb04b097ff4df6c182 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -119,7 +119,7 @@ class UnsafeIPAddress(netaddr.IPAddress): if addr.version != 6: raise except ValueError: - self._net = netaddr.IPNetwork(addr, flags=self.netaddr_ip_flags) + self._net = netaddr.IPNetwork(addr, flags=0) addr = self._net.ip super(UnsafeIPAddress, self).__init__(addr, flags=self.netaddr_ip_flags) -- 2.46.2