From: Stefan Metzmacher Date: Tue, 28 May 2019 12:54:19 +0000 (+0200) Subject: samba-tool: use only one LDAP modify for dns partition fsmo role transfer X-Git-Tag: samba-4.9.12~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1eeb8e63afa6c9a5bec69d25820a44d01539d88;p=thirdparty%2Fsamba.git samba-tool: use only one LDAP modify for dns partition fsmo role transfer We should not risk that we end with no role owner. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13973 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett (similar to commit 6a2e3a15585086bcceb18283216978a2fcb30da3) --- diff --git a/python/samba/netcmd/fsmo.py b/python/samba/netcmd/fsmo.py index c276f5fced7..2190578f7f6 100644 --- a/python/samba/netcmd/fsmo.py +++ b/python/samba/netcmd/fsmo.py @@ -107,22 +107,12 @@ def transfer_dns_role(outf, sambaopts, credopts, role, samdb): m = ldb.Message() m.dn = ldb.Dn(samdb, role_object) - m["fSMORoleOwner"] = ldb.MessageElement(master_owner, - ldb.FLAG_MOD_DELETE, - "fSMORoleOwner") - - try: - samdb.modify(m) - except LdbError as e4: - (num, msg) = e4.args - raise CommandError("Failed to delete role '%s': %s" % - (role, msg)) - - m = ldb.Message() - m.dn = ldb.Dn(samdb, role_object) - m["fSMORoleOwner"]= ldb.MessageElement(new_owner, - ldb.FLAG_MOD_ADD, - "fSMORoleOwner") + m["fSMORoleOwner_Del"] = ldb.MessageElement(master_owner, + ldb.FLAG_MOD_DELETE, + "fSMORoleOwner") + m["fSMORoleOwner_Add"] = ldb.MessageElement(new_owner, + ldb.FLAG_MOD_ADD, + "fSMORoleOwner") try: samdb.modify(m) except LdbError as e5: