1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

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 <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Tim Beale 2018-10-18 13:07:20 +13:00 committed by Andrew Bartlett
parent 30277feb83
commit 10a9cc44ab

View File

@ -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