...
 
Commits (2)
salt (2018.3.4+dfsg1-5) unstable; urgency=medium
* Cherry-pick upstream patch to fix edge case when minion ID is a
16-character string (Closes: #928337)
-- Benjamin Drung <benjamin.drung@cloud.ionos.com> Thu, 02 May 2019 13:23:44 +0200
salt (2018.3.4+dfsg1-4) unstable; urgency=medium
* Cherry-pick upstream patch to fix retrieving systemd version (for 241-3)
......
From 1fcb0ff2641f6ed61a95ee55008c8059367ed167 Mon Sep 17 00:00:00 2001
From: Erik Johnson <palehose@gmail.com>
Date: Wed, 23 Jan 2019 14:21:52 -0600
Subject: [PATCH] Fix edge case when minion ID is a 16-character string
Some code in salt._compat which checks if the value is a packed binary
representation of an IPv6 address fails if the value passed is not a
bytestring (i.e. a `unicode` type on PY2 or `str` type on PY3). This
fixes that code when the minion ID is a 16-character string (not a
bytestring). Note that the minion ID will never be a bytestring as of
2018.3.0, so this affects any 16-character minion ID when the minion ID
is checked to see if it is really an IP address.
Closes: #928337
Origin: upstream, https://github.com/saltstack/salt/pull/51931
---
salt/_compat.py | 9 +--------
tests/unit/utils/test_network.py | 9 +++++++++
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/salt/_compat.py b/salt/_compat.py
index 8d38f38230..3d208bae0b 100644
--- a/salt/_compat.py
+++ b/salt/_compat.py
@@ -189,7 +182,7 @@ class IPv6AddressScoped(ipaddress.IPv6Address):
:return:
'''
packed = False
- if len(data) == 16 and ':' not in data:
+ if isinstance(data, bytes) and len(data) == 16 and b':' not in data:
try:
packed = bool(int(str(bytearray(data)).encode('hex'), 16))
except ValueError:
diff --git a/tests/unit/utils/test_network.py b/tests/unit/utils/test_network.py
index cc785a655b..6a691fe0d4 100644
--- a/tests/unit/utils/test_network.py
+++ b/tests/unit/utils/test_network.py
@@ -185,11 +185,17 @@ class NetworkTestCase(TestCase):
def test_is_ip(self):
self.assertTrue(network.is_ip('10.10.0.3'))
self.assertFalse(network.is_ip('0.9.800.1000'))
+ # Check 16-char-long unicode string
+ # https://github.com/saltstack/salt/issues/51258
+ self.assertFalse(network.is_ipv6('sixteen-char-str'))
def test_is_ipv4(self):
self.assertTrue(network.is_ipv4('10.10.0.3'))
self.assertFalse(network.is_ipv4('10.100.1'))
self.assertFalse(network.is_ipv4('2001:db8:0:1:1:1:1:1'))
+ # Check 16-char-long unicode string
+ # https://github.com/saltstack/salt/issues/51258
+ self.assertFalse(network.is_ipv4('sixteen-char-str'))
def test_is_ipv6(self):
self.assertTrue(network.is_ipv6('2001:db8:0:1:1:1:1:1'))
@@ -202,6 +208,9 @@ class NetworkTestCase(TestCase):
self.assertFalse(network.is_ipv6('2001:0db8:::0370:7334'))
self.assertFalse(network.is_ipv6('10.0.1.2'))
self.assertFalse(network.is_ipv6('2001.0db8.85a3.0000.0000.8a2e.0370.7334'))
+ # Check 16-char-long unicode string
+ # https://github.com/saltstack/salt/issues/51258
+ self.assertFalse(network.is_ipv6('sixteen-char-str'))
def test_parse_host_port(self):
_ip = ipaddress.ip_address
--
2.20.1
gitfs-Fix-use-of-deprecated-pygit2-function.patch
Fix-retrieve-systemd-version-using-regex.patch
Fix-edge-case-when-minion-ID-is-a-16-character-string.patch
prevent_intersphinx_network_access.patch
Make-the-Salt-Proxy-environment-aware.patch
remove-privacy-breach.patch
......