From: Joseph Sutton Date: Mon, 24 May 2021 04:40:55 +0000 (+1200) Subject: netcmd: Fix error-checking condition X-Git-Tag: tevent-0.11.0~418 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8c242bed19432d96e78dc345ab5f06422c5b104;p=thirdparty%2Fsamba.git 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 --- 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])