2000-01-17 15:01:42 +00:00
|
|
|
.\" Copyright (c) 2000
|
|
|
|
.\" Sheldon Hearn. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2001-04-15 19:40:22 +00:00
|
|
|
.Dd April 13, 2001
|
2000-01-17 15:01:42 +00:00
|
|
|
.Dt SETRESUID 2
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
2001-04-15 19:40:22 +00:00
|
|
|
.Nm getresgid ,
|
|
|
|
.Nm getresuid ,
|
2000-01-17 15:01:42 +00:00
|
|
|
.Nm setresgid ,
|
|
|
|
.Nm setresuid
|
2001-04-15 19:40:22 +00:00
|
|
|
.Nd "get or set real, effective and saved user or group ID"
|
2000-04-21 09:42:15 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
2000-01-17 15:01:42 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Fd #include <sys/types.h>
|
|
|
|
.Fd #include <unistd.h>
|
|
|
|
.Ft int
|
2001-04-15 19:40:22 +00:00
|
|
|
.Fn getresgid "gid_t *rgid" "gid_t *egid" "gid_t *sgid"
|
|
|
|
.Ft int
|
|
|
|
.Fn getresuid "uit_t *ruid" "uid_t *euid" "uid_t *suid"
|
|
|
|
.Ft int
|
2000-01-17 15:01:42 +00:00
|
|
|
.Fn setresgid "gid_t rgid" "gid_t egid" "gid_t sgid"
|
|
|
|
.Ft int
|
|
|
|
.Fn setresuid "uid_t ruid" "uid_t euid" "uid_t suid"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2000-11-20 14:11:46 +00:00
|
|
|
.Fn setresuid
|
2000-01-17 15:01:42 +00:00
|
|
|
system call sets the real,
|
|
|
|
effective and saved user IDs of the current process.
|
|
|
|
The analogous
|
2000-11-20 14:11:46 +00:00
|
|
|
.Fn setresgid
|
2000-01-17 15:01:42 +00:00
|
|
|
sets the real, effective and saved group IDs.
|
|
|
|
.Pp
|
|
|
|
Privileged processes may set these IDs
|
|
|
|
to arbitrary values.
|
|
|
|
Unprivileged processes are restricted
|
|
|
|
in that each of the new IDs must match one of the current IDs.
|
|
|
|
.Pp
|
|
|
|
Passing -1 as an argument causes the corresponding value
|
|
|
|
to remain unchanged.
|
2001-04-15 19:40:22 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn getresgid
|
|
|
|
and
|
|
|
|
.Fn getresuid
|
|
|
|
calls retrieve the real, effective, and saved group and user IDs of
|
|
|
|
the current process, respectively.
|
2000-01-17 15:01:42 +00:00
|
|
|
.Sh RETURN VALUES
|
|
|
|
These functions return the value 0 if successful;
|
|
|
|
otherwise the value -1 is returned
|
|
|
|
and the global variable
|
|
|
|
.Va errno
|
|
|
|
is set to indicate the error.
|
|
|
|
.Sh ERRORS
|
2000-05-04 13:09:25 +00:00
|
|
|
.Bl -tag -width Er
|
2000-11-22 16:02:00 +00:00
|
|
|
.It Bq Er EPERM
|
2000-01-17 15:01:42 +00:00
|
|
|
The calling process was not privileged
|
|
|
|
and tried to change one or more IDs to a value
|
|
|
|
which was not the current real ID, the current effective ID
|
|
|
|
nor the current saved ID.
|
2001-04-15 19:40:22 +00:00
|
|
|
.It Bq Er EFAULT
|
|
|
|
An address passed to
|
|
|
|
.Fn getresgid
|
|
|
|
or
|
|
|
|
.Fn getresuid
|
|
|
|
was invalid.
|
2000-12-29 14:08:20 +00:00
|
|
|
.El
|
2000-01-17 15:01:42 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr getegid 2 ,
|
|
|
|
.Xr geteuid 2 ,
|
|
|
|
.Xr getgid 2 ,
|
|
|
|
.Xr getuid 2 ,
|
2001-06-05 12:23:22 +00:00
|
|
|
.Xr issetugid 2 ,
|
2000-01-17 15:01:42 +00:00
|
|
|
.Xr setgid 2 ,
|
|
|
|
.Xr setregid 2 ,
|
|
|
|
.Xr setreuid 2 ,
|
2001-07-10 18:00:19 +00:00
|
|
|
.Xr setuid 2
|
2000-01-17 15:01:42 +00:00
|
|
|
.Sh STANDARDS
|
|
|
|
These system calls are not available on many platforms.
|
|
|
|
They exist in
|
|
|
|
.Fx
|
|
|
|
to support Linux binaries linked against GNU libc2.
|
2000-01-18 12:50:13 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
These system calls first appeared in HP-UX.
|