xref: /freebsd/lib/libsys/setresuid.2 (revision 8269e7673cf033aba67dab8264fe719920c70f87)
1*8269e767SBrooks Davis.\" Copyright (c) 2000
2*8269e767SBrooks Davis.\"      Sheldon Hearn.  All rights reserved.
3*8269e767SBrooks Davis.\"
4*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without
5*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions
6*8269e767SBrooks Davis.\" are met:
7*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
8*8269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
9*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
10*8269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
11*8269e767SBrooks Davis.\"    documentation and/or other materials provided with the distribution.
12*8269e767SBrooks Davis.\"
13*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14*8269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*8269e767SBrooks Davis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17*8269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*8269e767SBrooks Davis.\" DAMAGES
19*8269e767SBrooks Davis.\"
20*8269e767SBrooks Davis.Dd February 7, 2015
21*8269e767SBrooks Davis.Dt SETRESUID 2
22*8269e767SBrooks Davis.Os
23*8269e767SBrooks Davis.Sh NAME
24*8269e767SBrooks Davis.Nm getresgid ,
25*8269e767SBrooks Davis.Nm getresuid ,
26*8269e767SBrooks Davis.Nm setresgid ,
27*8269e767SBrooks Davis.Nm setresuid
28*8269e767SBrooks Davis.Nd "get or set real, effective and saved user or group ID"
29*8269e767SBrooks Davis.Sh LIBRARY
30*8269e767SBrooks Davis.Lb libc
31*8269e767SBrooks Davis.Sh SYNOPSIS
32*8269e767SBrooks Davis.In sys/types.h
33*8269e767SBrooks Davis.In unistd.h
34*8269e767SBrooks Davis.Ft int
35*8269e767SBrooks Davis.Fn getresgid "gid_t *rgid" "gid_t *egid" "gid_t *sgid"
36*8269e767SBrooks Davis.Ft int
37*8269e767SBrooks Davis.Fn getresuid "uid_t *ruid" "uid_t *euid" "uid_t *suid"
38*8269e767SBrooks Davis.Ft int
39*8269e767SBrooks Davis.Fn setresgid "gid_t rgid" "gid_t egid" "gid_t sgid"
40*8269e767SBrooks Davis.Ft int
41*8269e767SBrooks Davis.Fn setresuid "uid_t ruid" "uid_t euid" "uid_t suid"
42*8269e767SBrooks Davis.Sh DESCRIPTION
43*8269e767SBrooks DavisThe
44*8269e767SBrooks Davis.Fn setresuid
45*8269e767SBrooks Davissystem call sets the real,
46*8269e767SBrooks Daviseffective and saved user IDs of the current process.
47*8269e767SBrooks DavisThe analogous
48*8269e767SBrooks Davis.Fn setresgid
49*8269e767SBrooks Davissets the real, effective and saved group IDs.
50*8269e767SBrooks Davis.Pp
51*8269e767SBrooks DavisPrivileged processes may set these IDs
52*8269e767SBrooks Davisto arbitrary values.
53*8269e767SBrooks DavisUnprivileged processes are restricted
54*8269e767SBrooks Davisin that each of the new IDs must match one of the current IDs.
55*8269e767SBrooks Davis.Pp
56*8269e767SBrooks DavisPassing -1 as an argument causes the corresponding value
57*8269e767SBrooks Davisto remain unchanged.
58*8269e767SBrooks Davis.Pp
59*8269e767SBrooks DavisThe
60*8269e767SBrooks Davis.Fn getresgid
61*8269e767SBrooks Davisand
62*8269e767SBrooks Davis.Fn getresuid
63*8269e767SBrooks Daviscalls retrieve the real, effective, and saved group and user IDs of
64*8269e767SBrooks Davisthe current process, respectively.
65*8269e767SBrooks Davis.Sh RETURN VALUES
66*8269e767SBrooks Davis.Rv -std
67*8269e767SBrooks Davis.Sh ERRORS
68*8269e767SBrooks Davis.Bl -tag -width Er
69*8269e767SBrooks Davis.It Bq Er EPERM
70*8269e767SBrooks DavisThe calling process was not privileged
71*8269e767SBrooks Davisand tried to change one or more IDs to a value
72*8269e767SBrooks Daviswhich was not the current real ID, the current effective ID
73*8269e767SBrooks Davisnor the current saved ID.
74*8269e767SBrooks Davis.It Bq Er EFAULT
75*8269e767SBrooks DavisAn address passed to
76*8269e767SBrooks Davis.Fn getresgid
77*8269e767SBrooks Davisor
78*8269e767SBrooks Davis.Fn getresuid
79*8269e767SBrooks Daviswas invalid.
80*8269e767SBrooks Davis.El
81*8269e767SBrooks Davis.Sh SEE ALSO
82*8269e767SBrooks Davis.Xr getegid 2 ,
83*8269e767SBrooks Davis.Xr geteuid 2 ,
84*8269e767SBrooks Davis.Xr getgid 2 ,
85*8269e767SBrooks Davis.Xr getuid 2 ,
86*8269e767SBrooks Davis.Xr issetugid 2 ,
87*8269e767SBrooks Davis.Xr setgid 2 ,
88*8269e767SBrooks Davis.Xr setregid 2 ,
89*8269e767SBrooks Davis.Xr setreuid 2 ,
90*8269e767SBrooks Davis.Xr setuid 2
91*8269e767SBrooks Davis.Sh HISTORY
92*8269e767SBrooks DavisThese functions first appeared in HP-UX.
93