diff options
author | Richard Sharpe <sharpe@samba.org> | 2005-02-10 18:27:23 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:55:37 -0500 |
commit | 5ba4fb5eb9da77d313b88f1437cedc30679bdd95 (patch) | |
tree | 1fe8d3ac03950fc10c19aef13f49894f4f9d8f56 /source3/utils/net_rpc.c | |
parent | b6c143a17f40f9b34da4f0aeb83b0180d5a198e0 (diff) | |
download | samba-5ba4fb5eb9da77d313b88f1437cedc30679bdd95.tar.gz samba-5ba4fb5eb9da77d313b88f1437cedc30679bdd95.tar.bz2 samba-5ba4fb5eb9da77d313b88f1437cedc30679bdd95.zip |
r5318: Fix a small problem in where we ignore the response from a SamrGetGroupsForUser
that says the user is in 0 groups, and we issue an RPC to LookupIds for 0 RIDs.
The printing that there are no groups the user is a member of might be overkill
in that it might upset existing scripts that don't expect that output.
(This used to be commit d3482e118f99002c0460291d41708fdf7708c41f)
Diffstat (limited to 'source3/utils/net_rpc.c')
-rw-r--r-- | source3/utils/net_rpc.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 76b53d6113..ff754c33dc 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -1005,26 +1005,32 @@ rpc_user_info_internals(const DOM_SID *domain_sid, const char *domain_name, result = cli_samr_query_usergroups(cli, mem_ctx, &user_pol, &num_rids, &user_gids); - /* Look up rids */ + if (!NT_STATUS_IS_OK(result)) goto done; - rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids); + /* Look up rids */ - for (i = 0; i < num_rids; i++) - rids[i] = user_gids[i].g_rid; + if (rids) { + rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids); - result = cli_samr_lookup_rids(cli, mem_ctx, &domain_pol, - flags, num_rids, rids, - &num_names, &names, &name_types); + for (i = 0; i < num_rids; i++) + rids[i] = user_gids[i].g_rid; - if (!NT_STATUS_IS_OK(result)) { - goto done; - } + result = cli_samr_lookup_rids(cli, mem_ctx, &domain_pol, + flags, num_rids, rids, + &num_names, &names, &name_types); - /* Display results */ + if (!NT_STATUS_IS_OK(result)) { + goto done; + } - for (i = 0; i < num_names; i++) - printf("%s\n", names[i]); + /* Display results */ + for (i = 0; i < num_names; i++) + printf("%s\n", names[i]); + } + else { + printf("no groups\n"); + } done: return result; } |