From fdc00bf95f5ad45ddffc8f1ab31ecd577e25518d Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Thu, 16 Apr 2020 10:49:29 +1200 Subject: [PATCH] CVE-2020-10704: ldapserver tests: Python 2 comaptibility The test python/samba/tests/ldap_raw.py does not run under python 3 which means the CI task build_ad_dc_py2 fails. The test is run and passes in the CI task build_ad_dc. This patch adds a check for the Python version and skips the tests if running under python 2, allowing CI to run for V4.10. This patch is only applied to version 4.10. Signed-off-by: Gary Lockyer --- python/samba/tests/ldap_raw.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/python/samba/tests/ldap_raw.py b/python/samba/tests/ldap_raw.py index 334fabce230..2e55f785c88 100644 --- a/python/samba/tests/ldap_raw.py +++ b/python/samba/tests/ldap_raw.py @@ -19,6 +19,7 @@ # import socket +import sys import samba.tests from samba.tests import TestCase @@ -162,6 +163,13 @@ class RawLdapTest(TestCase): ''' Check that an LDAP search request equal to the maximum size is accepted ''' + # + # Test is not compatable with python 2 so skip it for the + # backports. + # + if sys.version_info < (3, 0): + self.skipTest("Test is not python2 compatable") + return # Lets build an ldap search packet to query the RootDSE header = encode_string(None) # Base DN, "" @@ -200,6 +208,13 @@ class RawLdapTest(TestCase): Test that a search query longer than the maximum permitted size is rejected. ''' + # + # Test is not compatable with python 2 so skip it for the + # backports. + # + if sys.version_info < (3, 0): + self.skipTest("Test is not python2 compatable") + return # Lets build an ldap search packet to query the RootDSE header = encode_string(None) # Base DN, "" -- 2.47.2