--- telnetd/pathnames.h.orig	Sat Jun 15 17:26:10 1996
+++ telnetd/pathnames.h	Sat Oct 17 22:11:51 1998
@@ -53,7 +53,7 @@
 /* I'm working on having this work as is with SunOS 5.x */
 #ifndef USE_SRALOGIN
 #undef _PATH_LOGIN
-#ifdef __bsdi__
+#if defined(__bsdi__) || defined(__FreeBSD__)
 #define	_PATH_LOGIN	"/usr/bin/login"
 #else 
 #define	_PATH_LOGIN	"/bin/login"
--- telnetd/sys_term.c.orig	Sat Aug  2 14:37:00 1997
+++ telnetd/sys_term.c	Sat Oct 17 22:11:51 1998
@@ -531,7 +531,7 @@
 	return(p);
 #else
 
-	register char c, *p1, *p2;
+	register char c, *p1, *p2, *cp;
 	register int i;
 
 #if defined(__GNUC__) || defined(__sgi)
@@ -548,20 +548,40 @@
 	p1 = &line[8];
 	p2 = &line[9];
 #endif
-
-	for (c = 'p'; c <= 's'; c++) {
+	for (cp = "pqrsPQRS"; *cp; cp++) {
 		struct stat stb;
 
-		*p1 = c;
+		*p1 = *cp;
 		*p2 = '0';
+		/*
+		 * This stat() check is just to keep us from
+		 * looping through all 256 combinations if there
+		 * aren't that many ptys available.
+		 */
 		if (stat(line, &stb) < 0)
 			break;
-		for (i = 0; i < 16; i++) {
-			*p2 = "0123456789abcdef"[i];
+		for (i = 0; i < 32; i++) {
+			*p2 = "0123456789abcdefghijklmnopqrstuv"[i];
 			p = open(line, 2);
 			if (p > 0) {
+#ifndef __hpux
 				line[5] = 't';
-				return(p);
+#else
+				for (p1 = &line[8]; *p1; p1++)
+					*p1 = *(p1+1);
+				line[9] = 't';
+#endif
+				chown(line, 0, 0);
+				chmod(line, 0600);
+#if defined(sun) && defined(TIOCGPGRP) && BSD < 199207
+				if (ioctl(p, TIOCGPGRP, &dummy) == 0
+				    || errno != EIO) {
+					chmod(line, 0666);
+					close(p);
+					line[5] = 'p';
+				} else
+#endif /* defined(sun) && defined(TIOCGPGRP) && BSD < 199207 */
+					return(p);
 			}
 		}
 	}
@@ -733,11 +753,7 @@
 	else
 		termbuf.lflags &= ~LPASS8;
 #else
-	if (on) {
-		termbuf.c_iflag &= ~ISTRIP;
-	} else {
-		termbuf.c_iflag |= ISTRIP;
-	}
+	termbuf.c_iflag &= ~ISTRIP;
 #endif
 }
 
--- telnetd/telnetd.c.orig	Sat Aug  2 14:40:48 1997
+++ telnetd/telnetd.c	Sat Oct 17 22:13:52 1998
@@ -140,7 +140,7 @@
 	highpty = getnpty();
 #endif /* CRAY */
 
-	while ((ch = getopt(argc, argv, "d:a:e:lhnr:I:D:B:sS:a:X:z:")) != EOF) {
+	while ((ch = getopt(argc, argv, "d:a:e:lhnr:I:D:B:sS:a:X:z:q")) != EOF) {
 		switch(ch) {
 
 #ifdef USE_SSL
@@ -203,6 +203,11 @@
 
 			}
 			break;
+
+		case 'q':
+			ssl_quiet_flag = 1;
+			break;
+			
 #endif /* USE_SSL */
 
 #ifdef	AUTHENTICATE
@@ -584,7 +589,7 @@
 #ifdef USE_SSL
         /* might as well output something useful here ... */
 	fprintf(stderr, " [-z ssl] [-z secure] [-z debug] [-z verify=int]\n\t");
-	fprintf(stderr, " [-z cert=file] [-z key=file]\n\t");
+	fprintf(stderr, " [-z cert=file] [-z key=file] [-q]\n\t");
 #endif /* USE_SSL */
 	fprintf(stderr, " [port]\n");
 	exit(1);
@@ -656,7 +661,12 @@
 		fflush(stderr);
 	    }
 
-	    fatal(net,"[SSL required - connection rejected]");
+	    if (ssl_quiet_flag) {
+		sleep(1);
+		exit(1);
+	    }
+	    else
+		fatal(net,"[SSL required - connection rejected]");
 
 	}
     }
--- telnetd/Makefile.orig	Tue Sep 12 10:22:51 1995
+++ telnetd/Makefile	Sat Oct 17 22:11:51 1998
@@ -4,16 +4,13 @@
 
 PROG=	telnetd
 
-CFLAGS= -DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -DAUTHENTICATE -DUSE_SSL \
-	-DDIAGNOSTICS -DFILIO_H \
-	-I../lib -I../lib/libbsd/include \
+CFLAGS+= -DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -DAUTHENTICATE -DUSE_SSL \
+	-DDIAGNOSTICS -DFILIO_H -I../lib -I../lib/libbsd/include \
 	-I$(SSLTOP)/include
 
 LIBS= 	../lib/libtelnet/libtelnet.a \
-	../lib/libbsd/libbsd.a \
-	../lib/libutil/libutil.a \
 	$(SSLTOP)/lib/libssl.a \
-	$(SSLTOP)/lib/libcrypto.a 
+	$(SSLTOP)/lib/libcrypto.a -lutil
 #	$(SSLTOP)/lib/libdes.a
 
 OBJS=	authenc.o global.o slc.o state.o sys_term.o telnetd.o \
