diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/rlogind.orig/Makefile netstd/rlogind/Makefile
*** netstd.orig/rlogind.orig/Makefile	Thu Jan  1 01:00:00 1970
--- netstd/rlogind/Makefile	Sun Apr  9 15:36:47 1995
***************
*** 0 ****
--- 1,16 ----
+ CFLAGS = -O2 -fomit-frame-pointer -m486 \
+ 		-include /usr/include/bsd/bsd.h -I/usr/include/bsd \
+ 		# -DKERBEROS -DCRYPT
+ LDLIBS = -lbsd # -lutil -lkrb -ldes
+ LDFLAGS = -s -v
+ 
+ rlogind: rlogind.o rcmd.o logwtmp.o # des_rw.o
+ 
+ install: rlogind
+ 	install -o root -g root -m 0755 rlogind ${DEBDIR}/usr/sbin/in.rlogind
+ 	install -o root -g root -m 0644 rlogind.8 ${DEBDIR}/usr/man/man8
+ 	install -o root -g root -m 0644 in.rlogind.8 ${DEBDIR}/usr/man/man8
+ 
+ clean:
+ 	rm -f *.o rlogind
+ 
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/rlogind.orig/README.Debian netstd/rlogind/README.Debian
*** netstd.orig/rlogind.orig/README.Debian	Thu Jan  1 01:00:00 1970
--- netstd/rlogind/README.Debian	Fri Jan 27 03:57:34 1995
***************
*** 0 ****
--- 1,11 ----
+ Last update: 01/27/95
+ 
+ The following things have been changed for the Debian distribution:
+ 
+ - applied a patch from Florian La Roche <rzsfl@rz.uni-sb.de>
+ - changed the makefile (install target)
+ - added a patch that fixes a security problem
+ - added a fixed version of the libc rcmd.c
+ 
+ 
+ Peter Tobias <tobias@et-inf.fho-emden.de>
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/rlogind.orig/in.rlogind.8 netstd/rlogind/in.rlogind.8
*** netstd.orig/rlogind.orig/in.rlogind.8	Thu Jan  1 01:00:00 1970
--- netstd/rlogind/in.rlogind.8	Thu May 12 14:03:17 1994
***************
*** 0 ****
--- 1 ----
+ .so man8/rlogind.8
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/rlogind.orig/inetprivate.h netstd/rlogind/inetprivate.h
*** netstd.orig/rlogind.orig/inetprivate.h	Thu Jan  1 01:00:00 1970
--- netstd/rlogind/inetprivate.h	Wed Jul 19 19:04:39 1995
***************
*** 0 ****
--- 1,49 ----
+ #include <sys/types.h>
+ #include <sys/uio.h>
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <ctype.h>
+ #include <netdb.h>
+ #include <stdio.h>
+ #include <errno.h>
+ #include <sys/time.h>
+ #include <arpa/inet.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ 
+ #include <net/if.h>
+ #include <linux/sockios.h>
+ 
+ extern void _sethtent(int f);
+ extern void _endhtent(void);
+ extern struct hostent *_gethtent(void);
+ extern struct hostent *_gethtbyname(const char *name);
+ extern struct hostent *_gethtbyaddr(const char *addr, int len,
+ 		 int type);
+ extern int _validuser(FILE *hostf, const char *rhost,
+ 		 const char *luser, const char *ruser, int baselen);
+ extern int _checkhost(const char *rhost, const char *lhost, int len);
+ 
+ #ifndef __linux__
+ /* see resolv.h */
+ extern u_short _getshort(u_char *msgp);
+ extern u_long _getlong(u_char *msgp);
+ extern void putlong(u_long l, u_char *msgp);
+ extern void p_query(char *msg);
+ extern void fp_query(char *msg, FILE *file);
+ extern char *p_cdname(char *cp, char *msg, FILE *file);
+ extern char *p_rr(char *cp, char *msg, FILE *file);
+ extern char *p_type(int type);
+ extern char * p_class(int class);
+ extern char *p_time(u_long value);
+ #endif
+ 
+ extern void putshort(u_short l, u_char *msgp);
+ extern char * hostalias(const char *name);
+ extern void sethostfile(char *name);
+ extern void _res_close (void);
+ extern void ruserpass(const char *host, char **aname, char **apass);
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/rlogind.orig/logwtmp.c netstd/rlogind/logwtmp.c
*** netstd.orig/rlogind.orig/logwtmp.c	Thu Jan  1 01:00:00 1970
--- netstd/rlogind/logwtmp.c	Thu Jul 28 21:51:35 1994
***************
*** 0 ****
--- 1,66 ----
+ /*
+  * Copyright (c) 1988 The Regents of the University of California.
+  * All rights reserved.
+  *
+  * 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. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 3. All advertising materials mentioning features or use of this software
+  *    must display the following acknowledgement:
+  *	This product includes software developed by the University of
+  *	California, Berkeley and its contributors.
+  * 4. Neither the name of the University nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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, WHETHER 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.
+  */
+ 
+ #include <sys/types.h>
+ #include <sys/file.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <utmp.h>
+ 
+ 
+ logwtmp(line, name, host)
+ 	char *line, *name, *host;
+ {
+ 	struct utmp ut;
+ 	struct stat buf;
+ 	int fd;
+ 	time_t time();
+ 	char *strncpy();
+ 
+ 	if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0)
+ 		return;
+ 	if (fstat(fd, &buf) == 0) {
+ 		ut.ut_pid = getpid();
+ 		ut.ut_type = (name[0] != '\0')? USER_PROCESS : DEAD_PROCESS;
+ 		(void) strncpy(ut.ut_id, "", 2);
+ 		(void) strncpy(ut.ut_line, line, sizeof(ut.ut_line));
+ 		(void) strncpy(ut.ut_name, name, sizeof(ut.ut_name));
+ 		(void) strncpy(ut.ut_host, host, sizeof(ut.ut_host));
+ 		(void) time(&ut.ut_time);
+ 		if (write(fd, (char *)&ut, sizeof(struct utmp)) !=
+ 		    sizeof(struct utmp))
+ 			(void) ftruncate(fd, buf.st_size);
+ 	}
+ 	(void) close(fd);
+ }
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/rlogind.orig/pathnames.h netstd/rlogind/pathnames.h
*** netstd.orig/rlogind.orig/pathnames.h	Fri Dec 17 07:33:54 1993
--- netstd/rlogind/pathnames.h	Sat Apr 16 22:57:02 1994
***************
*** 36,39 ****
  
  #include <paths.h>
  
! #define	_PATH_LOGIN	"/usr/bin/login"
--- 36,39 ----
  
  #include <paths.h>
  
! #define	_PATH_LOGIN	"/bin/login"
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/rlogind.orig/rcmd.c netstd/rlogind/rcmd.c
*** netstd.orig/rlogind.orig/rcmd.c	Thu Jan  1 01:00:00 1970
--- netstd/rlogind/rcmd.c	Fri Jan 27 03:48:58 1995
***************
*** 0 ****
--- 1,418 ----
+ /*
+  * Copyright (c) 1983 Regents of the University of California.
+  * All rights reserved.
+  *
+  * Redistribution and use in source and binary forms are permitted
+  * provided that the above copyright notice and this paragraph are
+  * duplicated in all such forms and that any documentation,
+  * advertising materials, and other materials related to such
+  * distribution and use acknowledge that the software was developed
+  * by the University of California, Berkeley.  The name of the
+  * University may not be used to endorse or promote products derived
+  * from this software without specific prior written permission.
+  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+  */
+ 
+ #if defined(LIBC_SCCS) && !defined(lint)
+ static char sccsid[] = "@(#)rcmd.c	5.17 (Berkeley) 6/27/88";
+ #endif /* LIBC_SCCS and not lint */
+ 
+ #include "inetprivate.h"
+ #include <pwd.h>
+ #include <sys/file.h>
+ #include <sys/signal.h>
+ #include <sys/stat.h>
+ 
+ #if NLS
+ #include "nl_types.h"
+ #endif
+ 
+ int
+ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
+ 	char **ahost;
+ 	unsigned short rport;
+ 	const char *locuser, *remuser, *cmd;
+ 	int *fd2p;
+ {
+ 	int s, timo = 1;
+ #ifdef F_SETOWN
+ 	pid_t pid;
+ #endif
+ #ifdef _POSIX_SOURCE
+ 	sigset_t set, oset;
+ #else
+ 	long oldmask;
+ #endif
+ 	struct sockaddr_in sin, from;
+ 	char c;
+ 	int lport = IPPORT_RESERVED - 1;
+ 	struct hostent *hp;
+ 
+ #if NLS
+ 	libc_nls_init();
+ #endif
+ 
+ #ifdef F_SETOWN
+ 	pid = getpid();
+ #endif
+ 	hp = gethostbyname(*ahost);
+ 	if (hp == 0) {
+ #if NLS
+ 		fprintf(stderr, "%s: %s\n", *ahost,
+                               catgets(_libc_cat, HerrorListSet,
+ 				      2, "unknown host"));
+ #else
+ 		fprintf(stderr, "%s: unknown host\n", *ahost);
+ #endif
+ 		return (-1);
+ 	}
+ 	*ahost = hp->h_name;
+ #ifdef SIGURG
+ #ifdef _POSIX_SOURCE
+ 	sigemptyset (&set);
+ 	sigaddset (&set, SIGURG);
+ 	sigprocmask (SIG_BLOCK, &set, &oset);
+ #else
+ 	oldmask = sigblock(sigmask(SIGURG));
+ #endif
+ #endif
+ 	for (;;) {
+ 		s = rresvport(&lport);
+ 		if (s < 0) {
+ 			if (errno == EAGAIN)
+ #if NLS
+ 				fprintf(stderr, "socket: %s\n",
+ 					catgets(_libc_cat, NetMiscSet,
+ 						NetMiscAllPortsInUse,
+ 						"All ports in use"));
+ #else
+ 				fprintf(stderr, "socket: All ports in use\n");
+ #endif
+ 			else
+ #if NLS
+ 				perror(catgets(_libc_cat, NetMiscSet,
+ 					       NetMiscRcmdSocket,
+ 					       "rcmd: socket"));
+ #else
+ 				perror("rcmd: socket");
+ #endif
+ #ifdef SIGURG
+ #ifdef _POSIX_SOURCE
+ 			 sigprocmask (SIG_SETMASK, &oset,
+ 				(sigset_t *)NULL);
+ #else
+ 			sigsetmask(oldmask);
+ #endif
+ #endif
+ 			return (-1);
+ 		}
+ #ifdef F_SETOWN
+ 		fcntl(s, F_SETOWN, pid);
+ #endif
+ 		sin.sin_family = hp->h_addrtype;
+ 		bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length);
+ 		sin.sin_port = rport;
+ 		if (connect(s, (struct sockaddr *)&sin, sizeof (sin)) >= 0)
+ 			break;
+ 		(void) close(s);
+ 		if (errno == EADDRINUSE) {
+ 			lport--;
+ 			continue;
+ 		}
+ 		if (errno == ECONNREFUSED && timo <= 16) {
+ 			sleep(timo);
+ 			timo *= 2;
+ 			continue;
+ 		}
+ 		if (hp->h_addr_list[1] != NULL) {
+ 			int oerrno = errno;
+ 
+ 			fprintf(stderr,
+ #if NLS
+ 				"%s %s: ", catgets(_libc_cat, NetMiscSet,
+ 						   NetMiscAllPortsInUse,
+ 						   "connect to address"),
+ 					   inet_ntoa(sin.sin_addr));
+ 
+ #else
+ 
+ 			    "connect to address %s: ", inet_ntoa(sin.sin_addr));
+ #endif
+ 			errno = oerrno;
+ 			perror(0);
+ 			hp->h_addr_list++;
+ 			bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr,
+ 			    hp->h_length);
+ 
+ #if NLS
+ 			fprintf(stderr, catgets(_libc_cat, NetMiscSet,
+ 						NetMiscTrying,
+ 						"Trying %s...\n"),
+ #else
+ 			fprintf(stderr,	"Trying %s...\n",
+ #endif
+ 				inet_ntoa(sin.sin_addr));
+ 			continue;
+ 		}
+ 		perror(hp->h_name);
+ #ifdef SIGURG
+ #ifdef _POSIX_SOURCE
+ 		sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
+ #else
+ 		sigsetmask(oldmask);
+ #endif
+ #endif
+ 		return (-1);
+ 	}
+ 	lport--;
+ 	if (fd2p == 0) {
+ 		write(s, "", 1);
+ 		lport = 0;
+ 	} else {
+ 		char num[8];
+ 		int s2 = rresvport(&lport), s3;
+ 		int len = sizeof (from);
+ 
+ 		if (s2 < 0)
+ 			goto bad;
+ 		listen(s2, 1);
+ 		(void) sprintf(num, "%d", lport);
+ 		if (write(s, num, strlen(num)+1) != strlen(num)+1) {
+ #if NLS
+ 			perror(catgets(_libc_cat, NetMiscSet,
+ 				       NetMiscSettingUpStderr,
+ 				       "write: setting up stderr"));
+ #else
+ 			perror("write: setting up stderr");
+ #endif
+ 			(void) close(s2);
+ 			goto bad;
+ 		}
+ 		s3 = accept(s2, (struct sockaddr *)&from, &len);
+ 		(void) close(s2);
+ 		if (s3 < 0) {
+ #if NLS
+ 			perror(catgets(_libc_cat, NetMiscSet,
+ 				       NetMiscAccept,
+ 				       "accept"));
+ #else
+ 			perror("accept");
+ #endif
+ 			lport = 0;
+ 			goto bad;
+ 		}
+ 		*fd2p = s3;
+ 		from.sin_port = ntohs((u_short)from.sin_port);
+ 		if (from.sin_family != AF_INET ||
+ 		    from.sin_port >= IPPORT_RESERVED) {
+ 			fprintf(stderr,
+ #if NLS
+ 				"%s\n",
+ 				catgets(_libc_cat, NetMiscSet,
+ 					NetMiscProtocolFailure,
+ 					"socket: protocol failure in circuit setup."));
+ #else
+ 			    "socket: protocol failure in circuit setup.\n");
+ #endif
+ 			goto bad2;
+ 		}
+ 	}
+ 	(void) write(s, locuser, strlen(locuser)+1);
+ 	(void) write(s, remuser, strlen(remuser)+1);
+ 	(void) write(s, cmd, strlen(cmd)+1);
+ 	if (read(s, &c, 1) != 1) {
+ 		perror(*ahost);
+ 		goto bad2;
+ 	}
+ 	if (c != 0) {
+ 		while (read(s, &c, 1) == 1) {
+ 			(void) write(2, &c, 1);
+ 			if (c == '\n')
+ 				break;
+ 		}
+ 		goto bad2;
+ 	}
+ #ifdef SIGURG
+ #ifdef _POSIX_SOURCE
+ 	sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
+ #else
+ 	sigsetmask(oldmask);
+ #endif
+ #endif
+ 	return (s);
+ bad2:
+ 	if (lport)
+ 		(void) close(*fd2p);
+ bad:
+ 	(void) close(s);
+ #ifdef SIGURG
+ #ifdef _POSIX_SOURCE
+ 	sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
+ #else
+ 	sigsetmask(oldmask);
+ #endif
+ #endif
+ 	return (-1);
+ }
+ 
+ int
+ rresvport(alport)
+ 	int *alport;
+ {
+ 	struct sockaddr_in sin;
+ 	int s;
+ 
+ 	sin.sin_family = AF_INET;
+ 	sin.sin_addr.s_addr = INADDR_ANY;
+ 	s = socket(AF_INET, SOCK_STREAM, 0);
+ 	if (s < 0)
+ 		return (-1);
+ 	for (;;) {
+ 		sin.sin_port = htons((u_short)*alport);
+ 		if (bind(s, (struct sockaddr *)&sin, sizeof (sin)) >= 0)
+ 			return (s);
+ 		if (errno != EADDRINUSE) {
+ 			(void) close(s);
+ 			return (-1);
+ 		}
+ 		(*alport)--;
+ 		if (*alport == IPPORT_RESERVED/2) {
+ 			(void) close(s);
+ 			errno = EAGAIN;		/* close */
+ 			return (-1);
+ 		}
+ 	}
+ }
+ 
+ int
+ ruserok(const char *rhost, int superuser, const char *ruser,
+ 	const char *luser)
+ {
+ 	FILE *hostf;
+ 	char fhost[MAXHOSTNAMELEN];
+ 	int first = 1;
+ 	register const char *sp;
+ 	register char *p;
+ 	int baselen = -1;
+ 	uid_t saveuid;
+ 
+ 	saveuid = geteuid();
+ 	sp = rhost;
+ 	p = fhost;
+ 	while (*sp) {
+ 		if (*sp == '.') {
+ 			if (baselen == -1)
+ 				baselen = sp - rhost;
+ 			*p++ = *sp++;
+ 		} else {
+ 			*p++ = isupper(*sp) ? tolower(*sp++) : *sp++;
+ 		}
+ 	}
+ 	*p = '\0';
+ 	hostf = superuser ? (FILE *)0 : fopen(_PATH_HEQUIV, "r");
+ again:
+ 	if (hostf) {
+ 		if (!_validuser(hostf, fhost, luser, ruser, baselen)) {
+ 			(void) fclose(hostf);
+ 			seteuid(saveuid);
+ 			return(0);
+ 		}
+ 		(void) fclose(hostf);
+ 	}
+ 	if (first == 1) {
+ 		struct stat sbuf;
+ 		struct passwd *pwd;
+ 		char pbuf[MAXPATHLEN];
+ 
+ 		first = 0;
+ 		if ((pwd = getpwnam(luser)) == NULL)
+ 			return(-1);
+ 		(void)strcpy(pbuf, pwd->pw_dir);
+ 		(void)strcat(pbuf, "/.rhosts");
+ 		(void)seteuid(pwd->pw_uid);
+ 		if ((hostf = fopen(pbuf, "r")) == NULL) {
+ 			seteuid(saveuid);
+ 			return(-1);
+ 		}
+ 		(void)fstat(fileno(hostf), &sbuf);
+ 		if (sbuf.st_uid && sbuf.st_uid != pwd->pw_uid) {
+ 			fclose(hostf);
+ 			seteuid(saveuid);
+ 			return(-1);
+ 		}
+ 		goto again;
+ 	}
+ 	seteuid(saveuid);
+ 	return (-1);
+ }
+ 
+ int
+ _validuser(FILE *hostf, const char *rhost, const char *luser,
+ 	const char *ruser, int baselen)
+ {
+ 	char *user;
+ 	char ahost[MAXHOSTNAMELEN];
+ 	register char *p;
+ 
+ 	while (fgets(ahost, sizeof (ahost), hostf)) {
+ 		p = ahost;
+ 		while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') {
+ 			*p = isupper(*p) ? tolower(*p) : *p;
+ 			p++;
+ 		}
+ 		if (*p == ' ' || *p == '\t') {
+ 			*p++ = '\0';
+ 			while (*p == ' ' || *p == '\t')
+ 				p++;
+ 			user = p;
+ 			while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0')
+ 				p++;
+ 		} else
+ 			user = p;
+ 		*p = '\0';
+ 		if (_checkhost(rhost, ahost, baselen) &&
+ 		    !strcmp(ruser, *user ? user : luser)) {
+ 			return (0);
+ 		}
+ 	}
+ 	return (-1);
+ }
+ 
+ int
+ _checkhost(const char *rhost, const char *lhost, int len)
+ {
+ 	static char ldomain[MAXHOSTNAMELEN + 1];
+ 	static char *domainp = NULL;
+ 	static int nodomain = 0;
+ 	static struct hostent *hp;
+ 	register char *cp;
+ 
+ 	if (len == -1)
+ 		return(!strcmp(rhost, lhost));
+ 	if (strncmp(rhost, lhost, len))
+ 		return(0);
+ 	if (!strcmp(rhost, lhost))
+ 		return(1);
+ 	if (*(lhost + len) != '\0')
+ 		return(0);
+ 	if (nodomain)
+ 		return(0);
+ 	if (!domainp) {
+ 		if (gethostname(ldomain, sizeof(ldomain)) == -1) {
+ 			nodomain = 1;
+ 			return(0);
+ 		}
+ 		if ((hp = gethostbyname(ldomain)) == NULL)
+ 			return(0);
+ 		if ((domainp = index(hp->h_name, '.')) == (char *)NULL) {
+ 			nodomain = 1;
+ 			return(0);
+ 		}
+ 		for (cp = ++domainp; *cp; ++cp)
+ 			if (isupper(*cp))
+ 				*cp = tolower(*cp);
+ 	}
+ 	return(!strcmp(domainp, rhost + len +1));
+ }
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/rlogind.orig/rlogind.c netstd/rlogind/rlogind.c
*** netstd.orig/rlogind.orig/rlogind.c	Fri Dec 17 07:33:55 1993
--- netstd/rlogind/rlogind.c	Thu May 18 20:11:15 1995
***************
*** 58,74 ****
   *	data
   */
  
- #define	FD_SETSIZE	16		/* don't need many bits for select */
  #include <sys/param.h>
  #include <sys/stat.h>
  #include <sys/ioctl.h>
  #include <signal.h>
  #include <termios.h>
  
  #include <sys/socket.h>
  #include <netinet/in.h>
- #include <netinet/in_systm.h>
- #include <netinet/ip.h>
  #include <arpa/inet.h>
  #include <netdb.h>
  
--- 58,72 ----
   *	data
   */
  
  #include <sys/param.h>
  #include <sys/stat.h>
  #include <sys/ioctl.h>
+ #include <sys/time.h>
  #include <signal.h>
  #include <termios.h>
  
  #include <sys/socket.h>
  #include <netinet/in.h>
  #include <arpa/inet.h>
  #include <netdb.h>
  
***************
*** 163,168 ****
--- 161,167 ----
  		fatal(STDERR_FILENO, "only one of -k and -v allowed", 0);
  	}
  #endif
+ 	from.sin_family = AF_INET;
  	fromlen = sizeof (from);
  	if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0) {
  		syslog(LOG_ERR,"Can't get peer name of remote host: %m");
***************
*** 171,179 ****
--- 170,180 ----
  	if (keepalive &&
  	    setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0)
  		syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m");
+ #ifdef IP_TOS
  	on = IPTOS_LOWDELAY;
  	if (setsockopt(0, IPPROTO_IP, IP_TOS, (char *)&on, sizeof(int)) < 0)
  		syslog(LOG_WARNING, "setsockopt (IP_TOS): %m");
+ #endif
  	doit(0, &from);
  }
  
***************
*** 330,337 ****
--- 331,344 ----
  			execl(_PATH_LOGIN, "login", "-p",
  			    "-h", hp->h_name, "-f", lusername, 0);
  		} else
+ 		{
+ 			if (*lusername=='-') {
+ 				syslog(LOG_AUTH|LOG_INFO, "rlogin with an option as a name!");
+ 				exit(1);
+ 			}
  			execl(_PATH_LOGIN, "login", "-p",
  			    "-h", hp->h_name, lusername, 0);
+ 		}
  		fatal(STDERR_FILENO, _PATH_LOGIN, 1);
  		/*NOTREACHED*/
  	}
***************
*** 551,560 ****
  	p = line + sizeof(_PATH_DEV) - 1;
  	if (logout(p))
  		logwtmp(p, "", "");
! 	(void)chmod(line, 0666);
  	(void)chown(line, 0, 0);
  	*p = 'p';
! 	(void)chmod(line, 0666);
  	(void)chown(line, 0, 0);
  	shutdown(netf, 2);
  	exit(1);
--- 558,567 ----
  	p = line + sizeof(_PATH_DEV) - 1;
  	if (logout(p))
  		logwtmp(p, "", "");
! 	(void)chmod(line, 0600);
  	(void)chown(line, 0, 0);
  	*p = 'p';
! 	(void)chmod(line, 0600);
  	(void)chown(line, 0, 0);
  	shutdown(netf, 2);
  	exit(1);
***************
*** 623,629 ****
  	char *speed;
  	struct termios tt;
  
! #ifndef notyet
  	tcgetattr(fd, &tt);
  	if (cp) {
  		*cp++ = '\0';
--- 630,636 ----
  	char *speed;
  	struct termios tt;
  
! #ifdef notyet
  	tcgetattr(fd, &tt);
  	if (cp) {
  		*cp++ = '\0';
