From 350a3eeebfb1ca0b042f3fced92a3c0f134e7768 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Fri, 25 Aug 2023 13:56:21 +1200 Subject: [PATCH] python: Fix invalid escape sequences Origin: upstream, https://gitlab.com/samba-team/samba/-/commit/b068592dd0dccce634cb17b66f0659ba60523908 Comment: mjt: remove 1 hunk from python/samba/tests/gpo.py not present in 4.19 Bug-Debian: https://bugs.debian.org/1057668 Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett Gbp-Pq: Name python-fix-invalid-escape-sequences.patch --- python/samba/gp/gp_cert_auto_enroll_ext.py | 6 +- python/samba/graph.py | 2 +- python/samba/tests/gpo.py | 64 +++++++++++----------- python/samba/tests/samba_tool/gpo.py | 2 +- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/python/samba/gp/gp_cert_auto_enroll_ext.py b/python/samba/gp/gp_cert_auto_enroll_ext.py index 312c8ddf..b924652a 100644 --- a/python/samba/gp/gp_cert_auto_enroll_ext.py +++ b/python/samba/gp/gp_cert_auto_enroll_ext.py @@ -316,7 +316,7 @@ def cert_enroll(ca, ldb, trust_dir, private_dir, auth='Kerberos'): class gp_cert_auto_enroll_ext(gp_pol_ext, gp_applier): def __str__(self): - return 'Cryptography\AutoEnrollment' + return r'Cryptography\AutoEnrollment' def unapply(self, guid, attribute, value): ca_cn = base64.b64decode(attribute) @@ -368,7 +368,7 @@ class gp_cert_auto_enroll_ext(gp_pol_ext, gp_applier): for gpo in changed_gpo_list: if gpo.file_sys_path: - section = 'Software\Policies\Microsoft\Cryptography\AutoEnrollment' + section = r'Software\Policies\Microsoft\Cryptography\AutoEnrollment' pol_file = 'MACHINE/Registry.pol' path = os.path.join(gpo.file_sys_path, pol_file) pol_conf = self.parse(path) @@ -488,7 +488,7 @@ class gp_cert_auto_enroll_ext(gp_pol_ext, gp_applier): def rsop(self, gpo): output = {} pol_file = 'MACHINE/Registry.pol' - section = 'Software\Policies\Microsoft\Cryptography\AutoEnrollment' + section = r'Software\Policies\Microsoft\Cryptography\AutoEnrollment' if gpo.file_sys_path: path = os.path.join(gpo.file_sys_path, pol_file) pol_conf = self.parse(path) diff --git a/python/samba/graph.py b/python/samba/graph.py index 537dc661..4c4a07f4 100644 --- a/python/samba/graph.py +++ b/python/samba/graph.py @@ -192,7 +192,7 @@ def compile_graph_key(key_items, nodes_above=None, elisions=None, short = short[1:] long = long[1:] elision_str += ('\nelision%d[shape=plaintext; style=solid; ' - 'label="\“%s” means “%s”\\r"]\n' + 'label="\\“%s” means “%s”\\r"]\n' % ((i, short, long))) above_lines = [] diff --git a/python/samba/tests/gpo.py b/python/samba/tests/gpo.py index e4b75cc6..d19a8ab6 100644 --- a/python/samba/tests/gpo.py +++ b/python/samba/tests/gpo.py @@ -123,7 +123,7 @@ dspath = 'CN=Policies,CN=System,' + base_dn gpt_data = '[General]\nVersion=%d' gnome_test_reg_pol = \ -b""" +br""" @@ -260,7 +260,7 @@ b""" """ auto_enroll_reg_pol = \ -b""" +br""" @@ -282,7 +282,7 @@ b""" """ advanced_enroll_reg_pol = \ -b""" +br""" @@ -316,122 +316,122 @@ b""" 0 - Software\Policies\Microsoft\Cryptography\PolicyServers\\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 + Software\Policies\Microsoft\Cryptography\PolicyServers\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 URL LDAP: - Software\Policies\Microsoft\Cryptography\PolicyServers\\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 + Software\Policies\Microsoft\Cryptography\PolicyServers\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 PolicyID %s - Software\Policies\Microsoft\Cryptography\PolicyServers\\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 + Software\Policies\Microsoft\Cryptography\PolicyServers\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 FriendlyName Example - Software\Policies\Microsoft\Cryptography\PolicyServers\\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 + Software\Policies\Microsoft\Cryptography\PolicyServers\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 Flags 16 - Software\Policies\Microsoft\Cryptography\PolicyServers\\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 + Software\Policies\Microsoft\Cryptography\PolicyServers\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 AuthFlags 2 - Software\Policies\Microsoft\Cryptography\PolicyServers\\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 + Software\Policies\Microsoft\Cryptography\PolicyServers\37c9dc30f207f27f61a2f7c3aed598a6e2920b54 Cost 2147483645 - Software\Policies\Microsoft\Cryptography\PolicyServers\\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe + Software\Policies\Microsoft\Cryptography\PolicyServers\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe URL https://example2.com/ADPolicyProvider_CEP_Certificate/service.svc/CEP - Software\Policies\Microsoft\Cryptography\PolicyServers\\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe + Software\Policies\Microsoft\Cryptography\PolicyServers\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe PolicyID %s - Software\Policies\Microsoft\Cryptography\PolicyServers\\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe + Software\Policies\Microsoft\Cryptography\PolicyServers\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe FriendlyName Example2 - Software\Policies\Microsoft\Cryptography\PolicyServers\\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe + Software\Policies\Microsoft\Cryptography\PolicyServers\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe Flags 16 - Software\Policies\Microsoft\Cryptography\PolicyServers\\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe + Software\Policies\Microsoft\Cryptography\PolicyServers\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe AuthFlags 8 - Software\Policies\Microsoft\Cryptography\PolicyServers\\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe + Software\Policies\Microsoft\Cryptography\PolicyServers\144bdbb8e4717c26e408f3c9a0cb8d6cfacbcbbe Cost 10 - Software\Policies\Microsoft\Cryptography\PolicyServers\\20d46e856e9b9746c0b1265c328f126a7b3283a9 + Software\Policies\Microsoft\Cryptography\PolicyServers\20d46e856e9b9746c0b1265c328f126a7b3283a9 URL https://example0.com/ADPolicyProvider_CEP_Kerberos/service.svc/CEP - Software\Policies\Microsoft\Cryptography\PolicyServers\\20d46e856e9b9746c0b1265c328f126a7b3283a9 + Software\Policies\Microsoft\Cryptography\PolicyServers\20d46e856e9b9746c0b1265c328f126a7b3283a9 PolicyID %s - Software\Policies\Microsoft\Cryptography\PolicyServers\\20d46e856e9b9746c0b1265c328f126a7b3283a9 + Software\Policies\Microsoft\Cryptography\PolicyServers\20d46e856e9b9746c0b1265c328f126a7b3283a9 FriendlyName Example0 - Software\Policies\Microsoft\Cryptography\PolicyServers\\20d46e856e9b9746c0b1265c328f126a7b3283a9 + Software\Policies\Microsoft\Cryptography\PolicyServers\20d46e856e9b9746c0b1265c328f126a7b3283a9 Flags 16 - Software\Policies\Microsoft\Cryptography\PolicyServers\\20d46e856e9b9746c0b1265c328f126a7b3283a9 + Software\Policies\Microsoft\Cryptography\PolicyServers\20d46e856e9b9746c0b1265c328f126a7b3283a9 AuthFlags 2 - Software\Policies\Microsoft\Cryptography\PolicyServers\\20d46e856e9b9746c0b1265c328f126a7b3283a9 + Software\Policies\Microsoft\Cryptography\PolicyServers\20d46e856e9b9746c0b1265c328f126a7b3283a9 Cost 1 - Software\Policies\Microsoft\Cryptography\PolicyServers\\855b5246433a48402ac4f5c3427566df26ccc9ac + Software\Policies\Microsoft\Cryptography\PolicyServers\855b5246433a48402ac4f5c3427566df26ccc9ac URL https://example1.com/ADPolicyProvider_CEP_Kerberos/service.svc/CEP - Software\Policies\Microsoft\Cryptography\PolicyServers\\855b5246433a48402ac4f5c3427566df26ccc9ac + Software\Policies\Microsoft\Cryptography\PolicyServers\855b5246433a48402ac4f5c3427566df26ccc9ac PolicyID %s - Software\Policies\Microsoft\Cryptography\PolicyServers\\855b5246433a48402ac4f5c3427566df26ccc9ac + Software\Policies\Microsoft\Cryptography\PolicyServers\855b5246433a48402ac4f5c3427566df26ccc9ac FriendlyName Example1 - Software\Policies\Microsoft\Cryptography\PolicyServers\\855b5246433a48402ac4f5c3427566df26ccc9ac + Software\Policies\Microsoft\Cryptography\PolicyServers\855b5246433a48402ac4f5c3427566df26ccc9ac Flags 16 - Software\Policies\Microsoft\Cryptography\PolicyServers\\855b5246433a48402ac4f5c3427566df26ccc9ac + Software\Policies\Microsoft\Cryptography\PolicyServers\855b5246433a48402ac4f5c3427566df26ccc9ac AuthFlags 2 - Software\Policies\Microsoft\Cryptography\PolicyServers\\855b5246433a48402ac4f5c3427566df26ccc9ac + Software\Policies\Microsoft\Cryptography\PolicyServers\855b5246433a48402ac4f5c3427566df26ccc9ac Cost 1 @@ -2094,7 +2094,7 @@ firefox_json_expected = \ """ chromium_reg_pol = \ -b""" +br""" @@ -2990,12 +2990,12 @@ b""" Software\Policies\Google\Chrome RestrictSigninToPattern - .*@example\\.com + .*@example\.com Software\Policies\Google\Chrome RoamingProfileLocation - ${roaming_app_data}\\chrome-profile + ${roaming_app_data}\chrome-profile Software\Policies\Google\Chrome @@ -3245,7 +3245,7 @@ b""" Software\Policies\Google\Chrome\AlternativeBrowserParameters 5 - %HOME%\\browser_profile + %HOME%\browser_profile Software\Policies\Google\Chrome\AudioCaptureAllowedUrls @@ -4951,7 +4951,7 @@ b""" """ firewalld_reg_pol = \ -b""" +br""" diff --git a/python/samba/tests/samba_tool/gpo.py b/python/samba/tests/samba_tool/gpo.py index e49944c2..654f254d 100644 --- a/python/samba/tests/samba_tool/gpo.py +++ b/python/samba/tests/samba_tool/gpo.py @@ -1806,7 +1806,7 @@ class GpoCmdTestCase(SambaToolCmdTest): 'The test cse was not enabled') self.assertIn('UserPolicy : False', out, 'The test cse should not have User policy enabled') - cse_ext = re.findall('^UniqueGUID\s+:\s+(.*)', out) + cse_ext = re.findall(r'^UniqueGUID\s+:\s+(.*)', out) self.assertEquals(len(cse_ext), 1, 'The test cse GUID was not found') cse_ext = cse_ext[0] -- 2.30.2