1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

gpo: Test that empty Security sections are removed

Ensure that empty sections are removed when
calling samba-tool gpo manage security set.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
David Mulder 2021-02-09 11:06:40 -07:00 committed by Jeremy Allison
parent 551532d007
commit c27c97ab55
2 changed files with 36 additions and 0 deletions

View File

@ -692,6 +692,41 @@ class GpoCmdTestCase(SambaToolCmdTest):
self.assertCmdSuccess(result, out, err,
'Failed to unset MaxTicketAge')
def test_security_nonempty_sections(self):
lp = LoadParm()
lp.load(os.environ['SERVERCONFFILE'])
local_path = lp.get('path', 'sysvol')
gpt_inf = 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')
(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_data = ConfigParser(interpolation=None)
inf_data.read(gpt_inf)
self.assertFalse(inf_data.has_section('Kerberos Policy'))
def test_sudoers_remove(self):
lp = LoadParm()
lp.load(os.environ['SERVERCONFFILE'])

1
selftest/knownfail.d/gpo Normal file
View File

@ -0,0 +1 @@
^samba.tests.samba_tool.gpo.samba.tests.samba_tool.gpo.GpoCmdTestCase.test_security_nonempty_sections