]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gpo: Ensure empty Security sections are removed
authorDavid Mulder <dmulder@suse.com>
Fri, 11 Dec 2020 17:38:32 +0000 (10:38 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 11 Feb 2021 17:21:33 +0000 (17:21 +0000)
Failing to remove the empty section causes tests
to fail, and is also just bad practice.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
python/samba/netcmd/gpo.py
selftest/knownfail.d/gpo [deleted file]

index a0629feb4cd3a85a26c6ee419b94f9bd59a23bfa..33069200a447e37e39da47cf56b61e3de26e6a18 100644 (file)
@@ -1986,6 +1986,8 @@ PasswordComplexity      Password must meet complexity requirements
             inf_data.set(section, policy, value)
         else:
             inf_data.remove_option(section, policy)
+            if len(inf_data.options(section)) == 0:
+                inf_data.remove_section(section)
 
         out = StringIO()
         inf_data.write(out)
diff --git a/selftest/knownfail.d/gpo b/selftest/knownfail.d/gpo
deleted file mode 100644 (file)
index f01f38d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba.tests.samba_tool.gpo.samba.tests.samba_tool.gpo.GpoCmdTestCase.test_security_nonempty_sections