From 95cf60a2e5aadeb75a680bedaa6090817caa8276 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Jan 2011 14:55:48 +0100 Subject: s3-libnet: prefer dcerpc_lsa_X functions. Guenther --- source3/libnet/libnet_join.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'source3') diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index c0150f26b8..6c8560887f 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -25,7 +25,7 @@ #include "libcli/auth/libcli_auth.h" #include "../librpc/gen_ndr/ndr_samr_c.h" #include "rpc_client/init_samr.h" -#include "../librpc/gen_ndr/cli_lsa.h" +#include "../librpc/gen_ndr/ndr_lsa_c.h" #include "rpc_client/cli_lsarpc.h" #include "../librpc/gen_ndr/ndr_netlogon.h" #include "rpc_client/cli_netlogon.h" @@ -710,8 +710,9 @@ static NTSTATUS libnet_join_lookup_dc_rpc(TALLOC_CTX *mem_ctx, { struct rpc_pipe_client *pipe_hnd = NULL; struct policy_handle lsa_pol; - NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + NTSTATUS status, result; union lsa_PolicyInformation *info = NULL; + struct dcerpc_binding_handle *b; status = libnet_join_connect_dc_ipc(r->in.dc_name, r->in.admin_account, @@ -730,17 +731,20 @@ static NTSTATUS libnet_join_lookup_dc_rpc(TALLOC_CTX *mem_ctx, goto done; } + b = pipe_hnd->binding_handle; + status = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true, SEC_FLAG_MAXIMUM_ALLOWED, &lsa_pol); if (!NT_STATUS_IS_OK(status)) { goto done; } - status = rpccli_lsa_QueryInfoPolicy2(pipe_hnd, mem_ctx, + status = dcerpc_lsa_QueryInfoPolicy2(b, mem_ctx, &lsa_pol, LSA_POLICY_INFO_DNS, - &info); - if (NT_STATUS_IS_OK(status)) { + &info, + &result); + if (NT_STATUS_IS_OK(status) && NT_STATUS_IS_OK(result)) { r->out.domain_is_ad = true; r->out.netbios_domain_name = info->dns.name.string; r->out.dns_domain_name = info->dns.dns_domain.string; @@ -750,20 +754,25 @@ static NTSTATUS libnet_join_lookup_dc_rpc(TALLOC_CTX *mem_ctx, } if (!NT_STATUS_IS_OK(status)) { - status = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, + status = dcerpc_lsa_QueryInfoPolicy(b, mem_ctx, &lsa_pol, LSA_POLICY_INFO_ACCOUNT_DOMAIN, - &info); + &info, + &result); if (!NT_STATUS_IS_OK(status)) { goto done; } + if (!NT_STATUS_IS_OK(result)) { + status = result; + goto done; + } r->out.netbios_domain_name = info->account_domain.name.string; r->out.domain_sid = dom_sid_dup(mem_ctx, info->account_domain.sid); NT_STATUS_HAVE_NO_MEMORY(r->out.domain_sid); } - rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol); + dcerpc_lsa_Close(b, mem_ctx, &lsa_pol, &result); TALLOC_FREE(pipe_hnd); done: -- cgit