diff options
author | ache <ache@FreeBSD.org> | 1995-04-27 19:27:42 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-04-27 19:27:42 +0000 |
commit | 7fa24f3661a9755d07d17cb80ef52f053205886c (patch) | |
tree | f9ff07fc15ef54e54bf7dd4436343d7a6cd75849 /usr.bin/at/privs.h | |
parent | 775ad02c2d1935bed5532a3743d4753fe65187fe (diff) | |
download | FreeBSD-src-7fa24f3661a9755d07d17cb80ef52f053205886c.zip FreeBSD-src-7fa24f3661a9755d07d17cb80ef52f053205886c.tar.gz |
Remove setre* hacks, we have working thing now
Diffstat (limited to 'usr.bin/at/privs.h')
-rw-r--r-- | usr.bin/at/privs.h | 57 |
1 files changed, 17 insertions, 40 deletions
diff --git a/usr.bin/at/privs.h b/usr.bin/at/privs.h index 5ed6c50..2fcaf10 100644 --- a/usr.bin/at/privs.h +++ b/usr.bin/at/privs.h @@ -2,25 +2,19 @@ * privs.h - header for privileged operations * Copyright (C) 1993 Thomas Koenig * - * 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. The name of the author(s) may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _PRIVS_H @@ -34,24 +28,6 @@ #include <unistd.h> #endif -#ifdef __FreeBSD__ -/* - * setre[ug]id() not change r[ug]id for FreeBSD, but check it incorrectly - * for this program - */ -#define setreuid(r, e) seteuid(e) -#define setregid(r, e) setegid(e) -#define SET_REAL_PRIV(a, b) {\ - setgid(b); \ - setuid(a); \ - } -#else -#define SET_REAL_PRIV(a. b) {\ - setregid((b), real_gid); \ - setreuid((a), real_uid); \ - } -#endif - /* Relinquish privileges temporarily for a setuid or setgid program * with the option of getting them back later. This is done by swapping * the real and effective userid BSD style. Call RELINQUISH_PRIVS once @@ -96,8 +72,8 @@ gid_t real_gid, effective_gid; effective_uid = geteuid(); \ real_gid = getgid(); \ effective_gid = getegid(); \ - setregid(effective_gid, real_gid); \ setreuid(effective_uid, real_uid); \ + setregid(effective_gid, real_gid); \ } #define RELINQUISH_PRIVS_ROOT(a,b) { \ @@ -105,8 +81,8 @@ gid_t real_gid, effective_gid; effective_uid = geteuid(); \ real_gid = (b); \ effective_gid = getegid(); \ - setregid(effective_gid, real_gid); \ setreuid(effective_uid, real_uid); \ + setregid(effective_gid, real_gid); \ } #define PRIV_START {\ @@ -114,8 +90,8 @@ gid_t real_gid, effective_gid; setregid(real_gid, effective_gid); #define PRIV_END \ - setregid(effective_gid, real_gid); \ setreuid(effective_uid, real_uid); \ + setregid(effective_gid, real_gid); \ } #define REDUCE_PRIV(a,b) {\ @@ -123,6 +99,7 @@ gid_t real_gid, effective_gid; setregid(real_gid, effective_gid); \ effective_uid = (a); \ effective_gid = (b); \ - SET_REAL_PRIV(a, b); \ + setregid(effective_gid, real_gid); \ + setreuid(effective_uid, real_uid); \ } #endif |