diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2002-09-13 09:00:28 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2002-09-13 09:00:28 +0000 |
commit | 8934e4707d9693588aa1b7a2f22c76e50e73b0cd (patch) | |
tree | d757fe1ab101388be8e135f3ab5b4973f2f46304 | |
parent | a38b141548f99ad1dd38fd2d61dadb22a36822ed (diff) | |
download | newlib-8934e4707d9693588aa1b7a2f22c76e50e73b0cd.zip newlib-8934e4707d9693588aa1b7a2f22c76e50e73b0cd.tar.gz newlib-8934e4707d9693588aa1b7a2f22c76e50e73b0cd.tar.bz2 |
* syscalls.cc (seteuid32): Treat ILLEGAL_UID invalid.
(setegid32): Treat ILLEGAL_GID invalid.
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 20 |
2 files changed, 19 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 4f02920..13902b1 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2002-09-13 Corinna Vinschen <corinna@vinschen.de> + + * syscalls.cc (seteuid32): Treat ILLEGAL_UID invalid. + (setegid32): Treat ILLEGAL_GID invalid. + 2002-09-10 Pierre Humblet <pierre.humblet@ieee.org> * grp.cc (initgroups): Call groups::clear_supp to free the diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 657a40c..8c2b96b 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1943,14 +1943,18 @@ seteuid32 (__uid32_t uid) debug_printf ("uid: %d myself->gid: %d", uid, myself->gid); if (!wincap.has_security () - || (uid == myself->uid - && !cygheap->user.groups.ischanged) - || uid == ILLEGAL_UID) + || (uid == myself->uid && !cygheap->user.groups.ischanged)) { debug_printf ("Nothing happens"); return 0; } + if (uid == ILLEGAL_UID) + { + set_errno (EINVAL); + return -1; + } + sigframe thisframe (mainthread); cygsid usersid; user_groups &groups = cygheap->user.groups; @@ -2122,11 +2126,15 @@ setuid (__uid16_t uid) extern "C" int setegid32 (__gid32_t gid) { - if ((!wincap.has_security ()) || - (gid == myself->gid) || - (gid == ILLEGAL_GID)) + if (!wincap.has_security () || gid == myself->gid) return 0; + if (gid == ILLEGAL_GID) + { + set_errno (EINVAL); + return -1; + } + sigframe thisframe (mainthread); user_groups * groups = &cygheap->user.groups; cygsid gsid; |