GPO: Test rsop output for smb.conf policy
authorDavid Mulder <dmulder@suse.com>
Wed, 19 Aug 2020 19:02:48 +0000 (13:02 -0600)
committerDavid Mulder <dmulder@samba.org>
Thu, 27 Aug 2020 15:59:34 +0000 (15:59 +0000)
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/tests/gpo.py
selftest/knownfail.d/gpo [new file with mode: 0644]

index 7bc6ff0a9b60ffca9b7a5ada272194001c221b8e..a2c1cd9de97c1963506c5d599e9723b66d08c8f1 100644 (file)
@@ -485,6 +485,7 @@ class GPOTests(tests.TestCase):
         gp_extensions.append(gp_krb_ext)
         gp_extensions.append(gp_scripts_ext)
         gp_extensions.append(gp_sudoers_ext)
+        gp_extensions.append(gp_smb_conf_ext)
 
         # Create registry stage data
         reg_pol = os.path.join(local_path, policies, '%s/MACHINE/REGISTRY.POL')
@@ -499,8 +500,13 @@ class GPOTests(tests.TestCase):
         e2.valuename = b'Software\\Policies\\Samba\\Unix Settings'
         e2.type = 1
         e2.data = b'fakeu  ALL=(ALL) NOPASSWD: ALL'
-        reg_stage.num_entries = 2
-        reg_stage.entries = [e, e2]
+        e3 = preg.entry()
+        e3.keyname = 'Software\\Policies\\Samba\\smb_conf\\apply group policies'
+        e3.type = 4
+        e3.data = 1
+        e3.valuename = 'apply group policies'
+        reg_stage.num_entries = 3
+        reg_stage.entries = [e, e2, e3]
 
         # Create krb stage date
         gpofile = os.path.join(local_path, policies, '%s/MACHINE/MICROSOFT/' \
@@ -541,6 +547,14 @@ class GPOTests(tests.TestCase):
                     self.assertIn('fakeu  ALL=(ALL) NOPASSWD: ALL',
                                   ret['Sudo Rights'],
                                   'Sudoers policy not created')
+                # Check the smb.conf Extension
+                elif type(ext) == gp_smb_conf_ext:
+                    self.assertIn('smb.conf', ret.keys(),
+                                  'apply group policies was not applied')
+                    self.assertIn(e3.valuename, ret['smb.conf'],
+                                  'apply group policies was not applied')
+                    self.assertEquals(ret['smb.conf'][e3.valuename], e3.data,
+                                      'apply group policies was not set')
             unstage_file(gpofile % g.name)
             unstage_file(reg_pol % g.name)
 
diff --git a/selftest/knownfail.d/gpo b/selftest/knownfail.d/gpo
new file mode 100644 (file)
index 0000000..b1c8285
--- /dev/null
@@ -0,0 +1 @@
+samba.tests.gpo.samba.tests.gpo.GPOTests.test_rsop