summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2019-05-28 14:54:19 +0200
committerKarolin Seeger <kseeger@samba.org>2019-08-08 07:32:21 +0000
commitf1eeb8e63afa6c9a5bec69d25820a44d01539d88 (patch)
treefb8131ebaa0150a139f6a5e30ae4a50b0e379ee8
parent8fb77c2d1c8796664b26c804aff17821a83f96b5 (diff)
downloadsamba-f1eeb8e63afa6c9a5bec69d25820a44d01539d88.tar.gz
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 <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> (similar to commit 6a2e3a15585086bcceb18283216978a2fcb30da3)
-rw-r--r--python/samba/netcmd/fsmo.py22
1 files changed, 6 insertions, 16 deletions
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: