diff options
author | Andreas Schneider <asn@samba.org> | 2010-06-17 13:57:12 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2010-07-05 15:59:09 +0200 |
commit | b3f4e18859e051602a236ee552a641ecd743fc68 (patch) | |
tree | a0aaed7215806b769df1be6fd420c4d113fd93bb /source3 | |
parent | 11610a4e996fd70a2df3b1124f8e658cc9188827 (diff) | |
download | samba-b3f4e18859e051602a236ee552a641ecd743fc68.tar.gz samba-b3f4e18859e051602a236ee552a641ecd743fc68.tar.bz2 samba-b3f4e18859e051602a236ee552a641ecd743fc68.zip |
s3-winbind: Use rpc_enum_dom_groups in samr.
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/winbindd_samr.c | 54 |
1 files changed, 12 insertions, 42 deletions
diff --git a/source3/winbindd/winbindd_samr.c b/source3/winbindd/winbindd_samr.c index 3815e13271..c5917de6b8 100644 --- a/source3/winbindd/winbindd_samr.c +++ b/source3/winbindd/winbindd_samr.c @@ -25,6 +25,8 @@ #include "includes.h" #include "winbindd.h" +#include "winbindd_rpc.h" + #include "../librpc/gen_ndr/cli_samr.h" #include "rpc_client/cli_samr.h" #include "../librpc/gen_ndr/srv_samr.h" @@ -180,12 +182,11 @@ static NTSTATUS sam_enum_dom_groups(struct winbindd_domain *domain, struct rpc_pipe_client *samr_pipe; struct policy_handle dom_pol; struct acct_info *info = NULL; - TALLOC_CTX *tmp_ctx; - uint32_t start = 0; uint32_t num_info = 0; + TALLOC_CTX *tmp_ctx; NTSTATUS status; - DEBUG(3,("samr: query_user_list\n")); + DEBUG(3,("sam_enum_dom_groups\n")); if (pnum_info) { *pnum_info = 0; @@ -201,45 +202,14 @@ static NTSTATUS sam_enum_dom_groups(struct winbindd_domain *domain, goto error; } - do { - struct samr_SamArray *sam_array = NULL; - uint32_t count = 0; - uint32_t g; - - /* start is updated by this call. */ - status = rpccli_samr_EnumDomainGroups(samr_pipe, - tmp_ctx, - &dom_pol, - &start, - &sam_array, - 0xFFFF, /* buffer size? */ - &count); - if (!NT_STATUS_IS_OK(status)) { - if (!NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { - DEBUG(2,("query_user_list: failed to enum domain groups: %s\n", - nt_errstr(status))); - goto error; - } - } - - info = TALLOC_REALLOC_ARRAY(tmp_ctx, - info, - struct acct_info, - num_info + count); - if (info == NULL) { - status = NT_STATUS_NO_MEMORY; - goto error; - } - - for (g = 0; g < count; g++) { - fstrcpy(info[num_info + g].acct_name, - sam_array->entries[g].name.string); - - info[num_info + g].rid = sam_array->entries[g].idx; - } - - num_info += count; - } while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)); + status = rpc_enum_dom_groups(tmp_ctx, + samr_pipe, + &dom_pol, + &num_info, + &info); + if (!NT_STATUS_IS_OK(status)) { + goto error; + } if (pnum_info) { *pnum_info = num_info; |