From e8c242bed19432d96e78dc345ab5f06422c5b104 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Mon, 24 May 2021 16:40:55 +1200 Subject: [PATCH] netcmd: Fix error-checking condition This condition probably meant to check the argument of the most recently thrown exception, rather than the previous one again. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14669 Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- python/samba/netcmd/domain_backup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/samba/netcmd/domain_backup.py b/python/samba/netcmd/domain_backup.py index f00fd41d95a..a9c840d3cae 100644 --- a/python/samba/netcmd/domain_backup.py +++ b/python/samba/netcmd/domain_backup.py @@ -602,11 +602,12 @@ class cmd_domain_backup_restore(cmd_fsmo_seize): controls=["show_deleted:0", "show_recycled:0"]) except LdbError as dup_e: - if enum != ldb.ERR_NO_SUCH_OBJECT: - raise e + (dup_enum, _) = dup_e.args + if dup_enum != ldb.ERR_NO_SUCH_OBJECT: + raise if (len(dup_res) != 1): - raise e + raise objectguid = samdb.schema_format_value("objectGUID", dup_res[0]["objectGUID"][0]) -- 2.47.3