Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-10-22 20:22:10 +0400
committerChristopher Faylor <me@cgf.cx>2002-10-22 20:22:10 +0400
commit329b9ead3ea5a48d452ce48538a4584835c70555 (patch)
tree54c3aeae19102685230763c7daf9f6152da64ef6 /winsup/cygwin/security.cc
parent1cc651ecafae07b9ed6edff9952e2b31f0503d0a (diff)
* sec_helper.cc (cygsid::get_id): If the sid matches a sid stored in
cygheap->user, return the uid or gid from myself. * security.cc (alloc_sd): If gid == myself->gid, return the group sid from cygheap->user. Remove the test for uid == original_uid, which is counter-productive.
Diffstat (limited to 'winsup/cygwin/security.cc')
-rw-r--r--winsup/cygwin/security.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
index 262d2aaff..b7e70cf05 100644
--- a/winsup/cygwin/security.cc
+++ b/winsup/cygwin/security.cc
@@ -1536,9 +1536,7 @@ alloc_sd (__uid32_t uid, __gid32_t gid, int attribute,
/* Check for current user first */
if (uid == myself->uid)
owner_sid = cygheap->user.sid ();
- else if (uid == cygheap->user.orig_uid)
- owner_sid = cygheap->user.orig_sid ();
- if (!owner_sid)
+ else
{
/* Otherwise retrieve user data from /etc/passwd */
struct passwd *pw = getpwuid32 (uid);
@@ -1559,12 +1557,17 @@ alloc_sd (__uid32_t uid, __gid32_t gid, int attribute,
/* Get SID of new group. */
cygsid group_sid (NO_SID);
- struct __group32 *grp = getgrgid32 (gid);
- if (!grp)
- debug_printf ("no /etc/group entry for %d", gid);
- else if (!group_sid.getfromgr (grp))
- debug_printf ("no SID for group %d", gid);
-
+ /* Check for current user first */
+ if (gid == myself->gid)
+ group_sid = cygheap->user.groups.pgsid;
+ else
+ {
+ struct __group32 *grp = getgrgid32 (gid);
+ if (!grp)
+ debug_printf ("no /etc/group entry for %d", gid);
+ else if (!group_sid.getfromgr (grp))
+ debug_printf ("no SID for group %d", gid);
+ }
/* Initialize local security descriptor. */
SECURITY_DESCRIPTOR sd;
PSECURITY_DESCRIPTOR psd = NULL;