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;
}
int main(int argc, char *argv[])
{
int opt;
- int fd, start = 0;
+ int fd;
char *base;
struct stat sbuf;
REGF_HDR *regf_hdr;
* 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;