summaryrefslogtreecommitdiff
path: root/bin/rcp
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-12-22 02:57:53 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-12-22 02:57:53 +0000
commite568909a2dfe2282aa7a04e4362269a6bbe1ea6f (patch)
tree06e8ecd4d5adadf7bbe3d072c57fc1ed75151945 /bin/rcp
parentcd662cc5ca14c9185fe05b30854c26d3b5fe0525 (diff)
Deal with _POSIX_SAVED_IDS when relinquishing privileges
Diffstat (limited to 'bin/rcp')
-rw-r--r--bin/rcp/rcp.c5
-rw-r--r--bin/rcp/util.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c
index c2383c34fa2..39112c5d95f 100644
--- a/bin/rcp/rcp.c
+++ b/bin/rcp/rcp.c
@@ -1,5 +1,5 @@
/* $NetBSD: rcp.c,v 1.9 1995/03/21 08:19:06 cgd Exp $ */
-/* $OpenBSD: rcp.c,v 1.7 1996/12/14 12:18:13 mickey Exp $ */
+/* $OpenBSD: rcp.c,v 1.8 1996/12/22 02:57:51 tholo Exp $ */
/*
* Copyright (c) 1983, 1990, 1992, 1993
@@ -189,12 +189,14 @@ main(argc, argv)
if (fflag) { /* Follow "protocol", send data. */
(void)response();
+ (void)seteuid(userid);
(void)setuid(userid);
source(argc, argv);
exit(errs);
}
if (tflag) { /* Receive data. */
+ (void)seteuid(userid);
(void)setuid(userid);
sink(argc, argv);
exit(errs);
@@ -313,6 +315,7 @@ toremote(targ, argc, argv)
if (response() < 0)
exit(1);
(void)free(bp);
+ (void)seteuid(userid);
(void)setuid(userid);
}
source(1, argv+i);
diff --git a/bin/rcp/util.c b/bin/rcp/util.c
index aebe3b257ca..eeeaeac31ad 100644
--- a/bin/rcp/util.c
+++ b/bin/rcp/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.3 1996/09/03 09:35:31 deraadt Exp $ */
+/* $OpenBSD: util.c,v 1.4 1996/12/22 02:57:52 tholo Exp $ */
/* $NetBSD: util.c,v 1.2 1995/03/21 08:19:08 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)util.c 8.2 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: util.c,v 1.3 1996/09/03 09:35:31 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.4 1996/12/22 02:57:52 tholo Exp $";
#endif
#endif /* not lint */
@@ -122,6 +122,7 @@ susystem(s, userid)
return (127);
case 0:
+ (void)seteuid(userid);
(void)setuid(userid);
execl(_PATH_BSHELL, "sh", "-c", s, NULL);
_exit(127);