From 1c7f8e87b60997a4bf04053515defc40f3db51ab Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 12 Sep 2007 09:14:03 +0200 Subject: [PATCH] implement winbindd_ndr_child_get_domain_info() with DOMAIN_INFO_LEVEL_COMPAT metze --- source/winbindd/winbindd_dual.c | 4 +++ source/winbindd/winbindd_util.c | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/source/winbindd/winbindd_dual.c b/source/winbindd/winbindd_dual.c index dad9d3c64..2092a2f01 100644 --- a/source/winbindd/winbindd_dual.c +++ b/source/winbindd/winbindd_dual.c @@ -1185,6 +1185,10 @@ static const struct winbind_ndr_cmd { void (*fn)(struct winbindd_domain *domain, struct winbindd_cli_state *state); } ndr_child_cmd_table[] = { + { + .opnum = NDR_WINBIND_GET_DOMAIN_INFO, + .fn = winbindd_ndr_child_get_domain_info + } }; static void child_reply_ndr_error(struct winbindd_cli_state *state, diff --git a/source/winbindd/winbindd_util.c b/source/winbindd/winbindd_util.c index 49d20c527..d45b8ee14 100644 --- a/source/winbindd/winbindd_util.c +++ b/source/winbindd/winbindd_util.c @@ -682,6 +682,50 @@ enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domai return WINBINDD_OK; } +void winbindd_ndr_child_get_domain_info(struct winbindd_domain *domain, + struct winbindd_cli_state *state) +{ + struct winbind_get_domain_info *r; + + r = talloc_get_type_abort(state->c.ndr.r, + struct winbind_get_domain_info); + + if (r->in.dc_name) { + fstrcpy(domain->dcname, r->in.dc_name); + } + + init_dc_connection(domain); + + if (!domain->initialized) { + /* If we return error here we can't do any cached authentication, + but we may be in disconnected mode and can't initialize correctly. + Do what the previous code did and just return without initialization, + once we go online we'll re-initialize. + */ + DEBUG(5, ("winbindd_ndr_child_get_domain_info: " + "%s returning without initialization online = %d\n", + domain->name, (int)domain->online )); + } + + switch (*r->in.level) { + case WINBIND_DOMAIN_INFO_LEVEL_COMPAT: { + struct winbind_domain_info_compat *compat; + + compat = &r->out.domain_info->compat; + compat->netbios_name = domain->name; + compat->dns_name = domain->alt_name; + compat->sid = &domain->sid; + compat->is_native_mode = domain->native_mode; + compat->is_active_directory = domain->active_directory; + compat->is_primary = domain->primary; + + r->out.result = WINBIND_STATUS_OK; + return; + }} + + r->out.result = WINBIND_STATUS_UNKNOWN_LEVEL; +} + /* Look up global info for the winbind daemon */ BOOL init_domain_list(void) { -- 2.34.1