From 554f2134a9f9638ebd8ac2500e5b6c94b74c27d5 Mon Sep 17 00:00:00 2001
From: David Mulder <dmulder@suse.com>
Date: Tue, 9 Mar 2021 12:30:14 -0700
Subject: [PATCH] samba-gpupdate: Test that sysvol paths download in
 case-insensitive way
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14665

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Björn Baumbach <bb@sernet.de>
---
 python/samba/tests/gpo.py | 10 ++++++++++
 selftest/knownfail.d/gpo  |  1 +
 2 files changed, 11 insertions(+)
 create mode 100644 selftest/knownfail.d/gpo

diff --git a/python/samba/tests/gpo.py b/python/samba/tests/gpo.py
index dfd2394f353..b5d195b0445 100644
--- a/python/samba/tests/gpo.py
+++ b/python/samba/tests/gpo.py
@@ -188,6 +188,16 @@ class GPOTests(tests.TestCase):
         self.assertEqual(result, after, 'check_safe_path() didn\'t'
                           ' correctly convert \\ to /')
 
+    def test_check_safe_path_typesafe_name(self):
+        path = '\\\\toady.suse.de\\SysVol\\toady.suse.de\\Policies\\' \
+               '{31B2F340-016D-11D2-945F-00C04FB984F9}\\GPT.INI'
+        expected_path = 'toady.suse.de/Policies/' \
+                        '{31B2F340-016D-11D2-945F-00C04FB984F9}/GPT.INI'
+
+        result = check_safe_path(path)
+        self.assertEqual(result, expected_path,
+            'check_safe_path unable to detect variable case sysvol components')
+
     def test_gpt_ext_register(self):
         this_path = os.path.dirname(os.path.realpath(__file__))
         samba_path = os.path.realpath(os.path.join(this_path, '../../../'))
diff --git a/selftest/knownfail.d/gpo b/selftest/knownfail.d/gpo
new file mode 100644
index 00000000000..a1c0ac474df
--- /dev/null
+++ b/selftest/knownfail.d/gpo
@@ -0,0 +1 @@
+^samba.tests.gpo.samba.tests.gpo.GPOTests.test_check_safe_path_typesafe_name