diff options
author | Andrew Bartlett <abartlet@samba.org> | 2002-01-11 04:50:45 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2002-01-11 04:50:45 +0000 |
commit | ab8ff85f03b25a0dfe4ab63886a10da81207393c (patch) | |
tree | 468844b6bd6073f6197e5051fc5e864687209c54 /source/libads | |
parent | da4db0373b65d975d5129715d6b1fa725b188766 (diff) | |
download | samba-ab8ff85f03b25a0dfe4ab63886a10da81207393c.tar.gz samba-ab8ff85f03b25a0dfe4ab63886a10da81207393c.tar.xz samba-ab8ff85f03b25a0dfe4ab63886a10da81207393c.zip |
Fix up 'net ads join' to delete and rejoin if the account already exists.
This fixes up a problem where a machine would join (or downgrade by trust
password change) to NT4 membership and not be able to regain full ADS
membership until a 'net ads leave'.
Andrew Bartlett
Diffstat (limited to 'source/libads')
-rw-r--r-- | source/libads/ldap.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/libads/ldap.c b/source/libads/ldap.c index c616f09b6e5..2e93e11603a 100644 --- a/source/libads/ldap.c +++ b/source/libads/ldap.c @@ -321,8 +321,13 @@ ADS_STATUS ads_join_realm(ADS_STRUCT *ads, const char *hostname, const char *org status = ads_find_machine_acct(ads, (void **)&res, host); if (ADS_ERR_OK(status) && ads_count_replies(ads, res) == 1) { - DEBUG(0, ("Host account for %s already exists\n", host)); - return ADS_SUCCESS; + DEBUG(0, ("Host account for %s already exists - deleting for readd\n", host)); + status = ads_leave_realm(ads, host); + if (!ADS_ERR_OK(status)) { + DEBUG(0, ("Failed to delete host '%s' from the '%s' realm.\n", + host, ads->realm)); + return status; + } } status = ads_add_machine_acct(ads, host, org_unit); |