1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

Don't use ads realm name for non-ads case. #6481

Also check that the connection to ads worked.
This commit is contained in:
Jim McDonough 2009-06-26 15:24:57 -04:00
parent 382a937800
commit 3c382db3a3

View File

@ -2033,17 +2033,21 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
if (r->in.delete_machine_account) {
ADS_STATUS ads_status;
libnet_unjoin_connect_ads(mem_ctx, r);
ads_status = libnet_unjoin_remove_machine_acct(mem_ctx, r);
ads_status = libnet_unjoin_connect_ads(mem_ctx, r);
if (ADS_ERR_OK(ads_status)) {
/* dirty hack */
r->out.dns_domain_name =
talloc_strdup(mem_ctx,
r->in.ads->server.realm);
ads_status =
libnet_unjoin_remove_machine_acct(mem_ctx, r);
}
if (!ADS_ERR_OK(ads_status)) {
libnet_unjoin_set_error_string(mem_ctx, r,
"failed to remove machine account from AD: %s",
ads_errstr(ads_status));
} else {
r->out.deleted_machine_account = true;
/* dirty hack */
r->out.dns_domain_name = talloc_strdup(mem_ctx,
r->in.ads->server.realm);
W_ERROR_HAVE_NO_MEMORY(r->out.dns_domain_name);
libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
return WERR_OK;
@ -2066,8 +2070,6 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
}
r->out.disabled_machine_account = true;
r->out.dns_domain_name = talloc_strdup(mem_ctx,
r->in.ads->server.realm);
}
/* If disable succeeded or was not requested at all, we