]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
CVE-2020-10704: ldapserver tests: Python 2 comaptibility
authorGary Lockyer <gary@catalyst.net.nz>
Wed, 15 Apr 2020 22:49:29 +0000 (10:49 +1200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 21 Apr 2020 08:21:09 +0000 (10:21 +0200)
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 <gary@catalyst.net.nz>
python/samba/tests/ldap_raw.py

index 334fabce230e1c88b9389eeefa9223fa949041c1..2e55f785c884a8be075163934202495a70fe7416 100644 (file)
@@ -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, ""