]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool: Demote computer to wellknown container
authorDavid Mulder <dmulder@suse.com>
Wed, 26 Aug 2020 16:06:21 +0000 (10:06 -0600)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 22 Jun 2021 01:14:37 +0000 (01:14 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=9143
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/domain.py

index eccae4e2f758ad8d797c2a5c79c40e61a6b1ce29..de6f2b0ca1d22933ed1d42e977c60012794bbe6a 100644 (file)
@@ -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):