diff options
author | Günther Deschner <gd@samba.org> | 2008-04-02 11:14:15 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-04-02 11:14:15 +0200 |
commit | 6c1c07bde3ce01bb6585216db6d4f13abd2a8ff2 (patch) | |
tree | f5f9a28254f36ad68cfb35f282f20d093d0cdc41 /source3/lib/netapi | |
parent | 99d35904552b01ef9f2adc40e16887da9eb4de69 (diff) | |
download | samba-6c1c07bde3ce01bb6585216db6d4f13abd2a8ff2.tar.gz samba-6c1c07bde3ce01bb6585216db6d4f13abd2a8ff2.tar.bz2 samba-6c1c07bde3ce01bb6585216db6d4f13abd2a8ff2.zip |
Make sure to hand down the domain name in libnetapi NetUnjoinDomain.
Guenther
(This used to be commit 0058ab30de943f134792e3d66051206086987110)
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r-- | source3/lib/netapi/joindomain.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 9c0e8aaaf8..ed8327ed68 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -238,6 +238,7 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, { struct libnet_UnjoinCtx *r = NULL; struct dom_sid domain_sid; + const char *domain = NULL; WERROR werr; if (!secrets_fetch_domain_sid(lp_workgroup(), &domain_sid)) { @@ -247,26 +248,28 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, werr = libnet_init_UnjoinCtx(mem_ctx, &r); W_ERROR_NOT_OK_RETURN(werr); + if (lp_realm()) { + domain = lp_realm(); + } else { + domain = lp_workgroup(); + } + if (server_name) { r->in.dc_name = talloc_strdup(mem_ctx, server_name); W_ERROR_HAVE_NO_MEMORY(r->in.dc_name); } else { NTSTATUS status; - const char *domain = NULL; struct netr_DsRGetDCNameInfo *info = NULL; uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED | DS_WRITABLE_REQUIRED | DS_RETURN_DNS_NAME; - if (lp_realm()) { - domain = lp_realm(); - } else { - domain = lp_workgroup(); - } status = dsgetdcname(mem_ctx, domain, NULL, NULL, flags, &info); if (!NT_STATUS_IS_OK(status)) { libnetapi_set_error_string(mem_ctx, - "%s", get_friendly_nt_error_msg(status)); + "failed to find DC for domain %s: %s", + domain, + get_friendly_nt_error_msg(status)); return ntstatus_to_werror(status); } r->in.dc_name = talloc_strdup(mem_ctx, @@ -284,6 +287,7 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, W_ERROR_HAVE_NO_MEMORY(r->in.admin_password); } + r->in.domain_name = domain; r->in.unjoin_flags = unjoin_flags; r->in.modify_config = true; r->in.debug = true; |