summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2005-02-10 18:27:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:37 -0500
commit5ba4fb5eb9da77d313b88f1437cedc30679bdd95 (patch)
tree1fe8d3ac03950fc10c19aef13f49894f4f9d8f56
parentb6c143a17f40f9b34da4f0aeb83b0180d5a198e0 (diff)
downloadsamba-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)
-rw-r--r--source3/utils/net_rpc.c32
-rw-r--r--source3/utils/profiles.c5
2 files changed, 21 insertions, 16 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;
}
diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c
index 6911341708..5b5cb7f07b 100644
--- a/source3/utils/profiles.c
+++ b/source3/utils/profiles.c
@@ -521,7 +521,7 @@ static void process_acl(ACL *acl, const char *prefix)
int main(int argc, char *argv[])
{
int opt;
- int fd, start = 0;
+ int fd;
char *base;
struct stat sbuf;
REGF_HDR *regf_hdr;
@@ -608,10 +608,9 @@ int main(int argc, char *argv[])
* Now, mmap the file into memory, check the header and start
* dealing with the records. We are interested in the sk record
*/
- start = 0;
#ifdef HAVE_MMAP
- base = mmap(&start, sbuf.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ base = mmap(NULL, sbuf.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
#else
base = (char *)-1;
errno = ENOSYS;