diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-02-24 15:58:40 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-02-29 10:41:07 +0100 |
commit | 692c42c42731b017310e07549489c3ab0bca7d12 (patch) | |
tree | 24e4b502f8f0c4337f8dd44f73ebca19ebdea93c /source4/winbind/wb_init_domain.c | |
parent | 8e8fde51b4234b75a5b132e7ea7d9c813fe29ee0 (diff) | |
download | samba-692c42c42731b017310e07549489c3ab0bca7d12.tar.gz samba-692c42c42731b017310e07549489c3ab0bca7d12.tar.bz2 samba-692c42c42731b017310e07549489c3ab0bca7d12.zip |
s4:winbind: use ncalrpc for connections to ourself
That avoids recursion if "smbd" is used as file server.
metze
Diffstat (limited to 'source4/winbind/wb_init_domain.c')
-rw-r--r-- | source4/winbind/wb_init_domain.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/source4/winbind/wb_init_domain.c b/source4/winbind/wb_init_domain.c index 9d807d8776..4d6177bdc7 100644 --- a/source4/winbind/wb_init_domain.c +++ b/source4/winbind/wb_init_domain.c @@ -78,23 +78,34 @@ static struct dcerpc_binding *init_domain_binding(struct init_domain_state *stat const struct ndr_interface_table *table) { struct dcerpc_binding *binding; + char *s; NTSTATUS status; /* Make a binding string */ - { - char *s = talloc_asprintf(state, "ncacn_np:%s", state->domain->dc_name); + if ((lpcfg_server_role(state->service->task->lp_ctx) != ROLE_DOMAIN_MEMBER) && + dom_sid_equal(state->domain->info->sid, state->service->primary_sid) && + state->service->sec_channel_type != SEC_CHAN_RODC) { + s = talloc_asprintf(state, "ncalrpc:%s", state->domain->dc_name); if (s == NULL) return NULL; - status = dcerpc_parse_binding(state, s, &binding); - talloc_free(s); - if (!NT_STATUS_IS_OK(status)) { - return NULL; - } + } else { + s = talloc_asprintf(state, "ncacn_np:%s", state->domain->dc_name); + if (s == NULL) return NULL; + + } + status = dcerpc_parse_binding(state, s, &binding); + talloc_free(s); + if (!NT_STATUS_IS_OK(status)) { + return NULL; } /* Alter binding to contain hostname, but also address (so we don't look it up twice) */ binding->target_hostname = state->domain->dc_name; binding->host = state->domain->dc_address; + if (binding->transport == NCALRPC) { + return binding; + } + /* This shouldn't make a network call, as the mappings for named pipes are well known */ status = dcerpc_epm_map_binding(binding, binding, table, state->service->task->event_ctx, state->service->task->lp_ctx); |