* cygwin.din: Export setreuid32, setreuid, setregid32, setregid.
* syscalls.cc (setreuid32): New function. (setreuid): Ditto. (setregid32): Ditto. (setregid): Ditto. * include/cygwin/version.h: Bump API minor number.
This commit is contained in:
parent
ac4133746e
commit
7d33eefa7b
|
@ -1,3 +1,13 @@
|
|||
2003-01-24 Pierre Humblet <pierre.humblet@ieee.org>
|
||||
Jason Tishler <jason@tishler.net>
|
||||
|
||||
* cygwin.din: Export setreuid32, setreuid, setregid32, setregid.
|
||||
* syscalls.cc (setreuid32): New function.
|
||||
(setreuid): Ditto.
|
||||
(setregid32): Ditto.
|
||||
(setregid): Ditto.
|
||||
* include/cygwin/version.h: Bump API minor number.
|
||||
|
||||
2003-01-23 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* pwdrp.h (pwdgrp::refresh): Lock entire test prior to reading.
|
||||
|
|
|
@ -715,6 +715,12 @@ setlocale
|
|||
_setlocale = setlocale
|
||||
setpgid
|
||||
_setpgid = setpgid
|
||||
setregid
|
||||
_setregid = setregid
|
||||
setregid32
|
||||
setreuid
|
||||
_setreuid = setreuid
|
||||
setreuid32
|
||||
setrlimit
|
||||
_setrlimit = setrlimit
|
||||
setsid
|
||||
|
|
|
@ -170,12 +170,13 @@ details. */
|
|||
70: Export asprintf, _asprintf_r, vasprintf, _vasprintf_r
|
||||
71: Export strerror_r
|
||||
72: Export nanosleep
|
||||
73: Export setreuid32, setreuid, setregid32, setregid
|
||||
*/
|
||||
|
||||
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
|
||||
|
||||
#define CYGWIN_VERSION_API_MAJOR 0
|
||||
#define CYGWIN_VERSION_API_MINOR 72
|
||||
#define CYGWIN_VERSION_API_MINOR 73
|
||||
|
||||
/* There is also a compatibity version number associated with the
|
||||
shared memory regions. It is incremented when incompatible
|
||||
|
|
|
@ -2131,6 +2131,31 @@ setuid (__uid16_t uid)
|
|||
return setuid32 (uid16touid32 (uid));
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
setreuid32 (__uid32_t ruid, __uid32_t euid)
|
||||
{
|
||||
int ret = 0;
|
||||
bool tried = false;
|
||||
__uid32_t old_euid = myself->uid;
|
||||
|
||||
if (ruid != ILLEGAL_UID && cygheap->user.real_uid != ruid && euid != ruid)
|
||||
tried = !(ret = seteuid32 (ruid));
|
||||
if (!ret && euid != ILLEGAL_UID)
|
||||
ret = seteuid32 (euid);
|
||||
if (tried && (ret || euid == ILLEGAL_UID) && seteuid32 (old_euid))
|
||||
system_printf ("Cannot restore original euid %u", old_euid);
|
||||
if (!ret && ruid != ILLEGAL_UID)
|
||||
cygheap->user.real_uid = ruid;
|
||||
debug_printf ("real: %u, effective: %u", cygheap->user.real_uid, myself->uid);
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
setreuid (__uid16_t ruid, __uid16_t euid)
|
||||
{
|
||||
return setreuid32 (uid16touid32 (ruid), uid16touid32 (euid));
|
||||
}
|
||||
|
||||
/* setegid: from System V. */
|
||||
extern "C" int
|
||||
setegid32 (__gid32_t gid)
|
||||
|
@ -2209,6 +2234,31 @@ setgid (__gid16_t gid)
|
|||
return ret;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
setregid32 (__gid32_t rgid, __gid32_t egid)
|
||||
{
|
||||
int ret = 0;
|
||||
bool tried = false;
|
||||
__gid32_t old_egid = myself->gid;
|
||||
|
||||
if (rgid != ILLEGAL_GID && cygheap->user.real_gid != rgid && egid != rgid)
|
||||
tried = !(ret = setegid32 (rgid));
|
||||
if (!ret && egid != ILLEGAL_GID)
|
||||
ret = setegid32 (egid);
|
||||
if (tried && (ret || egid == ILLEGAL_GID) && setegid32 (old_egid))
|
||||
system_printf ("Cannot restore original egid %u", old_egid);
|
||||
if (!ret && rgid != ILLEGAL_GID)
|
||||
cygheap->user.real_gid = rgid;
|
||||
debug_printf ("real: %u, effective: %u", cygheap->user.real_gid, myself->gid);
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
setregid (__gid16_t rgid, __gid16_t egid)
|
||||
{
|
||||
return setregid32 (gid16togid32 (rgid), gid16togid32 (egid));
|
||||
}
|
||||
|
||||
/* chroot: privileged Unix system call. */
|
||||
/* FIXME: Not privileged here. How should this be done? */
|
||||
extern "C" int
|
||||
|
|
Loading…
Reference in New Issue