From: Tim Beale Date: Thu, 18 Oct 2018 00:07:20 +0000 (+1300) Subject: join: Sanity-check LDB connection before failed join cleanup X-Git-Tag: tdb-1.3.17~1294 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10a9cc44abd29f46f075823fce55b496e760c7bd;p=thirdparty%2Fsamba.git join: Sanity-check LDB connection before failed join cleanup Joining a large DB can take so long that the LDAP connection times out. The previous patch fixed the 'happy case' where the join succeeds. However, if the commit or replication fails (throwing an exception), then the cleanup code can also fail when it tries to delete objects from the remote DC. This then gives you an error pointing to cleanup_old_accounts() rather than what actually went wrong. This patch adds a sanity-check that if the join fails, that the LDB connection to the remote DC is still alive, before we start deleting objects. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13612 Signed-off-by: Tim Beale Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/join.py b/python/samba/join.py index 75106ff52fa..01636fe3840 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -1443,6 +1443,10 @@ class DCJoinContext(object): print("Join failed - cleaning up") except IOError: pass + + # cleanup the failed join (checking we still have a live LDB + # connection to the remote DC first) + ctx.refresh_ldb_connection() ctx.cleanup_old_join() raise