1 diff -uNr telnet/Makefile telnet.obsd-cvs/Makefile
2 --- telnet/Makefile Mon Jul 27 18:25:13 1998
3 +++ telnet.obsd-cvs/Makefile Sat Mar 10 10:54:26 2001
8 -CFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -DSKEY -Dunix
9 -CFLAGS+=-DENV_HACK -D_USE_OLD_CURSES_
10 +CFLAGS+=-DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK -DSKEY -Dunix
11 CFLAGS+=-I${.CURDIR}/../../lib
12 -LDADD+= -locurses -ltelnet
13 -DPADD= ${LIBOLDCURSES} ${LIBTELNET}
14 +LDADD+= -lcurses -ltelnet
15 +DPADD= ${LIBCURSES} ${LIBTELNET
17 SRCS= authenc.c commands.c main.c network.c ring.c sys_bsd.c telnet.c \
18 terminal.c tn3270.c utilities.c
20 .include <bsd.own.mk> # for KERBEROS
22 -.if (${KERBEROS} == "yes")
23 +.if (${KERBEROS:L} == "yes")
24 CFLAGS+=-DENCRYPTION -DAUTHENTICATION -DKRB4
26 DPADD+= ${LIBDES} ${LIBKRB}
29 .include <bsd.prog.mk>
31 diff -uNr telnet/commands.c telnet.obsd-cvs/commands.c
32 --- telnet/commands.c Fri Apr 9 02:30:20 1999
33 +++ telnet.obsd-cvs/commands.c Sat Mar 10 10:51:22 2001
35 -/* $OpenBSD: commands.c,v 1.20 1999/01/04 07:55:05 art Exp $ */
36 +/* $OpenBSD: commands.c,v 1.34 2000/11/08 21:49:44 aaron Exp $ */
37 /* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
44 - printf("%s sequence challenge\n", argv[0]);
45 + printf("usage: %s sequence challenge\n", argv[0]);
49 @@ -2175,17 +2175,19 @@
54 + char m1save[MAXHOSTNAMELEN];
60 + strncpy(m1save, m1, sizeof(m1save));
64 char *home = getenv("HOME");
66 + if (home == NULL || *home == '\0')
68 snprintf (rcname, sizeof(rcname), "%s/.telnetrc",
71 @@ -2248,15 +2250,9 @@
73 tn(int argc, char *argv[])
75 - struct hostent *host = 0, *alias = 0;
76 -#if defined(AF_INET6)
77 - struct sockaddr_in6 sin6;
79 + struct addrinfo hints, *res, *res0;
81 struct sockaddr_in sin;
82 - struct sockaddr_in ladr;
83 - struct sockaddr *sa;
85 - struct servent *sp = 0;
87 #if !defined(__linux__)
88 extern char *inet_ntoa();
89 @@ -2266,15 +2262,18 @@
92 char *cmd, *hostp = 0, *portp = 0, *user = 0, *aliasp = 0;
93 - int family, port = 0;
96 +#ifdef NI_WITHSCOPEID
97 + const int niflags = NI_NUMERICHOST | NI_WITHSCOPEID;
99 + const int niflags = NI_NUMERICHOST;
102 /* clear the socket address prior to use */
103 memset((char *)&sin, 0, sizeof(sin));
106 printf("?Already connected to %s\r\n", hostname);
112 @@ -2324,8 +2323,6 @@
115 printf("usage: %s [-l user] [-a] host-name [port]\r\n", cmd);
121 @@ -2340,185 +2337,80 @@
122 temp = sourceroute(hostp, &srp, &srlen);
128 } else if (temp == -1) {
129 printf("Bad source route option: %s\r\n", hostp);
138 - memset (&sin, 0, sizeof(sin));
139 -#if defined(HAVE_INET_PTON) && defined(AF_INET6)
140 - memset (&sin6, 0, sizeof(sin6));
142 - if(inet_pton(AF_INET6, hostp, &sin6.sin6_addr)) {
143 - sin6.sin6_family = family = AF_INET6;
144 - sa = (struct sockaddr *)&sin6;
145 - sa_size = sizeof(sin6);
146 - strcpy(_hostname, hostp);
147 - hostname =_hostname;
150 - if(inet_aton(hostp, &sin.sin_addr)){
151 - sin.sin_family = family = AF_INET;
152 - sa = (struct sockaddr *)&sin;
153 - sa_size = sizeof(sin);
154 - strcpy(_hostname, hostp);
155 - hostname = _hostname;
157 -#ifdef HAVE_GETHOSTBYNAME2
158 - host = gethostbyname2(hostp, AF_INET6);
160 - host = gethostbyname2(hostp, AF_INET);
162 - host = gethostbyname(hostp);
165 - strncpy(_hostname, host->h_name, sizeof(_hostname));
166 - family = host->h_addrtype;
170 - memset(&sin, 0, sizeof(sin));
171 - sa_size = sizeof(sin);
172 - sa = (struct sockaddr *)&sin;
173 - sin.sin_family = family;
175 - memcpy(&sin.sin_addr, *host->h_addr_list, sizeof(struct in_addr));
177 -#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6)
179 - memset(&sin6, 0, sizeof(sin6));
180 - sa_size = sizeof(sin6);
181 - sa = (struct sockaddr *)&sin6;
182 - sin6.sin6_family = family;
183 - memcpy(&sin6.sin6_addr, *host->h_addr_list, sizeof(struct in6_addr));
187 - fprintf(stderr, "Bad address family: %d\n", family);
191 - _hostname[sizeof(_hostname)-1] = '\0';
192 - hostname = _hostname;
200 -#if defined(IP_OPTIONS) && defined(IPPROTO_IP)
205 - if (*portp == '-') {
210 - port = atoi(portp);
212 - sp = getservbyname(portp, "tcp");
216 - printf("%s: bad port number\r\n", portp);
222 - port = htons(port);
226 - sp = getservbyname("telnet", "tcp");
228 - fprintf(stderr, "telnet: tcp/telnet: unknown service\r\n");
236 + memset(&hints, 0, sizeof(hints));
237 + hints.ai_family = PF_UNSPEC;
238 + hints.ai_socktype = SOCK_STREAM;
239 + hints.ai_flags = AI_CANONNAME;
240 + if (portp == NULL) {
242 + } else if (*portp == '-') {
247 + error = getaddrinfo(hostp, portp, &hints, &res0);
249 + if (error == EAI_SERVICE)
250 + warnx("%s: bad port", portp);
252 + warnx("%s: %s", hostp, gai_strerror(error));
261 - sin.sin_port = port;
262 - printf("Trying %s...\r\n", inet_ntoa(sin.sin_addr));
264 -#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6)
266 -#ifndef INET6_ADDRSTRLEN
267 -#define INET6_ADDRSTRLEN 46
270 - char buf[INET6_ADDRSTRLEN];
272 - sin6.sin6_port = port;
273 -#ifdef HAVE_INET_NTOP
274 - printf("Trying %s...\r\n", inet_ntop(AF_INET6,
287 - net = socket(family, SOCK_STREAM, 0);
291 - perror("telnet: socket");
295 + for (res = res0; res; res = res->ai_next) {
296 + if (1 /* retry */) {
297 + char hbuf[NI_MAXHOST];
299 + if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf),
300 + NULL, 0, niflags) != 0) {
301 + strcpy(hbuf, "(invalid)");
303 + printf("Trying %s...\r\n", hbuf);
305 + net = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
310 - memset ((caddr_t)&ladr, 0, sizeof (ladr));
311 - temp = inet_addr(aliasp);
312 - if (temp != INADDR_NONE) {
313 - ladr.sin_addr.s_addr = temp;
314 - ladr.sin_family = AF_INET;
315 - alias = gethostbyaddr((char *)&temp, sizeof(temp), AF_INET);
317 - alias = gethostbyname(aliasp);
319 - ladr.sin_family = alias->h_addrtype;
320 -#if defined(h_addr) /* In 4.3, this is a #define */
321 - memmove((caddr_t)&ladr.sin_addr,
322 - alias->h_addr_list[0], alias->h_length);
323 -#else /* defined(h_addr) */
324 - memmove((caddr_t)&ladr.sin_addr, alias->h_addr,
326 -#endif /* defined(h_addr) */
331 + struct addrinfo ahints, *ares;
332 + memset(&ahints, 0, sizeof(ahints));
333 + ahints.ai_family = PF_UNSPEC;
334 + ahints.ai_socktype = SOCK_STREAM;
335 + ahints.ai_flags = AI_PASSIVE;
336 + error = getaddrinfo(aliasp, "0", &ahints, &ares);
338 + warn("%s: %s", aliasp, gai_strerror(error));
340 + freeaddrinfo(ares);
343 - ladr.sin_port = htons(0);
345 - if (bind (net, (struct sockaddr *)&ladr, sizeof(ladr)) < 0) {
347 + if (bind(net, ares->ai_addr, ares->ai_addrlen) < 0) {
349 (void) close(net); /* dump descriptor */
351 + freeaddrinfo(ares);
354 + freeaddrinfo(ares);
356 #if defined(IP_OPTIONS) && defined(IPPROTO_IP)
357 - if (srp && setsockopt(net, IPPROTO_IP, IP_OPTIONS, (char *)srp, srlen) < 0)
358 + if (srp && res->ai_family == AF_INET
359 + && setsockopt(net, IPPROTO_IP, IP_OPTIONS, (char *)srp, srlen) < 0)
360 perror("setsockopt (IP_OPTIONS)");
362 #if defined(IPPROTO_IP) && defined(IP_TOS)
363 @@ -2542,65 +2434,32 @@
364 perror("setsockopt (SO_DEBUG)");
367 - if (connect(net, sa, sa_size) < 0) {
370 - if (host && host->h_addr_list[1]) {
371 - int oerrno = errno;
376 - fprintf(stderr, "telnet: connect to address %s: ",
377 - inet_ntoa(sin.sin_addr));
378 - ++host->h_addr_list;
379 - memcpy(&sin.sin_addr, *host->h_addr_list, sizeof(struct in_addr));
381 -#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6)
383 - char buf[INET6_ADDRSTRLEN];
385 - fprintf(stderr, "telnet: connect to address %s: ",
386 - inet_ntop(AF_INET6, &sin6.sin6_addr, buf,
388 - ++host->h_addr_list;
389 - memcpy(&sin6.sin6_addr, *host->h_addr_list, sizeof(struct in6_addr));
402 - printf("Trying %s...\r\n", inet_ntoa(sin.sin_addr));
404 -#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6)
406 - printf("Trying %s...\r\n", inet_ntop(AF_INET6,
415 - (void) NetClose(net);
417 + if (connect(net, res->ai_addr, res->ai_addrlen) < 0) {
418 + char hbuf[NI_MAXHOST];
420 + if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf),
421 + NULL, 0, NI_NUMERICHOST) != 0) {
422 + strcpy(hbuf, "(invalid)");
424 - perror("telnet: Unable to connect to remote host");
426 + fprintf(stderr, "telnet: connect to address %s: %s\n", hbuf,
436 #if defined(AUTHENTICATION) || defined(ENCRYPTION)
437 auth_encrypt_connect(connected);
438 #endif /* defined(AUTHENTICATION) */
439 - } while (connected == 0);
442 + freeaddrinfo(res0);
446 cmdrc(hostp, hostname);
447 if (autologin && user == NULL) {
449 @@ -2652,6 +2511,9 @@
450 encrypthelp[] = "turn on (off) encryption ('encrypt ?' for more)",
452 zhelp[] = "suspend telnet",
454 + skeyhelp[] = "compute response to s/key challenge",
456 shellhelp[] = "invoke a subshell",
457 envhelp[] = "change environment variables ('environ ?' for more)",
458 modestring[] = "try to enter line or character mode ('mode ?' for more)";
459 @@ -2690,7 +2552,7 @@
460 { "environ", envhelp, env_cmd, 0 },
461 { "?", helphelp, help, 0 },
463 - { "skey", NULL, skey_calc, 0 },
464 + { "skey", skeyhelp, skey_calc, 0 },
468 diff -uNr telnet/externs.h telnet.obsd-cvs/externs.h
469 --- telnet/externs.h Mon Feb 8 22:56:11 1999
470 +++ telnet.obsd-cvs/externs.h Sat Mar 10 10:54:35 2001
472 -/* $OpenBSD: externs.h,v 1.4 1998/03/12 17:31:32 deraadt Exp $ */
473 +/* $OpenBSD: externs.h,v 1.5 1998/03/12 2001/01/22 11:03:38 fgsch Exp $ */
474 /* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */
478 *Ibackp, /* Oldest byte of 3270 data */
479 Ibuf[], /* 3270 buffer */
480 *Ifrontp, /* Where next 3270 byte goes */
483 *transcom; /* Transparent command */
486 diff -uNr telnet/main.c telnet.obsd-cvs/main.c
487 --- telnet/main.c Wed Apr 7 23:23:35 1999
488 +++ telnet.obsd-cvs/main.c Sat Mar 10 09:59:35 2001
490 -/* $OpenBSD: main.c,v 1.7 1998/05/15 03:16:38 art Exp $ */
491 +/* $OpenBSD: main.c,v 1.10 2001/01/21 22:46:37 aaron Exp $ */
492 /* $NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $ */
497 #ifdef AUTHENTICATION
498 "[-8] [-E] [-K] [-L] [-S tos] [-X atype] [-a] [-c] [-d] [-e char]",
499 - "\n\t[-k realm] [-l user] [-f/-F] [-n tracefile] [-b hostalias ]",
500 + "\n\t[-k realm] [-l user] [-f/-F] [-n tracefile] [-b hostalias ] ",
502 "[-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]",
503 - "\n\t[-n tracefile] [-b hostalias ]",
504 + "\n\t[-n tracefile] [-b hostalias ] ",
506 #if defined(TN3270) && defined(unix)
507 # ifdef AUTHENTICATION
514 - "[-x] [host-name [port]]"
517 - "[host-name [port]]"
521 + "[host-name [port]]");
528 #if defined(TN3270) && defined(unix)
529 + (void)strncpy(tline, optarg, sizeof(tline));
531 - (void)strcpy(transcom, optarg);
534 "%s: Warning: -t ignored, no TN3270 support.\n",
535 diff -uNr telnet/sys_bsd.c telnet.obsd-cvs/sys_bsd.c
536 --- telnet/sys_bsd.c Wed Apr 7 21:38:31 1999
537 +++ telnet.obsd-cvs/sys_bsd.c Sat Mar 10 10:55:18 2001
539 -/* $OpenBSD: sys_bsd.c,v 1.6 1998/12/28 11:13:51 deraadt Exp $ */
540 +/* $OpenBSD: sys_bsd.c,v 1.8 2000/10/10 15:41:10 millert Exp $ */
541 /* $NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $ */
547 #include "telnet_locl.h"
551 * The following routines try to encapsulate what is system dependent
553 TerminalFlushOutput(void)
556 - (void) ioctl(fileno(stdout), TIOCFLUSH, (char *) 0);
558 + (void) ioctl(fileno(stdout), TIOCFLUSH, (int *) &com);
560 - (void) ioctl(fileno(stdout), TCFLSH, (char *) 0);
561 + (void) ioctl(fileno(stdout), TCFLSH, (int *) 0);
565 diff -uNr telnet/telnet.c telnet.obsd-cvs/telnet.c
566 --- telnet/telnet.c Wed Apr 7 23:22:14 1999
567 +++ telnet.obsd-cvs/telnet.c Sat Mar 10 11:02:34 2001
569 -/* $OpenBSD: telnet.c,v 1.6 1998/07/27 15:29:29 millert Exp $ */
570 +/* $OpenBSD: telnet.c,v 1.11 2000/11/10 15:33:13 provos millert Exp $ */
571 /* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */
577 #include "telnet_locl.h"
581 #define strip(x) (eight ? (x) : ((x) & 0x7f))
587 - * Given a buffer returned by tgetent(), this routine will turn
588 - * the pipe seperated list of names in the buffer into an array
589 - * of pointers to null terminated names. We toss out any bad,
590 - * duplicate, or verbose names (names with spaces).
591 + * This routine will turn a pipe seperated list of names in the buffer
592 + * into an array of pointers to NUL terminated names. We toss out any
593 + * bad, duplicate, or verbose names (names with spaces).
596 int is_unique P((char *, char **, char **));
599 * Count up the number of names.
601 - for (n = 1, cp = buf; *cp && *cp != ':'; cp++) {
602 + for (n = 1, cp = buf; *cp; cp++) {
610 -static char termbuf[1024];
612 -int telnet_setupterm P((char *tname, int fd, int *errp)); /* XXX move elsewhere */
615 -telnet_setupterm(char *tname, int fd, int *errp)
618 - if (tgetent(termbuf, tname) == 1) {
619 - termbuf[1023] = '\0';
629 int resettermname = 1;
631 char *gettermname P((void)); /* XXX move elsewhere */
632 @@ -687,15 +669,15 @@
634 static char **tnamep = 0;
641 if (tnamep && tnamep != unknown)
643 if ((tname = (char *)env_getvalue((unsigned char *)"TERM")) &&
644 - (telnet_setupterm(tname, 1, &err) == 0)) {
645 - tnamep = mklist(termbuf, tname);
646 + (setupterm(tname, 1, &errret) == 0)) {
647 + tnamep = mklist(ttytype, tname);
649 if (tname && ((int)strlen(tname) <= 40)) {
651 @@ -1482,10 +1464,15 @@
656 - opt_reply = (unsigned char *)realloc(opt_reply, OPT_REPLY_SIZE);
658 - opt_reply = (unsigned char *)malloc(OPT_REPLY_SIZE);
662 + p = (unsigned char *)realloc(opt_reply, OPT_REPLY_SIZE);
666 + p = (unsigned char *)malloc(OPT_REPLY_SIZE);
668 if (opt_reply == NULL) {
669 /*@*/ printf("env_opt_start: malloc()/realloc() failed!!!\n");
670 opt_reply = opt_replyp = opt_replyend = NULL;
671 @@ -1532,9 +1519,13 @@
672 strlen((char *)ep) + 6 > opt_replyend)
676 opt_replyend += OPT_REPLY_SIZE;
677 len = opt_replyend - opt_reply;
678 - opt_reply = (unsigned char *)realloc(opt_reply, len);
679 + p = (unsigned char *)realloc(opt_reply, len);
683 if (opt_reply == NULL) {
684 /*@*/ printf("env_opt_add: realloc() failed!!!\n");
685 opt_reply = opt_replyp = opt_replyend = NULL;
686 @@ -1945,7 +1936,7 @@
687 command(0, "z\n", 2);
690 - if (sc == escape) {
691 + if (sc == escape && escape != _POSIX_VDISABLE) {
692 command(0, (char *)tbp, tcc);
695 @@ -1962,7 +1953,7 @@
697 if ((sc == '\n') || (sc == '\r'))
699 - } else if (sc == escape) {
700 + } else if (sc == escape && escape != _POSIX_VDISABLE) {
702 * Double escape is a pass through of a single escape character.
704 diff -uNr telnet/telnet_locl.h telnet.obsd-cvs/telnet_locl.h
705 --- telnet/telnet_locl.h Thu Mar 12 06:57:44 1998
706 +++ telnet.obsd-cvs/telnet_locl.h Sat Mar 10 11:12:37 2001
708 -/* $OpenBSD: telnet_locl.h,v 1.1 1998/03/12 04:57:44 art Exp $ */
709 +/* $OpenBSD: telnet_locl.h,v 1.2 1999/12/11 09:08:09 itojun Exp $ */
710 /* $KTH: telnet_locl.h,v 1.13 1997/11/03 21:37:55 assar Exp $ */
717 -#undef AF_INET6 /* XXX - it has not been tested and it doesn't exist yet */
721 diff -uNr libtelnet/kerberos.c libtelnet.obsd-cvs/kerberos.c
722 --- libtelnet/kerberos.c Mon Feb 8 23:38:17 1999
723 +++ libtelnet.obsd-cvs/kerberos.c Sat Mar 10 11:11:03 2001
724 @@ -320,11 +320,10 @@
726 struct passwd *pw = getpwnam(UserNameRequested);
730 snprintf(ts, sizeof(ts),
733 - (unsigned)pw->pw_uid);
734 + "%s%u", TKT_ROOT, (unsigned)pw->pw_uid);
735 + /* XXX allocation failure? */
736 setenv("KRBTKFILE", ts, 1);
738 Data(ap, KRB_ACCEPT, NULL, 0);
739 @@ -609,16 +608,26 @@
741 unsigned char *p = buf;
743 - p += krb_put_nir(cred->service, cred->instance, cred->realm, p);
744 + memcpy (p, cred->service, ANAME_SZ);
746 + memcpy (p, cred->instance, INST_SZ);
748 + memcpy (p, cred->realm, REALM_SZ);
750 memcpy(p, cred->session, 8);
752 *p++ = cred->lifetime;
754 - p += krb_put_int(cred->ticket_st.length, p, 4);
755 + p += krb_put_int(cred->ticket_st.length, p, 4, 4);
756 memcpy(p, cred->ticket_st.dat, cred->ticket_st.length);
757 p += cred->ticket_st.length;
758 - p += krb_put_int(cred->issue_date, p, 4);
759 - p += krb_put_nir(cred->pname, cred->pinst, NULL, p);
760 + p += krb_put_int(cred->issue_date, p, 4, 4);
761 + strncpy (cred->pname, p, ANAME_SZ);
762 + cred->pname[ANAME_SZ - 1] = '\0';
764 + strncpy (cred->pinst, p, INST_SZ);
765 + cred->pinst[INST_SZ - 1] = '\0';
772 unsigned char *p = buf;
774 - p += krb_get_nir(p, cred->service, cred->instance, cred->realm);
775 + strncpy (cred->service, p, ANAME_SZ);
776 + cred->service[ANAME_SZ - 1] = '\0';
778 + strncpy (cred->instance, p, INST_SZ);
779 + cred->instance[INST_SZ - 1] = '\0';
781 + strncpy (cred->realm, p, REALM_SZ);
782 + cred->realm[REALM_SZ - 1] = '\0';
785 memcpy(cred->session, p, 8);
787 cred->lifetime = *p++;
789 memcpy(cred->ticket_st.dat, p, cred->ticket_st.length);
790 cred->ticket_st.mbz = 0;
791 p += krb_get_int(p, (u_int32_t *)&cred->issue_date, 4, 0);
792 - p += krb_get_nir(p, cred->pname, cred->pinst, NULL);
793 + p += krb_get_nir(p,
794 + cred->pname, sizeof(cred->pname),
795 + cred->pinst, sizeof(cred->pinst),
800 --- telnet/telnet.1 Thu Nov 12 01:01:46 1998
801 +++ telnet.obsd-cvs/telnet.1 Thu Nov 9 19:52:41 2000
803 -.\" $OpenBSD: telnet.1,v 1.14 1998/11/11 23:01:46 aaron Exp $
804 +.\" $OpenBSD: telnet.1,v 1.27 2000/11/09 17:52:41 aaron Exp $
805 .\" $NetBSD: telnet.1,v 1.5 1996/02/28 21:04:12 thorpej Exp $
807 .\" Copyright (c) 1983, 1990, 1993
816 -.Nd user interface to the
817 +.Nd user interface to the
831 .Op Fl b Ar hostalias
834 .Op Fl e Ar escapechar
838 .Op Fl n Ar tracefile
850 -is used to communicate with another host using the
851 +is used to communicate with another host using the
857 is invoked without the
859 argument, it enters command mode,
862 command with those arguments.
865 -.Bl -tag -width indent
866 +The options are as follows:
869 -Specifies an 8-bit data path. This causes an attempt to
871 +Specifies an 8-bit data path.
872 +This causes an attempt to negotiate the
874 option on both input and output.
878 Specifies no automatic login to the remote system.
880 -Specifies an 8-bit data path on output. This causes the
881 -BINARY option to be negotiated on output.
883 -Sets the IP type-of-service (TOS) option for the telnet
884 -connection to the value
886 -which can be a numeric TOS value
887 -or, on systems that support it, a symbolic
888 -TOS name found in the
892 +Specifies an 8-bit data path on output.
893 +This causes the BINARY option to be negotiated on output.
897 type of authentication.
900 Disables the reading of the user's
906 command on this man page.)
912 -.It Fl e Ar escapechar
913 +.It Fl e Ar escapechar
917 @@ -169,14 +150,14 @@
918 If Kerberos authentication is being used, the
923 obtain tickets for the remote host in
926 instead of the remote host's realm, as determined
928 .Xr krb_realmofhost 3 .
931 When connecting to the remote system, if the remote system
935 This option may also be used with the
938 -.It Fl n Ar tracefile
939 +.It Fl n Ar tracefile
942 for recording trace information.
943 @@ -210,35 +191,38 @@
944 Indicates the official name, an alias, or the Internet address
947 -Indicates a port number (address of an application). If a number is
948 -not specified, the default
950 +Indicates a port number (address of an application).
951 +If a number is not specified, the default
956 -When in rlogin mode, a line of the form ~. disconnects from the
957 +When in rlogin mode, a line of the form ~.
958 +disconnects from the
959 remote host; ~ is the telnet escape character.
960 Similarly, the line ~^Z suspends the telnet session.
961 The line ~^] escapes to the normal telnet escape prompt.
963 Once a connection has been opened,
966 will attempt to enable the
972 will revert to one of two input modes:
973 either ``character at a time''
974 or ``old line by line''
975 depending on what the remote system supports.
980 is enabled, character processing is done on the
981 -local system, under the control of the remote system. When input
982 +local system, under the control of the remote system.
984 editing or character echoing is to be disabled, the remote system
985 -will relay that information. The remote system will also relay
986 +will relay that information.
987 +The remote system will also relay
988 changes to any special characters that happen on the remote
989 system, so that they can take effect on the local system.
992 (this would mostly be used to enter passwords
993 without the password being echoed).
998 option is enabled, or if the
1001 characters are trapped locally, and sent as
1003 protocol sequences to the remote side.
1007 has ever been enabled, then the user's
1019 There are options (see
1021 @@ -296,17 +280,26 @@
1028 While connected to a remote host,
1031 command mode may be entered by typing the
1034 ``escape character'' (initially ``^]'').
1035 When in command mode, the normal terminal editing conventions are available.
1036 +Note that the escape character will return to the command mode of the initial
1039 +that has the controlling terminal.
1042 +command to switch to command mode in subsequent
1044 +processes on remote hosts.
1049 commands are available.
1050 Only enough of each command to uniquely identify it need be typed
1051 (this is also true for arguments to the
1052 @@ -320,26 +313,28 @@
1055 .Bl -tag -width "mode type"
1056 -.It Ic auth Ar argument Op Ar ...
1057 +.It Ic auth Ar argument Op Ar ...
1060 command manipulates the information sent through the
1061 .Dv TELNET AUTHENTICATE
1062 -option. Valid arguments for the
1063 -auth command are as follows:
1065 +Valid arguments for the
1067 +command are as follows:
1068 .Bl -tag -width "disable type"
1069 .It Ic disable Ar type
1070 Disables the specified
1072 -of authentication. To
1073 -obtain a list of available types, use the
1075 +To obtain a list of available types, use the
1076 .Ic auth disable \&?
1078 .It Ic enable Ar type
1079 Enables the specified
1081 -of authentication. To
1082 -obtain a list of available types, use the
1084 +To obtain a list of available types, use the
1091 session and return to command mode.
1092 -.It Ic display Ar argument Op Ar ...
1093 +.It Ic display Ar argument Op Ar ...
1094 Displays all, or some, of the
1097 @@ -368,26 +363,27 @@
1098 .It Ic disable Ar type Ic [input|output]
1099 Disables the specified
1101 -of encryption. If you
1108 both input and output
1109 -are disabled. To obtain a list of available
1112 +To obtain a list of available types, use the
1113 .Ic encrypt disable \&?
1115 .It Ic enable Ar type Ic [input|output]
1116 Enables the specified
1118 -of encryption. If you
1125 both input and output are
1126 -enabled. To obtain a list of available types, use the
1128 +To obtain a list of available types, use the
1129 .Ic encrypt enable \&?
1132 @@ -407,18 +403,20 @@
1133 .Ic encrypt stop output
1135 .It Ic start Ic [input|output]
1136 -Attempts to start encryption. If you omit
1137 +Attempts to start encryption.
1142 -both input and output are enabled. To
1143 -obtain a list of available types, use the
1145 +both input and output are enabled.
1146 +To obtain a list of available types, use the
1147 .Ic encrypt enable \&?
1150 Lists the current status of encryption.
1151 .It Ic stop Ic [input|output]
1152 -Stops encryption. If you omit
1162 -.It Ic environ Ar arguments Op Ar ...
1163 +.It Ic environ Ar arguments Op Ar ...
1166 command is used to manipulate the
1171 -.It Ic define Ar variable value
1172 +.It Ic define Ar variable value
1176 @@ -466,15 +464,15 @@
1178 may be enclosed in single or double quotes so
1179 that tabs and spaces may be included.
1180 -.It Ic undefine Ar variable
1181 +.It Ic undefine Ar variable
1184 from the list of environment variables.
1185 -.It Ic export Ar variable
1186 +.It Ic export Ar variable
1189 to be exported to the remote side.
1190 -.It Ic unexport Ar variable
1191 +.It Ic unexport Ar variable
1194 to not be exported unless
1196 suspending a user's session for later reattachment,
1197 the logout argument indicates that you
1198 should terminate the session immediately.
1199 -.It Ic mode Ar type
1200 +.It Ic mode Ar type
1202 is one of several options, depending on the state of the
1204 @@ -529,40 +527,40 @@
1205 option, or, if the remote side does not understand the
1207 option, then attempt to enter ``old-line-by-line'' mode.
1208 -.It Ic isig Pq Ic \-isig
1209 -Attempt to enable (disable) the
1210 +.It Ic isig Pq Ic \-isig
1211 +Attempt to enable (disable) the
1217 -This requires that the
1218 +This requires that the
1221 -.It Ic edit Pq Ic \-edit
1222 -Attempt to enable (disable) the
1223 +.It Ic edit Pq Ic \-edit
1224 +Attempt to enable (disable) the
1230 -This requires that the
1231 +This requires that the
1234 -.It Ic softtabs Pq Ic \-softtabs
1235 -Attempt to enable (disable) the
1236 +.It Ic softtabs Pq Ic \-softtabs
1237 +Attempt to enable (disable) the
1243 -This requires that the
1244 +This requires that the
1247 -.It Ic litecho Pq Ic \-litecho
1248 -Attempt to enable (disable) the
1249 +.It Ic litecho Pq Ic \-litecho
1250 +Attempt to enable (disable) the
1256 -This requires that the
1257 +This requires that the
1262 Open a connection to the named host.
1267 will attempt to contact a
1269 server at the default port.
1270 @@ -594,24 +592,29 @@
1273 When connecting to a non-standard port,
1276 omits any automatic initiation of
1278 -options. When the port number is preceded by a minus sign,
1280 +When the port number is preceded by a minus sign,
1281 the initial option negotiation is done.
1282 After establishing a connection, the file
1285 -user's home directory is opened. Lines beginning with a ``#'' are
1286 -comment lines. Blank lines are ignored. Lines that begin
1287 -without white space are the start of a machine entry. The
1288 -first thing on the line is the name of the machine that is
1289 -being connected to. The rest of the line, and successive
1290 -lines that begin with white space are assumed to be
1292 +user's home directory is opened.
1293 +Lines beginning with a ``#'' are
1295 +Blank lines are ignored.
1297 +without whitespace are the start of a machine entry.
1298 +The first thing on the line is the name of the machine that is
1299 +being connected to.
1300 +The rest of the line, and successive
1301 +lines that begin with whitespace are assumed to be
1303 commands and are processed as if they had been typed
1313 An end-of-file (in command mode) will also close a session and exit.
1314 -.It Ic send Ar arguments
1315 +.It Ic send Ar arguments
1316 Sends one or more special character sequences to the remote host.
1317 The following are the arguments which may be specified
1318 (more than one argument may be specified at a time):
1325 escape character (initially ``^]'').
1328 @@ -788,12 +791,12 @@
1332 -.It Ic set Ar argument value
1333 -.It Ic unset Ar argument value
1334 +.It Ic set Ar argument value
1335 +.It Ic unset Ar argument value
1338 command will set any one of a number of
1341 variables to a specific value or to
1347 The variables which may be set or unset, but not toggled, are
1348 -listed here. In addition, any of the variables for the
1350 +In addition, any of the variables for the
1352 command may be explicitly set or unset using
1357 preceding) is sent to the
1358 -remote host. The initial value for the "Are You There"
1360 +The initial value for the "Are You There"
1361 character is the terminal's status character.
1363 This is the value (initially ``^E'') which, when in
1365 echoing of entered characters (for entering, say, a password).
1372 or ``old line by line'' mode, entering this character
1388 is operating in ``character at a time'' mode, then when this
1389 character is typed, a
1391 @@ -879,14 +884,14 @@
1397 escape character (initially ``^['') which causes entry
1401 command mode (when connected to a remote system).
1409 @@ -916,12 +921,13 @@
1412 characters that, when typed, cause partial lines to be
1413 -forwarded to the remote system. The initial value for
1414 +forwarded to the remote system.
1415 +The initial value for
1416 the forwarding characters are taken from the terminal's
1417 eol and eol2 characters.
1440 is operating in ``character at a time'' mode, then when this
1441 character is typed, a
1451 or ``old line by line'' mode, then this character is taken to
1461 @@ -1009,7 +1015,7 @@
1469 or old line by line'' mode, then this character is taken to
1470 @@ -1031,8 +1037,9 @@
1471 This character, at the beginning of a line, followed by
1472 a "." closes the connection; when followed by a ^Z it
1475 -command. The initial state is to
1478 +The initial state is to
1482 @@ -1066,7 +1073,7 @@
1491 @@ -1093,12 +1100,13 @@
1495 -will be written. If it is set to
1499 then tracing information will be written to standard output (the default).
1506 or ``old line by line'' mode, then this character is taken to
1507 @@ -1117,25 +1125,32 @@
1511 -.It Ic slc Ar state
1512 +.It Ic skey Ar sequence challenge
1515 +command computes a response to the S/Key challenge.
1518 +for more information on the S/Key system.
1519 +.It Ic slc Ar state
1522 command (Set Local Characters) is used to set
1523 or change the state of the special
1524 -characters when the
1525 +characters when the
1528 -been enabled. Special characters are characters that get
1531 +Special characters are characters that get mapped to
1533 commands sequences (like
1538 or line editing characters (like
1543 By default, the local special characters are exported.
1546 @@ -1144,15 +1159,15 @@
1547 character settings, and if there are any discrepancies with
1548 the local side, the local side will switch to the remote value.
1550 -Switch to the local defaults for the special characters. The
1551 -local default characters are those of the local terminal at
1552 +Switch to the local defaults for the special characters.
1553 +The local default characters are those of the local terminal at
1559 Switch to the remote defaults for the special characters.
1560 The remote default characters are those of the remote system
1561 -at the time when the
1562 +at the time when the
1564 connection was established.
1566 @@ -1165,13 +1180,13 @@
1568 This includes the peer one is connected to, as well
1569 as the current mode.
1570 -.It Ic toggle Ar arguments Op Ar ...
1571 +.It Ic toggle Ar arguments Op Ar ...
1576 various flags that control how
1580 These flags may be set explicitly to
1582 @@ -1206,7 +1221,7 @@
1588 refuses to display any data on the user's terminal
1589 until the remote system acknowledges (via a
1590 .Dv TELNET TIMING MARK
1591 @@ -1220,13 +1235,14 @@
1592 done an "stty noflsh", otherwise
1600 option is negotiated, by
1601 default the actual encryption (decryption) of the data
1602 -stream does not start automatically. The
1603 +stream does not start automatically.
1607 command states that encryption of the
1608 @@ -1238,7 +1254,8 @@
1609 .Dv TELNET AUTHENTICATION
1612 -attempts to use it to perform automatic authentication. If the
1613 +attempts to use it to perform automatic authentication.
1616 option is not supported, the user's login
1617 name are propagated through the
1618 @@ -1314,7 +1331,7 @@
1619 The initial value for this toggle is
1622 -Toggles socket level debugging (useful only to the super-user).
1623 +Toggles socket level debugging (useful only to the superuser).
1624 The initial value for this toggle is
1627 @@ -1340,7 +1357,7 @@
1636 @@ -1379,7 +1396,7 @@
1639 Toggles the display of some internal
1642 protocol processing (having to do with
1645 @@ -1404,8 +1421,8 @@
1646 skips the reading of the
1648 file in the user's home
1649 -directory when connections are opened. The initial
1650 -value for this toggle is
1651 +directory when connections are opened.
1652 +The initial value for this toggle is
1655 Toggles the display of all terminal data (in hexadecimal format).
1656 @@ -1416,9 +1433,10 @@
1662 prints out a message each time encryption is enabled or
1663 -disabled. The initial value for this toggle is
1665 +The initial value for this toggle is
1669 @@ -1430,22 +1448,24 @@
1671 This command only works when the user is using the
1673 -.It Ic \&! Op Ar command
1674 +.It Ic \&! Op Ar command
1675 Execute a single command in a subshell on the local
1680 is omitted, then an interactive
1681 subshell is invoked.
1682 -.It Ic \&? Op Ar command
1683 -Get help. With no arguments,
1685 +.It Ic \&? Op Ar command
1689 prints a help summary.
1690 If a command is specified,
1693 will print the help information for just that command.
1701 @@ -1464,16 +1484,18 @@
1710 On some remote systems, echo has to be turned off manually when in
1711 ``old line by line'' mode.
1713 -In ``old line by line'' mode or
1714 +In ``old line by line'' mode or
1718 character is only recognized (and sent to the remote system)
1719 when it is the first character on a line.
1721 +Source routing is not supported yet for IPv6.