From: David Mulder Date: Wed, 26 Aug 2020 16:06:21 +0000 (-0600) Subject: samba-tool: Demote computer to wellknown container X-Git-Tag: tevent-0.11.0~244 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=151f432ca8c173e7bad488dfbd507517908102da;p=thirdparty%2Fsamba.git samba-tool: Demote computer to wellknown container BUG: https://bugzilla.samba.org/show_bug.cgi?id=9143 Signed-off-by: David Mulder Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index eccae4e2f75..de6f2b0ca1d 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -107,6 +107,7 @@ from samba.netcmd.domain_backup import cmd_domain_backup from samba.common import get_string from samba.trust_utils import CreateTrustedDomainRelax +from samba import dsdb string_version_to_constant = { "2008_R2": DS_DOMAIN_FUNCTION_2008_R2, @@ -902,7 +903,9 @@ class cmd_domain_demote(Command): i = 0 newrdn = str(rdn) - computer_dn = ldb.Dn(remote_samdb, "CN=Computers,%s" % str(remote_samdb.domain_dn())) + computer_dn = remote_samdb.get_wellknown_dn( + remote_samdb.get_default_basedn(), + dsdb.DS_GUID_COMPUTERS_CONTAINER) res = remote_samdb.search(base=computer_dn, expression=rdn, scope=ldb.SCOPE_ONELEVEL) if (len(res) != 0):