diff options
author | Gerald Carter <jerry@samba.org> | 2005-04-18 16:08:52 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2005-04-18 16:08:52 +0000 |
commit | 4bdbd8bd0742c2c6e4ef65d7030a710412ad6234 (patch) | |
tree | b0b63f76422bf70560832976c5e4174f01c70fb0 /source/utils/net_groupmap.c | |
parent | 65e71c35f782cb1c8a22c61e88f1f853b585b297 (diff) | |
download | samba-4bdbd8bd0742c2c6e4ef65d7030a710412ad6234.tar.gz samba-4bdbd8bd0742c2c6e4ef65d7030a710412ad6234.tar.xz samba-4bdbd8bd0742c2c6e4ef65d7030a710412ad6234.zip |
r6369: update release notes
sync with SAMBA_3_0 (r6365).
Getting ready for 3.0.15pre2
Diffstat (limited to 'source/utils/net_groupmap.c')
-rw-r--r-- | source/utils/net_groupmap.c | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/source/utils/net_groupmap.c b/source/utils/net_groupmap.c index a63e8176f8a..b20a37c7267 100644 --- a/source/utils/net_groupmap.c +++ b/source/utils/net_groupmap.c @@ -693,12 +693,37 @@ static int net_groupmap_listmem(int argc, const char **argv) return 0; } +static BOOL print_alias_memberships(TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, + const DOM_SID *member) +{ + uint32 *alias_rids; + int i, num_alias_rids; + + alias_rids = NULL; + num_alias_rids = 0; + + if (!pdb_enum_alias_memberships(mem_ctx, domain_sid, member, 1, + &alias_rids, &num_alias_rids)) { + d_printf("Could not list memberships for sid %s\n", + sid_string_static(member)); + return False; + } + + for (i = 0; i < num_alias_rids; i++) { + DOM_SID alias; + sid_copy(&alias, domain_sid); + sid_append_rid(&alias, alias_rids[i]); + printf("%s\n", sid_string_static(&alias)); + } + + return True; +} + static int net_groupmap_memberships(int argc, const char **argv) { - DOM_SID member; - DOM_SID *aliases; - int i, num; - NTSTATUS result; + TALLOC_CTX *mem_ctx; + DOM_SID *domain_sid, *builtin_sid, member; if ( (argc != 1) || !string_to_sid(&member, argv[0]) ) { @@ -706,17 +731,24 @@ static int net_groupmap_memberships(int argc, const char **argv) return -1; } - if (!pdb_enum_alias_memberships(&member, 1, &aliases, &num)) { - d_printf("Could not list memberships for sid %s: %s\n", - argv[0], nt_errstr(result)); + mem_ctx = talloc_init("net_groupmap_memberships"); + if (mem_ctx == NULL) { + d_printf("talloc_init failed\n"); return -1; } - for (i = 0; i < num; i++) { - printf("%s\n", sid_string_static(&(aliases[i]))); + domain_sid = get_global_sam_sid(); + builtin_sid = string_sid_talloc(mem_ctx, "S-1-5-32"); + if ((domain_sid == NULL) || (builtin_sid == NULL)) { + d_printf("Could not get domain sid\n"); + return -1; } - SAFE_FREE(aliases); + if (!print_alias_memberships(mem_ctx, domain_sid, &member) || + !print_alias_memberships(mem_ctx, builtin_sid, &member)) + return -1; + + talloc_destroy(mem_ctx); return 0; } |