mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
Eliminate remote tree of dsgetdcname (which will happen in libnetapi then).
Guenther
This commit is contained in:
parent
bc0b68709c
commit
fd490d236b
@ -52,7 +52,7 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx,
|
||||
uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
|
||||
DS_WRITABLE_REQUIRED |
|
||||
DS_RETURN_DNS_NAME;
|
||||
status = dsgetdcname(mem_ctx, NULL, domain_name,
|
||||
status = dsgetdcname(mem_ctx, domain_name,
|
||||
NULL, NULL, flags, &info);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
libnetapi_set_error_string(mem_ctx,
|
||||
@ -261,7 +261,7 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx,
|
||||
} else {
|
||||
domain = lp_workgroup();
|
||||
}
|
||||
status = dsgetdcname(mem_ctx, NULL, domain,
|
||||
status = dsgetdcname(mem_ctx, domain,
|
||||
NULL, NULL, flags, &info);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
libnetapi_set_error_string(mem_ctx,
|
||||
@ -566,7 +566,7 @@ static WERROR NetGetJoinableOUsLocal(struct libnetapi_ctx *ctx,
|
||||
uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
|
||||
DS_RETURN_DNS_NAME;
|
||||
|
||||
status = dsgetdcname(ctx, NULL, domain,
|
||||
status = dsgetdcname(ctx, domain,
|
||||
NULL, NULL, flags, &info);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
libnetapi_set_error_string(ctx, "%s",
|
||||
|
@ -1173,7 +1173,6 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
|
||||
if (!r->in.dc_name) {
|
||||
struct DS_DOMAIN_CONTROLLER_INFO *info;
|
||||
status = dsgetdcname(mem_ctx,
|
||||
NULL,
|
||||
r->in.domain_name,
|
||||
NULL,
|
||||
NULL,
|
||||
@ -1301,7 +1300,6 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
|
||||
if (!r->in.dc_name) {
|
||||
struct DS_DOMAIN_CONTROLLER_INFO *info;
|
||||
status = dsgetdcname(mem_ctx,
|
||||
NULL,
|
||||
r->in.domain_name,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -891,72 +891,27 @@ static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
dsgetdcname.
|
||||
|
||||
This will be the only public function here.
|
||||
********************************************************************/
|
||||
|
||||
NTSTATUS dsgetdcname_remote(TALLOC_CTX *mem_ctx,
|
||||
const char *computer_name,
|
||||
const char *domain_name,
|
||||
struct GUID *domain_guid,
|
||||
const char *site_name,
|
||||
uint32_t flags,
|
||||
struct DS_DOMAIN_CONTROLLER_INFO **info)
|
||||
{
|
||||
WERROR werr;
|
||||
NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
|
||||
struct cli_state *cli = NULL;
|
||||
struct rpc_pipe_client *pipe_cli = NULL;
|
||||
|
||||
status = cli_full_connection(&cli, NULL, computer_name,
|
||||
NULL, 0,
|
||||
"IPC$", "IPC",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0, Undefined, NULL);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON,
|
||||
&status);
|
||||
if (!pipe_cli) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
werr = rpccli_netlogon_dsr_getdcname(pipe_cli,
|
||||
mem_ctx,
|
||||
computer_name,
|
||||
domain_name,
|
||||
domain_guid,
|
||||
NULL,
|
||||
flags,
|
||||
info);
|
||||
status = werror_to_ntstatus(werr);
|
||||
|
||||
done:
|
||||
cli_rpc_pipe_close(pipe_cli);
|
||||
if (cli) {
|
||||
cli_shutdown(cli);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
********************************************************************/
|
||||
|
||||
NTSTATUS dsgetdcname_local(TALLOC_CTX *mem_ctx,
|
||||
const char *computer_name,
|
||||
const char *domain_name,
|
||||
struct GUID *domain_guid,
|
||||
const char *site_name,
|
||||
uint32_t flags,
|
||||
struct DS_DOMAIN_CONTROLLER_INFO **info)
|
||||
NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
|
||||
const char *domain_name,
|
||||
struct GUID *domain_guid,
|
||||
const char *site_name,
|
||||
uint32_t flags,
|
||||
struct DS_DOMAIN_CONTROLLER_INFO **info)
|
||||
{
|
||||
NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
|
||||
struct DS_DOMAIN_CONTROLLER_INFO *myinfo = NULL;
|
||||
|
||||
DEBUG(10,("dsgetdcname: domain_name: %s, "
|
||||
"domain_guid: %s, site_name: %s, flags: 0x%08x\n",
|
||||
domain_name,
|
||||
domain_guid ? GUID_string(mem_ctx, domain_guid) : "(null)",
|
||||
site_name, flags));
|
||||
|
||||
*info = NULL;
|
||||
|
||||
if (!check_allowed_required_flags(flags)) {
|
||||
@ -991,44 +946,3 @@ NTSTATUS dsgetdcname_local(TALLOC_CTX *mem_ctx,
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
dsgetdcname.
|
||||
|
||||
This will be the only public function here.
|
||||
********************************************************************/
|
||||
|
||||
NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
|
||||
const char *computer_name,
|
||||
const char *domain_name,
|
||||
struct GUID *domain_guid,
|
||||
const char *site_name,
|
||||
uint32_t flags,
|
||||
struct DS_DOMAIN_CONTROLLER_INFO **info)
|
||||
{
|
||||
DEBUG(10,("dsgetdcname: computer_name: %s, domain_name: %s, "
|
||||
"domain_guid: %s, site_name: %s, flags: 0x%08x\n",
|
||||
computer_name, domain_name,
|
||||
domain_guid ? GUID_string(mem_ctx, domain_guid) : "(null)",
|
||||
site_name, flags));
|
||||
|
||||
*info = NULL;
|
||||
|
||||
if (computer_name) {
|
||||
return dsgetdcname_remote(mem_ctx,
|
||||
computer_name,
|
||||
domain_name,
|
||||
domain_guid,
|
||||
site_name,
|
||||
flags,
|
||||
info);
|
||||
}
|
||||
|
||||
return dsgetdcname_local(mem_ctx,
|
||||
computer_name,
|
||||
domain_name,
|
||||
domain_guid,
|
||||
site_name,
|
||||
flags,
|
||||
info);
|
||||
}
|
||||
|
@ -319,7 +319,6 @@ WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, struct wkssvc_NetrJoinDomain2 *r
|
||||
&admin_account);
|
||||
|
||||
status = dsgetdcname(p->mem_ctx,
|
||||
NULL,
|
||||
r->in.domain_name,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -401,7 +401,7 @@ static int net_lookup_dsgetdcname(int argc, const char **argv)
|
||||
site_name = sitename_fetch(domain_name);
|
||||
}
|
||||
|
||||
status = dsgetdcname(mem_ctx, NULL, domain_name, NULL, site_name,
|
||||
status = dsgetdcname(mem_ctx, domain_name, NULL, site_name,
|
||||
flags, &info);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("failed with: %s\n", nt_errstr(status));
|
||||
|
@ -67,7 +67,7 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain,
|
||||
DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid,
|
||||
state->request.domain_name));
|
||||
|
||||
result = dsgetdcname(state->mem_ctx, NULL, state->request.domain_name,
|
||||
result = dsgetdcname(state->mem_ctx, state->request.domain_name,
|
||||
NULL, NULL, state->request.flags, &info);
|
||||
|
||||
if (!NT_STATUS_IS_OK(result)) {
|
||||
|
Loading…
Reference in New Issue
Block a user