mirror of
https://github.com/samba-team/samba.git
synced 2025-12-20 16:23:51 +03:00
gpo: Add tests to make sure that an empty gplink works
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13564 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Andrew Bartlett
parent
5514b98f1d
commit
bcb0270c6b
@@ -19,6 +19,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import ldb
|
||||||
import samba
|
import samba
|
||||||
from samba.tests.samba_tool.base import SambaToolCmdTest
|
from samba.tests.samba_tool.base import SambaToolCmdTest
|
||||||
import shutil
|
import shutil
|
||||||
@@ -113,6 +114,39 @@ class GpoCmdTestCase(SambaToolCmdTest):
|
|||||||
(result, out, err) = self.runsubcmd("gpo", "aclcheck", "-H", "ldap://%s" % os.environ["SERVER"], "-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"]))
|
(result, out, err) = self.runsubcmd("gpo", "aclcheck", "-H", "ldap://%s" % os.environ["SERVER"], "-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"]))
|
||||||
self.assertCmdSuccess(result, out, err, "Ensuring gpo checked successfully")
|
self.assertCmdSuccess(result, out, err, "Ensuring gpo checked successfully")
|
||||||
|
|
||||||
|
def test_getlink_empty(self):
|
||||||
|
self.samdb = self.getSamDB("-H", "ldap://%s" % os.environ["DC_SERVER"],
|
||||||
|
"-U%s%%%s" % (os.environ["DC_USERNAME"],
|
||||||
|
os.environ["DC_PASSWORD"]))
|
||||||
|
|
||||||
|
container_dn = 'OU=gpo_test_link,%s' % self.samdb.get_default_basedn()
|
||||||
|
|
||||||
|
self.samdb.add({
|
||||||
|
'dn': container_dn,
|
||||||
|
'objectClass': 'organizationalUnit'
|
||||||
|
})
|
||||||
|
|
||||||
|
(result, out, err) = self.runsubcmd("gpo", "getlink", container_dn,
|
||||||
|
"-H", "ldap://%s" % os.environ["SERVER"],
|
||||||
|
"-U%s%%%s" % (os.environ["USERNAME"],
|
||||||
|
os.environ["PASSWORD"]))
|
||||||
|
self.assertCmdSuccess(result, out, err, "Ensuring gpo link fetched successfully")
|
||||||
|
|
||||||
|
# Microsoft appears to allow an empty space character after deletion of
|
||||||
|
# a GPO. We should be able to handle this.
|
||||||
|
m = ldb.Message()
|
||||||
|
m.dn = ldb.Dn(self.samdb, container_dn)
|
||||||
|
m['gPLink'] = ldb.MessageElement(' ', ldb.FLAG_MOD_REPLACE, 'gPLink')
|
||||||
|
self.samdb.modify(m)
|
||||||
|
|
||||||
|
(result, out, err) = self.runsubcmd("gpo", "getlink", container_dn,
|
||||||
|
"-H", "ldap://%s" % os.environ["SERVER"],
|
||||||
|
"-U%s%%%s" % (os.environ["USERNAME"],
|
||||||
|
os.environ["PASSWORD"]))
|
||||||
|
self.assertCmdSuccess(result, out, err, "Ensuring gpo link fetched successfully")
|
||||||
|
|
||||||
|
self.samdb.delete(container_dn)
|
||||||
|
|
||||||
def test_backup_restore_compare_binary(self):
|
def test_backup_restore_compare_binary(self):
|
||||||
"""Restore from a static backup and compare the binary contents"""
|
"""Restore from a static backup and compare the binary contents"""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user