summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/mt/mt.c11
-rw-r--r--bin/mt/mtrmt.c9
2 files changed, 4 insertions, 16 deletions
diff --git a/bin/mt/mt.c b/bin/mt/mt.c
index ee87ff2fda7..b88c788e0a8 100644
--- a/bin/mt/mt.c
+++ b/bin/mt/mt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mt.c,v 1.13 1996/08/10 22:43:00 deraadt Exp $ */
+/* $OpenBSD: mt.c,v 1.14 1996/09/02 05:37:10 deraadt Exp $ */
/* $NetBSD: mt.c,v 1.14.2.1 1996/05/27 15:12:11 mrg Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)mt.c 8.2 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: mt.c,v 1.13 1996/08/10 22:43:00 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: mt.c,v 1.14 1996/09/02 05:37:10 deraadt Exp $";
#endif
#endif /* not lint */
@@ -100,8 +100,6 @@ void status __P((struct mtget *));
void usage __P((void));
char *host = NULL; /* remote host (if any) */
-uid_t uid; /* read uid */
-uid_t euid; /* effective uid */
char *progname;
int eject = 0;
@@ -117,10 +115,6 @@ main(argc, argv)
int ch, len, mtfd, flags;
char *p, *tape, *realtape;
- uid = getuid();
- euid = geteuid();
- (void) seteuid(uid);
-
if ((progname = strrchr(argv[0], '/')))
progname++;
else
@@ -168,7 +162,6 @@ main(argc, argv)
if (rmthost(host) == 0)
exit(X_ABORT);
}
- (void) setuid(uid); /* rmthost() is the only reason to be setuid */
if (eject)
comp = &com[COM_EJECT];
diff --git a/bin/mt/mtrmt.c b/bin/mt/mtrmt.c
index db811d58fb1..5629272cd42 100644
--- a/bin/mt/mtrmt.c
+++ b/bin/mt/mtrmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mtrmt.c,v 1.3 1996/09/01 15:29:21 millert Exp $ */
+/* $OpenBSD: mtrmt.c,v 1.4 1996/09/02 05:37:11 deraadt Exp $ */
/* $NetBSD: mtrmt.c,v 1.2 1996/03/06 06:22:07 scottr Exp $ */
/*-
@@ -81,9 +81,6 @@ static int rmtstate = TS_CLOSED;
static int rmtape;
static char *rmtpeer;
-extern int uid;
-extern int euid;
-
static int okname __P((char *));
static int rmtcall __P((char *, char *));
static void rmtconnaborted __P((/* int, int */));
@@ -146,10 +143,8 @@ rmtgetconn()
} else
tuser = pwd->pw_name;
- (void) seteuid(euid);
rmtape = rcmd(&rmtpeer, (u_short)sp->s_port, pwd->pw_name, tuser,
_PATH_RMT, (int *)0);
- (void) setuid(uid); /* Just to be Really Really Safe */
if (rmtape == -1)
exit(1); /* rcmd already printed error message */
@@ -165,7 +160,7 @@ rmtgetconn()
(void)setsockopt(rmtape, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size));
maxseg = 1024;
- if (setsockopt(rmtape, IPPROTO_TCP, TCP_MAXSEG,
+ if (getuid() == 0 && setsockopt(rmtape, IPPROTO_TCP, TCP_MAXSEG,
&maxseg, sizeof (maxseg)) < 0)
perror("TCP_MAXSEG setsockopt");