/*
- * Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1999-2007 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#define MEMBERD_NAME "com.apple.memberd"
static mach_port_t mbr_port = MACH_PORT_NULL;
typedef uint32_t GIDArray[16];
-extern kern_return_t _mbr_GetGroups(mach_port_t server, uint32_t uid, uint32_t *numGroups, GIDArray gids);
+extern kern_return_t _mbr_GetGroups(mach_port_t server, uint32_t uid, uint32_t *numGroups, GIDArray gids, security_token_t *token);
#define GR_GET_NAME 1
#define GR_GET_GID 2
if (x == NULL) return;
tdata = (struct lu_thread_info *)x;
-
+
if (tdata->lu_entry != NULL)
{
free_group((struct group *)tdata->lu_entry);
ap += hsize;
}
}
-
+
memset(bp, 0, sizeof(unsigned long));
bp = ap;
static int proc = -1;
int count;
char *lookup_buf;
-
+
if (proc < 0)
{
if (_lookup_link(_lu_port, "getgrgid", &proc) != KERN_SUCCESS)
int pwstatus;
GIDArray gids;
int status, maxgroups;
+ security_token_t token;
status = 0;
if (pwstatus != 0) return status;
if (res == NULL) return status;
+ token.val[0] = -1;
+ token.val[1] = -1;
+
count = 0;
- kstatus = _mbr_GetGroups(mbr_port, p.pw_uid, &count, gids);
+ kstatus = _mbr_GetGroups(mbr_port, p.pw_uid, &count, gids, &token);
if (kstatus != KERN_SUCCESS) return status;
+ if (token.val[0] != 0) return KERN_FAILURE;
for (i = 0; (i < count) && (status == 0); i++)
{
if (name == NULL) return status;
if (groups == NULL) return status;
if (grpcnt == NULL) return status;
-
+
maxgroups = *grpcnt;
*grpcnt = 0;
{
return mbr_getgrouplist(name, basegid, groups, grpcnt, dupbase);
}
-
+
if (_lu_running())
{
return lu_getgrouplist(name, basegid, groups, grpcnt, dupbase);
}
-
+
return _old_getgrouplist(name, basegid, groups, grpcnt);
}
tdata = (struct lu_thread_info *)calloc(1, sizeof(struct lu_thread_info));
_lu_data_set_key(_lu_data_key_group, tdata);
}
-
+
if (tdata->lu_vm == NULL)
{
if (proc < 0)
}
tdata->lu_vm_cursor--;
-
+
return g;
}