setreuid(SSC-osr5)
setreuid --
set real and effective user IDs
Syntax
cc ... -lsocket
int setreuid(ruid, euid)
int ruid, euid;
Description
setreuid( )
is used to set the real and effective user IDs
of the calling process.
If ruid is -1, the real user ID is not changed;
if euid is -1, the effective user ID is not changed.
The real and effective user IDs may be set to different values
in the same call.
If the effective user ID
of the calling process is root,
the real user ID and the effective user ID
can be set to any legal value.
If the effective user ID
of the calling process is not root,
the real user ID
can be set to the effective user ID,
or the effective user ID
can be set to either the saved set-user ID from
execve(S-osr5)
or the real user ID.
If a set-UID process
sets its effective user ID
to its real user ID,
it can still set its effective user ID
back to the saved set-user ID.
If the real user ID is changed
(ruid is not -1),
the saved set-user ID is changed to that same value.
NOTE:
This same library routine is also included in the current
release of libc.
However, an application that links with the version of
setreuid in libsocket.a (the library archive)
can run on both SCO OpenServer and Open Desktop,
provided the application does nothing else
to prevent itself from running on Open Desktop.
Return values
A return value of zero indicates that the call succeeded.
A return value of -1 indicates that an error occurred, and
an error code is stored in the global variable errno.
Diagnostics
setreuid( )
fails and
neither of the user IDs are changed if:
EPERM-
The effective user ID of the calling process
is not root and the specified change is other than:
-
changing the real user ID
to the effective user ID
-
changing the effective user ID
to the real user ID
-
changing the effective user ID
to the saved set-user ID
See also
setregid(SSC-osr5),
getuid(S-osr5),
seteuid(SLIB),
setuid(S-osr5),
execve(S-osr5)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005