DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

setreuid(SSC)


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) 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:

See also

setregid(SSC), getuid(S), seteuid(SLIB), setuid(S), execve(S)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003