summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-01-18 14:59:20 +0100
committerGünther Deschner <gd@samba.org>2011-02-02 19:02:23 +0100
commitfcaba0fb59a883baff3ee6608d377d73addd6deb (patch)
tree2fa1a47573e9e7d4a6752828f2829d5916238996 /source3/libsmb
parent95cf60a2e5aadeb75a680bedaa6090817caa8276 (diff)
downloadsamba-fcaba0fb59a883baff3ee6608d377d73addd6deb.tar.gz
samba-fcaba0fb59a883baff3ee6608d377d73addd6deb.tar.bz2
samba-fcaba0fb59a883baff3ee6608d377d73addd6deb.zip
s3-libsmb: prefer dcerpc_lsa_X functions.
Guenther
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/trusts_util.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index c7db679539..a9794edc95 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -20,7 +20,7 @@
#include "includes.h"
#include "../libcli/auth/libcli_auth.h"
-#include "../librpc/gen_ndr/cli_lsa.h"
+#include "../librpc/gen_ndr/ndr_lsa_c.h"
#include "rpc_client/cli_lsarpc.h"
#include "rpc_client/cli_netlogon.h"
#include "../librpc/gen_ndr/ndr_netlogon.h"
@@ -142,7 +142,7 @@ bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
struct dom_sid **sids )
{
struct policy_handle pol;
- NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
fstring dc_name;
struct sockaddr_storage dc_ss;
uint32 enum_ctx = 0;
@@ -150,6 +150,7 @@ bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
struct rpc_pipe_client *lsa_pipe = NULL;
struct lsa_DomainList dom_list;
int i;
+ struct dcerpc_binding_handle *b = NULL;
*domain_names = NULL;
*num_domains = 0;
@@ -165,47 +166,54 @@ bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
/* setup the anonymous connection */
- result = cli_full_connection( &cli, global_myname(), dc_name, &dc_ss, 0, "IPC$", "IPC",
+ status = cli_full_connection( &cli, global_myname(), dc_name, &dc_ss, 0, "IPC$", "IPC",
"", "", "", 0, Undefined);
- if ( !NT_STATUS_IS_OK(result) )
+ if ( !NT_STATUS_IS_OK(status) )
goto done;
/* open the LSARPC_PIPE */
- result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ status = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
&lsa_pipe);
- if (!NT_STATUS_IS_OK(result)) {
+ if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ b = lsa_pipe->binding_handle;
+
/* get a handle */
- result = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, True,
+ status = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, True,
LSA_POLICY_VIEW_LOCAL_INFORMATION, &pol);
- if ( !NT_STATUS_IS_OK(result) )
+ if ( !NT_STATUS_IS_OK(status) )
goto done;
/* Lookup list of trusted domains */
- result = rpccli_lsa_EnumTrustDom(lsa_pipe, mem_ctx,
+ status = dcerpc_lsa_EnumTrustDom(b, mem_ctx,
&pol,
&enum_ctx,
&dom_list,
- (uint32_t)-1);
- if ( !NT_STATUS_IS_OK(result) )
+ (uint32_t)-1,
+ &result);
+ if ( !NT_STATUS_IS_OK(status) )
goto done;
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
*num_domains = dom_list.count;
*domain_names = TALLOC_ZERO_ARRAY(mem_ctx, char *, *num_domains);
if (!*domain_names) {
- result = NT_STATUS_NO_MEMORY;
+ status = NT_STATUS_NO_MEMORY;
goto done;
}
*sids = TALLOC_ZERO_ARRAY(mem_ctx, struct dom_sid, *num_domains);
if (!*sids) {
- result = NT_STATUS_NO_MEMORY;
+ status = NT_STATUS_NO_MEMORY;
goto done;
}
@@ -221,7 +229,7 @@ done:
cli_shutdown( cli );
}
- return NT_STATUS_IS_OK(result);
+ return NT_STATUS_IS_OK(status);
}
NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine)