From: Joseph Sutton Date: Thu, 27 May 2021 03:38:03 +0000 (+1200) Subject: netcmd: Refactor seizing DNS roles while restoring from a backup X-Git-Tag: tevent-0.11.0~414 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9bfba62c4843cad3443a1855f3be1c70dd1c1653;p=thirdparty%2Fsamba.git netcmd: Refactor seizing DNS roles while restoring from a backup Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/netcmd/domain_backup.py b/python/samba/netcmd/domain_backup.py index b5874b305b2..1246062b7c4 100644 --- a/python/samba/netcmd/domain_backup.py +++ b/python/samba/netcmd/domain_backup.py @@ -660,18 +660,11 @@ class cmd_domain_backup_restore(cmd_fsmo_seize): # Seize DNS roles domain_dn = samdb.domain_dn() forest_dn = samba.dn_from_dns_name(samdb.forest_dns_name()) - domaindns_dn = ("CN=Infrastructure,DC=DomainDnsZones,", domain_dn) - forestdns_dn = ("CN=Infrastructure,DC=ForestDnsZones,", forest_dn) - for dn_prefix, dns_dn in [forestdns_dn, domaindns_dn]: - if dns_dn not in ncs: - continue - full_dn = dn_prefix + dns_dn - m = ldb.Message() - m.dn = ldb.Dn(samdb, full_dn) - m["fSMORoleOwner"] = ldb.MessageElement(samdb.get_dsServiceName(), - ldb.FLAG_MOD_REPLACE, - "fSMORoleOwner") - samdb.modify(m) + dns_roles = [("domaindns", domain_dn), + ("forestdns", forest_dn)] + for role, dn in dns_roles: + if dn in ncs: + self.seize_dns_role(role, samdb, None, None, None, force=True) # Seize other roles for role in ['rid', 'pdc', 'naming', 'infrastructure', 'schema']: