diff options
author | Christopher Faylor <me@cgf.cx> | 2002-10-22 16:22:10 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-10-22 16:22:10 +0000 |
commit | 329b9ead3ea5a48d452ce48538a4584835c70555 (patch) | |
tree | 54c3aeae19102685230763c7daf9f6152da64ef6 /winsup/cygwin/sec_helper.cc | |
parent | 1cc651ecafae07b9ed6edff9952e2b31f0503d0a (diff) | |
download | cygnal-329b9ead3ea5a48d452ce48538a4584835c70555.tar.gz cygnal-329b9ead3ea5a48d452ce48538a4584835c70555.tar.bz2 cygnal-329b9ead3ea5a48d452ce48538a4584835c70555.zip |
* 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/sec_helper.cc')
-rw-r--r-- | winsup/cygwin/sec_helper.cc | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index fa0519371..8e06810b9 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -162,14 +162,17 @@ cygsid::get_id (BOOL search_grp, int *type) if (!search_grp) { struct passwd *pw; - for (int pidx = 0; (pw = internal_getpwent (pidx)); ++pidx) - { - if (sid.getfrompw (pw) && sid == psid) - { - id = pw->pw_uid; - break; - } - } + if (EqualSid(psid, cygheap->user.sid ())) + id = myself->uid; + else + for (int pidx = 0; (pw = internal_getpwent (pidx)); ++pidx) + { + if (sid.getfrompw (pw) && sid == psid) + { + id = pw->pw_uid; + break; + } + } if (id >= 0) { if (type) @@ -180,14 +183,17 @@ cygsid::get_id (BOOL search_grp, int *type) if (search_grp || type) { struct __group32 *gr; - for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx) - { - if (sid.getfromgr (gr) && sid == psid) - { - id = gr->gr_gid; - break; - } - } + if (cygheap->user.groups.pgsid == psid) + id = myself->gid; + else + for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx) + { + if (sid.getfromgr (gr) && sid == psid) + { + id = gr->gr_gid; + break; + } + } if (id >= 0) { if (type) |