diff options
author | Gerald Carter <jerry@samba.org> | 2002-10-08 18:29:57 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2002-10-08 18:29:57 +0000 |
commit | 876afb5d0f60a7c358b7b3023e59093ce192aa6b (patch) | |
tree | 1e1245ff78c1ceaf874c684780bd0e88de863fcb /source3/nsswitch/winbindd_rpc.c | |
parent | 5bf57880e7893005bd51a76860dd4752954370d0 (diff) | |
download | samba-876afb5d0f60a7c358b7b3023e59093ce192aa6b.tar.gz samba-876afb5d0f60a7c358b7b3023e59093ce192aa6b.tar.bz2 samba-876afb5d0f60a7c358b7b3023e59093ce192aa6b.zip |
merge from APP_HEAD
* s/driverlocation/comment
* detect native mode domain and enumerate local groups
Also
* Added sendfile stats from SAMBA_2_2
(This used to be commit 764b58e2c0b3179cffe157c0ab58761b156b8423)
Diffstat (limited to 'source3/nsswitch/winbindd_rpc.c')
-rw-r--r-- | source3/nsswitch/winbindd_rpc.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c index 047280e21e..d3a418027d 100644 --- a/source3/nsswitch/winbindd_rpc.c +++ b/source3/nsswitch/winbindd_rpc.c @@ -183,6 +183,65 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain, return status; } +/* List all domain groups */ + +static NTSTATUS enum_local_groups(struct winbindd_domain *domain, + TALLOC_CTX *mem_ctx, + uint32 *num_entries, + struct acct_info **info) +{ + uint32 des_access = SEC_RIGHTS_MAXIMUM_ALLOWED; + CLI_POLICY_HND *hnd; + POLICY_HND dom_pol; + NTSTATUS result; + + *num_entries = 0; + *info = NULL; + + if ( !(hnd = cm_get_sam_handle(domain->name)) ) + return NT_STATUS_UNSUCCESSFUL; + + if ( !NT_STATUS_IS_OK(result = cli_samr_open_domain( hnd->cli, mem_ctx, &hnd->pol, + des_access, &domain->sid, &dom_pol)) ) + { + return result; + } + + do { + struct acct_info *info2 = NULL; + uint32 count = 0, start = *num_entries; + TALLOC_CTX *mem_ctx2; + + mem_ctx2 = talloc_init_named("enum_dom_local_groups[rpc]"); + + result = cli_samr_enum_als_groups( hnd->cli, mem_ctx2, &dom_pol, + &start, 0xFFFF, &info2, &count); + + if ( !NT_STATUS_IS_OK(result) + && !NT_STATUS_EQUAL(result, 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); + cli_samr_close(hnd->cli, mem_ctx, &dom_pol); + return NT_STATUS_NO_MEMORY; + } + + memcpy(&(*info)[*num_entries], info2, count*sizeof(*info2)); + (*num_entries) += count; + talloc_destroy(mem_ctx2); + } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)); + + cli_samr_close(hnd->cli, mem_ctx, &dom_pol); + + return result; +} + /* convert a single name to a sid in a domain */ static NTSTATUS name_to_sid(struct winbindd_domain *domain, const char *name, @@ -635,6 +694,7 @@ struct winbindd_methods msrpc_methods = { False, query_user_list, enum_dom_groups, + enum_local_groups, name_to_sid, sid_to_name, query_user, |