diff options
author | David Mulder <dmulder@suse.com> | 2020-11-10 08:05:37 -0700 |
---|---|---|
committer | David Mulder <dmulder@samba.org> | 2020-12-09 17:38:28 +0000 |
commit | 5b49e0ac71c2e10b73c8c67f0cb9547b70b8d021 (patch) | |
tree | 9aaf0d38b131be7019d65cbfd95ffd26767e3949 /python/samba/tests/samba_tool | |
parent | f509550f872424a67d4fbc9473c8959e53dffb70 (diff) | |
download | samba-5b49e0ac71c2e10b73c8c67f0cb9547b70b8d021.tar.gz |
samba-tool: Test gpo Security set command
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'python/samba/tests/samba_tool')
-rw-r--r-- | python/samba/tests/samba_tool/gpo.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/python/samba/tests/samba_tool/gpo.py b/python/samba/tests/samba_tool/gpo.py index c170602454a..dcf66f76e1d 100644 --- a/python/samba/tests/samba_tool/gpo.py +++ b/python/samba/tests/samba_tool/gpo.py @@ -546,6 +546,44 @@ class GpoCmdTestCase(SambaToolCmdTest): 'Filling PolicyDefinitions failed') shutil.rmtree(admx_path) + def test_security_set(self): + lp = LoadParm() + lp.load(os.environ['SERVERCONFFILE']) + local_path = lp.get('path', 'sysvol') + inf_pol = os.path.join(local_path, lp.get('realm').lower(), 'Policies', + self.gpo_guid, 'Machine/Microsoft/Windows NT/SecEdit/GptTmpl.inf') + + (result, out, err) = self.runsublevelcmd("gpo", ("manage", "security", + "set"), self.gpo_guid, + 'MaxTicketAge', '10', + "-H", "ldap://%s" % + os.environ["SERVER"], + "-U%s%%%s" % + (os.environ["USERNAME"], + os.environ["PASSWORD"])) + self.assertCmdSuccess(result, out, err, + 'Failed to set MaxTicketAge') + self.assertTrue(os.path.exists(inf_pol), + '%s was not created' % inf_pol) + inf_pol_contents = open(inf_pol, 'r').read() + self.assertIn('MaxTicketAge = 10', inf_pol_contents, + 'The test entry was not found!') + + # Ensure an empty set command deletes the entry + (result, out, err) = self.runsublevelcmd("gpo", ("manage", "security", + "set"), self.gpo_guid, + 'MaxTicketAge', + "-H", "ldap://%s" % + os.environ["SERVER"], + "-U%s%%%s" % + (os.environ["USERNAME"], + os.environ["PASSWORD"])) + self.assertCmdSuccess(result, out, err, + 'Failed to unset MaxTicketAge') + inf_pol_contents = open(inf_pol, 'r').read() + self.assertNotIn('MaxTicketAge = 10', inf_pol_contents, + 'The test entry was still found!') + def test_sudoers_remove(self): lp = LoadParm() lp.load(os.environ['SERVERCONFFILE']) |