diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/winbindd_rpc.c | 54 | ||||
-rw-r--r-- | source3/winbindd/winbindd_rpc.h | 7 |
2 files changed, 61 insertions, 0 deletions
diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c index 48d177057f..eddd1882d4 100644 --- a/source3/winbindd/winbindd_rpc.c +++ b/source3/winbindd/winbindd_rpc.c @@ -193,3 +193,57 @@ NTSTATUS rpc_enum_dom_groups(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } + +NTSTATUS rpc_enum_local_groups(TALLOC_CTX *mem_ctx, + struct rpc_pipe_client *samr_pipe, + struct policy_handle *samr_policy, + uint32_t *pnum_info, + struct acct_info **pinfo) +{ + struct acct_info *info = NULL; + uint32_t num_info = 0; + NTSTATUS status; + + *pnum_info = 0; + + do { + struct samr_SamArray *sam_array = NULL; + uint32_t count = 0; + uint32_t start = num_info; + uint32_t g; + + status = rpccli_samr_EnumDomainAliases(samr_pipe, + mem_ctx, + samr_policy, + &start, + &sam_array, + 0xFFFF, /* buffer size? */ + &count); + if (!NT_STATUS_IS_OK(status)) { + if (!NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { + return status; + } + } + + info = TALLOC_REALLOC_ARRAY(mem_ctx, + info, + struct acct_info, + num_info + count); + if (info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + 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)); + + *pnum_info = num_info; + *pinfo = info; + + return NT_STATUS_OK; +} diff --git a/source3/winbindd/winbindd_rpc.h b/source3/winbindd/winbindd_rpc.h index c5ee1cc72e..5ba5bf4ce5 100644 --- a/source3/winbindd/winbindd_rpc.h +++ b/source3/winbindd/winbindd_rpc.h @@ -40,4 +40,11 @@ NTSTATUS rpc_enum_dom_groups(TALLOC_CTX *mem_ctx, uint32_t *pnum_info, struct acct_info **pinfo); +/* List all domain groups */ +NTSTATUS rpc_enum_local_groups(TALLOC_CTX *mem_ctx, + struct rpc_pipe_client *samr_pipe, + struct policy_handle *samr_policy, + uint32_t *pnum_info, + struct acct_info **pinfo); + #endif /* _WINBINDD_RPC_H_ */ |