summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2009-06-26 15:24:57 -0400
committerJim McDonough <jmcd@samba.org>2009-06-26 15:24:57 -0400
commit3c382db3a3a5ccfd5348f39a79556f157f814e76 (patch)
tree4efcd24d7bf72bbef05a46710d1cacdbcd85f7de /source3
parent382a937800fe3618f8dd0fd17556b4643c96303b (diff)
downloadsamba-3c382db3a3a5ccfd5348f39a79556f157f814e76.tar.gz
samba-3c382db3a3a5ccfd5348f39a79556f157f814e76.tar.bz2
samba-3c382db3a3a5ccfd5348f39a79556f157f814e76.zip
Don't use ads realm name for non-ads case. #6481
Also check that the connection to ads worked.
Diffstat (limited to 'source3')
-rw-r--r--source3/libnet/libnet_join.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 86d2a02fd3..6967ae9c8d 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -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