View | Details | Raw Unified | Return to bug 24281
Collapse All | Expand All

(-)a/source4/winbind/wb_dom_info.c (+20 lines)
 Lines 27-32    Link Here 
27
#include "winbind/wb_server.h"
27
#include "winbind/wb_server.h"
28
#include "smbd/service_task.h"
28
#include "smbd/service_task.h"
29
#include "libcli/finddc.h"
29
#include "libcli/finddc.h"
30
#include "lib/socket/netif.h"
31
#include "param/param.h"
30
32
31
struct get_dom_info_state {
33
struct get_dom_info_state {
32
	struct composite_context *ctx;
34
	struct composite_context *ctx;
 Lines 65-70   struct composite_context *wb_get_dom_info_send(TALLOC_CTX *mem_ctx, Link Here 
65
	state->info->sid = dom_sid_dup(state->info, sid);
67
	state->info->sid = dom_sid_dup(state->info, sid);
66
	if (state->info->sid == NULL) goto failed;
68
	if (state->info->sid == NULL) goto failed;
67
69
70
	if ((lpcfg_server_role(service->task->lp_ctx) != ROLE_DOMAIN_MEMBER) &&
71
	    dom_sid_equal(sid, service->primary_sid) &&
72
	    service->sec_channel_type != SEC_CHAN_RODC) {
73
		struct interface *ifaces = NULL;
74
75
		load_interface_list(state, service->task->lp_ctx, &ifaces);
76
77
		state->info->dc = talloc(state->info, struct nbt_dc_name);
78
79
		state->info->dc->address = talloc_strdup(state->info->dc,
80
						iface_list_n_ip(ifaces, 0));
81
		state->info->dc->name = talloc_strdup(state->info->dc,
82
						lpcfg_netbios_name(service->task->lp_ctx));
83
84
		composite_done(state->ctx);
85
		return result;
86
	}
87
68
	dom_sid = dom_sid_dup(mem_ctx, sid);
88
	dom_sid = dom_sid_dup(mem_ctx, sid);
69
	if (dom_sid == NULL) goto failed;
89
	if (dom_sid == NULL) goto failed;
70
90
(-)a/source4/winbind/wb_init_domain.c (-8 / +18 lines)
 Lines 78-100   static struct dcerpc_binding *init_domain_binding(struct init_domain_state *stat Link Here 
78
						  const struct ndr_interface_table *table) 
78
						  const struct ndr_interface_table *table) 
79
{
79
{
80
	struct dcerpc_binding *binding;
80
	struct dcerpc_binding *binding;
81
	char *s;
81
	NTSTATUS status;
82
	NTSTATUS status;
82
83
83
	/* Make a binding string */
84
	/* Make a binding string */
84
	{
85
	if ((lpcfg_server_role(state->service->task->lp_ctx) != ROLE_DOMAIN_MEMBER) &&
85
		char *s = talloc_asprintf(state, "ncacn_np:%s", state->domain->dc_name);
86
	    dom_sid_equal(state->domain->info->sid, state->service->primary_sid) &&
87
	    state->service->sec_channel_type != SEC_CHAN_RODC) {
88
		s = talloc_asprintf(state, "ncalrpc:%s", state->domain->dc_name);
86
		if (s == NULL) return NULL;
89
		if (s == NULL) return NULL;
87
		status = dcerpc_parse_binding(state, s, &binding);
90
	} else {
88
		talloc_free(s);
91
		s = talloc_asprintf(state, "ncacn_np:%s", state->domain->dc_name);
89
		if (!NT_STATUS_IS_OK(status)) {
92
		if (s == NULL) return NULL;
90
			return NULL;
93
91
		}
94
	}
95
	status = dcerpc_parse_binding(state, s, &binding);
96
	talloc_free(s);
97
	if (!NT_STATUS_IS_OK(status)) {
98
		return NULL;
92
	}
99
	}
93
100
94
	/* Alter binding to contain hostname, but also address (so we don't look it up twice) */
101
	/* Alter binding to contain hostname, but also address (so we don't look it up twice) */
95
	binding->target_hostname = state->domain->dc_name;
102
	binding->target_hostname = state->domain->dc_name;
96
	binding->host = state->domain->dc_address;
103
	binding->host = state->domain->dc_address;
97
104
105
	if (binding->transport == NCALRPC) {
106
		return binding;
107
	}
108
98
	/* This shouldn't make a network call, as the mappings for named pipes are well known */
109
	/* This shouldn't make a network call, as the mappings for named pipes are well known */
99
	status = dcerpc_epm_map_binding(binding, binding, table, state->service->task->event_ctx,
110
	status = dcerpc_epm_map_binding(binding, binding, table, state->service->task->event_ctx,
100
					state->service->task->lp_ctx);
111
					state->service->task->lp_ctx);
101
- 

Return to bug 24281