diff options
author | 2002-10-30 20:15:29 +0000 | |
---|---|---|
committer | 2002-10-30 20:15:29 +0000 | |
commit | c70d6cf562e008711f2d2c56441df07c27acdadd (patch) | |
tree | 3c8e25313cbdd0ec0edf832e4dbf8a633a326524 /lib/libc/sys | |
parent | regen (diff) | |
download | wireguard-openbsd-c70d6cf562e008711f2d2c56441df07c27acdadd.tar.xz wireguard-openbsd-c70d6cf562e008711f2d2c56441df07c27acdadd.zip |
Add [gs]etres[ug]id(2) syscall to libc and use it in emulating some 4.3BSD
functions.
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/Makefile.inc | 19 | ||||
-rw-r--r-- | lib/libc/sys/setresuid.2 | 96 |
2 files changed, 106 insertions, 9 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 89f0f848e18..7ae2a594698 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.56 2002/08/05 22:42:12 art Exp $ +# $OpenBSD: Makefile.inc,v 1.57 2002/10/30 20:15:29 millert Exp $ # $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $ # @(#)Makefile.inc 8.1 (Berkeley) 6/17/93 @@ -40,8 +40,8 @@ ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \ getfh.o getfsstat.o getgid.o getgroups.o getitimer.o getpeereid.o \ getpeername.o \ getpgid.o \ - getpgrp.o getpid.o getppid.o getpriority.o getrlimit.o getrusage.o \ - getsid.o \ + getpgrp.o getpid.o getppid.o getpriority.o getresgid.o getresuid.o \ + getrlimit.o getrusage.o getsid.o \ getsockname.o getsockopt.o gettimeofday.o getuid.o issetugid.o \ ioctl.o kill.o kevent.o kqueue.o \ ktrace.o lchown.o lfs_bmapv.o lfs_markv.o lfs_segclean.o lfs_segwait.o \ @@ -53,7 +53,8 @@ ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \ read.o readlink.o readv.o reboot.o recvfrom.o recvmsg.o rename.o \ revoke.o rmdir.o select.o semget.o semop.o sendmsg.o sendto.o \ setegid.o seteuid.o setgid.o setgroups.o setitimer.o setpgid.o \ - setpriority.o setrlimit.o setsid.o setsockopt.o settimeofday.o \ + setpriority.o setresgid.o setresuid.o setrlimit.o setsid.o \ + setsockopt.o settimeofday.o \ setuid.o shmat.o shmctl.o shmdt.o shmget.o shutdown.o sigaction.o \ sigaltstack.o socket.o socketpair.o stat.o statfs.o swapon.o swapctl.o \ symlink.o sync.o sysarch.o umask.o undelete.o unlink.o unmount.o \ @@ -223,11 +224,11 @@ MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 chflags.2 \ nfssvc.2 open.2 pathconf.2 \ pipe.2 profil.2 poll.2 ptrace.2 quotactl.2 read.2 readlink.2 reboot.2 \ recv.2 rename.2 revoke.2 rfork.2 rmdir.2 select.2 send.2 setgroups.2 \ - setpgid.2 setsid.2 setuid.2 shutdown.2 sigaction.2 sigaltstack.2 \ - sigpending.2 sigprocmask.2 sigreturn.2 sigstack.2 sigsuspend.2 \ - socket.2 socketpair.2 stat.2 statfs.2 swapctl.2 symlink.2 sync.2 \ - sysarch.2 syscall.2 truncate.2 umask.2 unlink.2 utimes.2 vfork.2 \ - wait.2 write.2 + setpgid.2 setresuid.2 setsid.2 setuid.2 shutdown.2 sigaction.2 \ + sigaltstack.2 sigpending.2 sigprocmask.2 sigreturn.2 sigstack.2 \ + sigsuspend.2 socket.2 socketpair.2 stat.2 statfs.2 swapctl.2 symlink.2 \ + sync.2 sysarch.2 syscall.2 truncate.2 umask.2 unlink.2 utimes.2 \ + vfork.2 wait.2 write.2 MAN+= extattr_get_file.2 MLINKS+=extattr_get_file.2 extattr_set_file.2 \ diff --git a/lib/libc/sys/setresuid.2 b/lib/libc/sys/setresuid.2 new file mode 100644 index 00000000000..523a072c539 --- /dev/null +++ b/lib/libc/sys/setresuid.2 @@ -0,0 +1,96 @@ +.\" $OpenBSD: setresuid.2,v 1.1 2002/10/30 20:15:29 millert Exp $ +.\" +.\" 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: src/lib/libc/sys/setresuid.2,v 1.12 2001/10/01 16:09:02 ru Exp $ +.\" +.Dd October 20, 2002 +.Dt SETRESUID 2 +.Os +.Sh NAME +.Nm getresgid , +.Nm getresuid , +.Nm setresgid , +.Nm setresuid +.Nd "get or set real, effective and saved user or group ID" +.Sh SYNOPSIS +.Fd #include <sys/types.h> +.Fd #include <unistd.h> +.Ft int +.Fn getresgid "gid_t *rgid" "gid_t *egid" "gid_t *sgid" +.Ft int +.Fn getresuid "uid_t *ruid" "uid_t *euid" "uid_t *suid" +.Ft int +.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 +.Fn setresuid +function sets the real, +effective and saved user IDs of the current process. +The analogous +.Fn setresgid +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. +.Pp +The +.Fn getresgid +and +.Fn getresuid +calls retrieve the real, effective, and saved group and user IDs of +the current process, respectively. +.Sh RETURN VALUES +Upon success, these functions return 0; otherwise \-1 is returned. +.Sh ERRORS +.Bl -tag -width Er +.It Bq Er EPERM +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. +.It Bq Er EFAULT +An address passed to +.Fn getresgid +or +.Fn getresuid +was invalid. +.El +.Sh SEE ALSO +.Xr getegid 2 , +.Xr geteuid 2 , +.Xr getgid 2 , +.Xr getuid 2 , +.Xr issetugid 2 , +.Xr setgid 2 , +.Xr setregid 2 , +.Xr setreuid 2 , +.Xr setuid 2 +.Sh STANDARDS +These functions are not part of the +.St -p1003.1 +specification and should not be used where portability is desired. +.Sh HISTORY +These functions first appeared in HP-UX. |