xref: /csrg-svn/lib/libc/compat-43/setreuid.2 (revision 54847)
147208Scael.\" Copyright (c) 1980, 1991 The Regents of the University of California.
238053Sbostic.\" All rights reserved.
320129Smckusick.\"
443568Strent.\" %sccs.include.redist.man%
520129Smckusick.\"
6*54847Smckusick.\"     @(#)setreuid.2	6.5 (Berkeley) 07/09/92
738053Sbostic.\"
847208Scael.Dd
947208Scael.Dt SETREUID 2
1047208Scael.Os BSD 4
1147208Scael.Sh NAME
1247208Scael.Nm setreuid
1347208Scael.Nd set real and effective user ID's
1447208Scael.Sh SYNOPSIS
1547208Scael.Fd #include <unistd.h>
1647208Scael.Ft int
1747208Scael.Fn setreuid "int ruid" "int euid"
1847208Scael.Sh DESCRIPTION
19*54847Smckusick.Bf -symbolic
20*54847SmckusickThis interface is made obsolete by:
21*54847Smckusick.Ef
22*54847Smckusick.Xr seteuid 2 .
23*54847Smckusick.Pp
24*54847SmckusickThe effective user ID's of the
25*54847Smckusickcurrent process is set according to the
26*54847Smckusick.Fa euid
27*54847Smckusickargument.
28*54847SmckusickThe real user ID's of the
29*54847Smckusickcurrent process is checked to ensure that it matches
30*54847Smckusickeither the real or saved ID of the process
31*54847Smckusick(thus ensuring that it can later be restored to the effective ID).
3220130SmckusickIf
3347208Scael.Fa euid
3447208Scaelis -1, the current uid is filled in by the system.
35*54847SmckusickIf
36*54847Smckusick.Fa ruid
37*54847Smckusickis -1, the check on real ID above is skipped.
38*54847SmckusickUnprivileged users may change the effective user
39*54847SmckusickID to the real user ID or the saved user ID;
40*54847Smckusickonly the super-user may make other changes.
4147208Scael.Sh RETURN VALUES
4220130SmckusickUpon successful completion, a value of 0 is returned.  Otherwise,
4347208Scaela value of -1 is returned and
4447208Scael.Va errno
4547208Scaelis set to indicate the error.
4647208Scael.Sh ERRORS
4747208Scael.Bl -tag -width [EPERM]
4847208Scael.It Bq Er EPERM
4920130SmckusickThe current process is not the super-user and a change
5020130Smckusickother than changing the effective user-id to the real user-id
51*54847Smckusickor saved user-id was specified.
5247208Scael.El
5347208Scael.Sh SEE ALSO
5447208Scael.Xr getuid 2 ,
55*54847Smckusick.Xr seteuid 2 ,
56*54847Smckusick.Xr setuid 2
5747208Scael.Sh HISTORY
5847208ScaelThe
5947208Scael.Nm
6047208Scaelfunction call appeared in
61*54847Smckusick.Bx 4.2
62*54847Smckusickand was dropped in
63*54847Smckusick.Bx 4.4 .
64