summaryrefslogtreecommitdiff
path: root/usr.bin/rsh
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-12-22 03:26:11 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-12-22 03:26:11 +0000
commitb9e51bce4b9f1693731b39bfbb2873af2e60d83c (patch)
tree9844363957c023a88374765f72c1a49440395ac5 /usr.bin/rsh
parenta34740287ce7a6f408b47749029e29e62a63724d (diff)
Deal with _POSIX_SAVED_IDS when relinquishing privileges
Diffstat (limited to 'usr.bin/rsh')
-rw-r--r--usr.bin/rsh/rsh.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/rsh/rsh.c b/usr.bin/rsh/rsh.c
index 544a754bb0d..517a400afa5 100644
--- a/usr.bin/rsh/rsh.c
+++ b/usr.bin/rsh/rsh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsh.c,v 1.9 1996/09/02 21:28:04 millert Exp $ */
+/* $OpenBSD: rsh.c,v 1.10 1996/12/22 03:26:02 tholo Exp $ */
/*-
* Copyright (c) 1983, 1990 The Regents of the University of California.
@@ -41,7 +41,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)rsh.c 5.24 (Berkeley) 7/1/91";*/
-static char rcsid[] = "$OpenBSD: rsh.c,v 1.9 1996/09/02 21:28:04 millert Exp $";
+static char rcsid[] = "$OpenBSD: rsh.c,v 1.10 1996/12/22 03:26:02 tholo Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -168,6 +168,7 @@ main(argc, argv)
if (!argv[optind]) {
if (asrsh)
*argv = "rlogin";
+ seteuid(getuid());
setuid(getuid());
execv(_PATH_RLOGIN, argv);
(void)fprintf(stderr, "rsh: can't exec %s.\n", _PATH_RLOGIN);
@@ -274,6 +275,7 @@ try_connect:
strerror(errno));
}
+ (void)seteuid(uid);
(void)setuid(uid);
omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGTERM));
if (signal(SIGINT, SIG_IGN) != SIG_IGN)