* syscalls.c (seteuid32): Return immediately if the program is not impersonated
and both uid and gid are original. (setegid32): Return immediately if the new gid is the current egid.
This commit is contained in:
parent
3434e0c857
commit
e968058fed
|
@ -1,3 +1,9 @@
|
|||
2002-07-01 Pierre Humblet <pierre.humblet@ieee.org>
|
||||
|
||||
* syscalls.c (seteuid32): Return immediately if the program is not
|
||||
impersonated and both uid and gid are original.
|
||||
(setegid32): Return immediately if the new gid is the current egid.
|
||||
|
||||
2002-07-01 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* syscalls.cc (seteuid32): Fix incorrect placement of Pierre's patch
|
||||
|
|
|
@ -617,7 +617,7 @@ _link (const char *a, const char *b)
|
|||
sigframe thisframe (mainthread);
|
||||
path_conv real_b (b, PC_SYM_NOFOLLOW | PC_FULL);
|
||||
path_conv real_a (a, PC_SYM_NOFOLLOW | PC_FULL);
|
||||
|
||||
|
||||
if (real_a.error)
|
||||
{
|
||||
set_errno (real_a.error);
|
||||
|
@ -1955,11 +1955,16 @@ mkfifo (const char *_path, mode_t mode)
|
|||
extern "C" int
|
||||
seteuid32 (__uid32_t uid)
|
||||
{
|
||||
if (!wincap.has_security ()) return 0;
|
||||
|
||||
if (uid == ILLEGAL_UID)
|
||||
debug_printf ("uid: %d myself->gid: %d", uid, myself->gid);
|
||||
|
||||
if (!wincap.has_security ()
|
||||
|| (!cygheap->user.issetuid ()
|
||||
&& uid == myself->uid
|
||||
&& myself->gid == cygheap->user.orig_gid)
|
||||
|| uid == ILLEGAL_UID)
|
||||
{
|
||||
debug_printf ("new euid == illegal euid, nothing happens");
|
||||
debug_printf ("Nothing happens");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1971,8 +1976,6 @@ seteuid32 (__uid32_t uid)
|
|||
struct passwd * pw_new;
|
||||
PSID origpsid, psid2 = NO_SID;
|
||||
|
||||
debug_printf ("uid: %d myself->gid: %d", uid, myself->gid);
|
||||
|
||||
pw_new = getpwuid32 (uid);
|
||||
if (!usersid.getfrompw (pw_new) ||
|
||||
(!pgrpsid.getfromgr (getgrgid32 (myself->gid))))
|
||||
|
@ -2104,11 +2107,6 @@ seteuid32 (__uid32_t uid)
|
|||
if (cygheap->user.issetuid ()
|
||||
&& !ImpersonateLoggedOnUser (cygheap->user.token))
|
||||
system_printf ("Impersonating in seteuid failed: %E");
|
||||
if (uid == myself->uid)
|
||||
{
|
||||
syscall_printf ("special case, returning 0");
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2140,6 +2138,7 @@ extern "C" int
|
|||
setegid32 (__gid32_t gid)
|
||||
{
|
||||
if ((!wincap.has_security ()) ||
|
||||
(gid == myself->gid) ||
|
||||
(gid == ILLEGAL_GID))
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue