diff options
author | Günther Deschner <gd@samba.org> | 2011-01-18 12:04:56 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-02-01 23:29:14 +0100 |
commit | 37f2f518bed220a83025884e4b345ba2b0a08dd6 (patch) | |
tree | f27fc2d4416e5869e0d81bbe47297c80fa8fb3c6 /source3 | |
parent | bf10bbc074decbdffe9f094cdf6a7ec859dd708e (diff) | |
download | samba-37f2f518bed220a83025884e4b345ba2b0a08dd6.tar.gz samba-37f2f518bed220a83025884e4b345ba2b0a08dd6.tar.bz2 samba-37f2f518bed220a83025884e4b345ba2b0a08dd6.zip |
s3-net: prefer dcerpc_samr_X functions in rpc_fetch_domain_aliases.
Guenther
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net_rpc.c | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 535182d0a3..8d636d402e 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -4292,55 +4292,83 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd, { uint32 start_idx, max_entries, num_entries, i; struct samr_SamArray *groups = NULL; - NTSTATUS result; + NTSTATUS result, status; struct policy_handle domain_pol; + struct dcerpc_binding_handle *b = pipe_hnd->binding_handle; /* Get domain policy handle */ - result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx, + status = dcerpc_samr_OpenDomain(b, mem_ctx, connect_pol, MAXIMUM_ALLOWED_ACCESS, CONST_DISCARD(struct dom_sid2 *, domain_sid), - &domain_pol); - if (!NT_STATUS_IS_OK(result)) + &domain_pol, + &result); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + if (!NT_STATUS_IS_OK(result)) { return result; + } start_idx = 0; max_entries = 250; do { - result = rpccli_samr_EnumDomainAliases(pipe_hnd, mem_ctx, + status = dcerpc_samr_EnumDomainAliases(b, mem_ctx, &domain_pol, &start_idx, &groups, max_entries, - &num_entries); + &num_entries, + &result); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } for (i = 0; i < num_entries; i++) { struct policy_handle alias_pol; struct full_alias alias; struct lsa_SidArray sid_array; int j; + NTSTATUS _result; - result = rpccli_samr_OpenAlias(pipe_hnd, mem_ctx, + status = dcerpc_samr_OpenAlias(b, mem_ctx, &domain_pol, MAXIMUM_ALLOWED_ACCESS, groups->entries[i].idx, - &alias_pol); - if (!NT_STATUS_IS_OK(result)) + &alias_pol, + &_result); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + if (!NT_STATUS_IS_OK(_result)) { + status = _result; goto done; + } - result = rpccli_samr_GetMembersInAlias(pipe_hnd, mem_ctx, + status = dcerpc_samr_GetMembersInAlias(b, mem_ctx, &alias_pol, - &sid_array); - if (!NT_STATUS_IS_OK(result)) + &sid_array, + &_result); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + if (!NT_STATUS_IS_OK(_result)) { + status = _result; goto done; + } alias.num_members = sid_array.num_sids; - result = rpccli_samr_Close(pipe_hnd, mem_ctx, &alias_pol); - if (!NT_STATUS_IS_OK(result)) + status = dcerpc_samr_Close(b, mem_ctx, &alias_pol, &_result); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + if (!NT_STATUS_IS_OK(_result)) { + status = _result; goto done; + } alias.members = NULL; @@ -4359,12 +4387,12 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd, } } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)); - result = NT_STATUS_OK; + status = NT_STATUS_OK; done: - rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol); + dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result); - return result; + return status; } /* |