summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_rpc.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-11 01:04:13 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-11 01:04:13 +0000
commitd033e533001ba255293e5fac639390d507ce3f3a (patch)
tree5374951084b4e701d8ba0b41de3ab481c70b01ec /source3/nsswitch/winbindd_rpc.c
parentd032059df9559abbf9d828d7fb13626ddd2a62fc (diff)
downloadsamba-d033e533001ba255293e5fac639390d507ce3f3a.tar.gz
samba-d033e533001ba255293e5fac639390d507ce3f3a.tar.bz2
samba-d033e533001ba255293e5fac639390d507ce3f3a.zip
removed the start_ndx parameter from group enumeration
I tried testing this by lowering the buffer size in cli_samr_enum_dom_groups() but that didn't work - I think this needs more looking into (This used to be commit 34328e30315e4b42087d0ee11ed0c3fb715bc250)
Diffstat (limited to 'source3/nsswitch/winbindd_rpc.c')
-rw-r--r--source3/nsswitch/winbindd_rpc.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c
index eb14a30f39..87656d7ae2 100644
--- a/source3/nsswitch/winbindd_rpc.c
+++ b/source3/nsswitch/winbindd_rpc.c
@@ -109,7 +109,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
/* list all domain groups */
static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
- uint32 *start_ndx, uint32 *num_entries,
+ uint32 *num_entries,
struct acct_info **info)
{
uint32 des_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
@@ -118,6 +118,7 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
NTSTATUS status;
*num_entries = 0;
+ *info = NULL;
if (!(hnd = cm_get_sam_handle(domain->name))) {
return NT_STATUS_UNSUCCESSFUL;
@@ -129,10 +130,35 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
return status;
}
- status = cli_samr_enum_dom_groups(hnd->cli, mem_ctx, &dom_pol,
- start_ndx,
- 0x8000, /* buffer size? */
- info, num_entries);
+ do {
+ struct acct_info *info2 = NULL;
+ uint32 count = 0, start = *num_entries;
+ TALLOC_CTX *mem_ctx2;
+
+ mem_ctx2 = talloc_init();
+
+ status = cli_samr_enum_dom_groups(hnd->cli, mem_ctx2, &dom_pol,
+ &start,
+ 0xFFFF, /* buffer size? */
+ &info2, &count);
+
+ if (!NT_STATUS_IS_OK(status) &&
+ !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
+ talloc_destroy(mem_ctx2);
+ break;
+ }
+
+ (*info) = talloc_realloc(mem_ctx, *info,
+ sizeof(**info) * ((*num_entries) + count));
+ if (! *info) {
+ talloc_destroy(mem_ctx2);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ memcpy(&(*info)[*num_entries], info2, count*sizeof(*info2));
+ (*num_entries) += count;
+ talloc_destroy(mem_ctx2);
+ } while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES));
cli_samr_close(hnd->cli, mem_ctx, &dom_pol);