-/* $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 $ */
/*
#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 */
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;
int ch, len, mtfd, flags;
char *p, *tape, *realtape;
- uid = getuid();
- euid = geteuid();
- (void) seteuid(uid);
-
if ((progname = strrchr(argv[0], '/')))
progname++;
else
if (rmthost(host) == 0)
exit(X_ABORT);
}
- (void) setuid(uid); /* rmthost() is the only reason to be setuid */
if (eject)
comp = &com[COM_EJECT];
-/* $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 $ */
/*-
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 */));
} 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 */
(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");