pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0194-Fix-local-IP-address-validation.patch

ac7d03
From 935029c3192221c480c88b870a507cfac4c4b954 Mon Sep 17 00:00:00 2001
ac7d03
From: Martin Basti <mbasti@redhat.com>
ac7d03
Date: Tue, 13 Jun 2017 17:03:30 +0200
ac7d03
Subject: [PATCH] Fix local IP address validation
ac7d03
ac7d03
Previously bf9886a84393d1d1546db7e49b102e08a16a83e7 match_local has
ac7d03
undesirable side effect that CheckedIPAddress object has set self._net
ac7d03
from local interface.
ac7d03
ac7d03
However with the recent changes, match_local is usually set to False,
ac7d03
thus this side effect stops happening and default mask per address class
ac7d03
is used. This causes validation error because mask on interface and mask
ac7d03
used for provided IP addresses differ (reporducible only with classless
ac7d03
masks).
ac7d03
ac7d03
FreeIPA should compare only IP addresses with local addresses without masks
ac7d03
ac7d03
https://pagure.io/freeipa/issue/4317
ac7d03
ac7d03
Reviewed-By: David Kupka <dkupka@redhat.com>
ac7d03
---
ac7d03
 ipapython/ipautil.py | 6 +++---
ac7d03
 1 file changed, 3 insertions(+), 3 deletions(-)
ac7d03
ac7d03
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
ac7d03
index a277ed87473f3c591f34fcc00e1159f3bbfe3e9b..647ee833ae33f246de6d6b13703fac6e20eef7bc 100644
ac7d03
--- a/ipapython/ipautil.py
ac7d03
+++ b/ipapython/ipautil.py
ac7d03
@@ -216,10 +216,10 @@ class CheckedIPAddress(UnsafeIPAddress):
ac7d03
                     addr=ifaddr,
ac7d03
                     netmask=ifdata['netmask']
ac7d03
                 ))
ac7d03
-                if ifnet == self._net or (
ac7d03
-                                self._net is None and ifnet.ip == self):
ac7d03
-                    self._net = ifnet
ac7d03
+
ac7d03
+                if ifnet.ip == self:
ac7d03
                     iface = interface
ac7d03
+                    self._net = ifnet
ac7d03
                     break
ac7d03
 
ac7d03
         return iface
ac7d03
-- 
ac7d03
2.9.4
ac7d03