]>
Commit | Line | Data |
---|---|---|
b52f6eb2 DW |
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 | |
4 | @@ -36,22 +36,20 @@ | |
5 | ||
6 | PROG= telnet | |
7 | ||
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 | |
16 | ||
17 | SRCS= authenc.c commands.c main.c network.c ring.c sys_bsd.c telnet.c \ | |
18 | terminal.c tn3270.c utilities.c | |
19 | ||
20 | .include <bsd.own.mk> # for KERBEROS | |
21 | ||
22 | -.if (${KERBEROS} == "yes") | |
23 | +.if (${KERBEROS:L} == "yes") | |
24 | CFLAGS+=-DENCRYPTION -DAUTHENTICATION -DKRB4 | |
25 | LDADD+= -lkrb -ldes | |
26 | DPADD+= ${LIBDES} ${LIBKRB} | |
27 | .endif | |
28 | ||
29 | .include <bsd.prog.mk> | |
30 | - | |
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 | |
34 | @@ -1,4 +1,4 @@ | |
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 $ */ | |
38 | ||
39 | /* | |
40 | @@ -69,7 +69,7 @@ | |
41 | int status; | |
42 | ||
43 | if(argc != 3) { | |
44 | - printf("%s sequence challenge\n", argv[0]); | |
45 | + printf("usage: %s sequence challenge\n", argv[0]); | |
46 | return 0; | |
47 | } | |
48 | ||
49 | @@ -2175,17 +2175,19 @@ | |
50 | int gotmachine = 0; | |
51 | int l1 = strlen(m1); | |
52 | int l2 = strlen(m2); | |
53 | - char m1save[64]; | |
54 | + char m1save[MAXHOSTNAMELEN]; | |
55 | ||
56 | if (skiprc) | |
57 | return; | |
58 | ||
59 | - strcpy(m1save, m1); | |
60 | + strncpy(m1save, m1, sizeof(m1save)); | |
61 | m1 = m1save; | |
62 | ||
63 | if (rcname[0] == 0) { | |
64 | char *home = getenv("HOME"); | |
65 | ||
66 | + if (home == NULL || *home == '\0') | |
67 | + return; | |
68 | snprintf (rcname, sizeof(rcname), "%s/.telnetrc", | |
69 | home ? home : ""); | |
70 | } | |
71 | @@ -2248,15 +2250,9 @@ | |
72 | int | |
73 | tn(int argc, char *argv[]) | |
74 | { | |
75 | - struct hostent *host = 0, *alias = 0; | |
76 | -#if defined(AF_INET6) | |
77 | - struct sockaddr_in6 sin6; | |
78 | -#endif | |
79 | + struct addrinfo hints, *res, *res0; | |
80 | + int error; | |
81 | struct sockaddr_in sin; | |
82 | - struct sockaddr_in ladr; | |
83 | - struct sockaddr *sa; | |
84 | - int sa_size; | |
85 | - struct servent *sp = 0; | |
86 | unsigned long temp; | |
87 | #if !defined(__linux__) | |
88 | extern char *inet_ntoa(); | |
89 | @@ -2266,15 +2262,18 @@ | |
90 | int srlen; | |
91 | #endif | |
92 | char *cmd, *hostp = 0, *portp = 0, *user = 0, *aliasp = 0; | |
93 | - int family, port = 0; | |
94 | - | |
95 | + int retry; | |
96 | +#ifdef NI_WITHSCOPEID | |
97 | + const int niflags = NI_NUMERICHOST | NI_WITHSCOPEID; | |
98 | +#else | |
99 | + const int niflags = NI_NUMERICHOST; | |
100 | +#endif | |
101 | + | |
102 | /* clear the socket address prior to use */ | |
103 | memset((char *)&sin, 0, sizeof(sin)); | |
104 | ||
105 | if (connected) { | |
106 | printf("?Already connected to %s\r\n", hostname); | |
107 | - seteuid(getuid()); | |
108 | - setuid(getuid()); | |
109 | return 0; | |
110 | } | |
111 | if (argc < 2) { | |
112 | @@ -2324,8 +2323,6 @@ | |
113 | } | |
114 | usage: | |
115 | printf("usage: %s [-l user] [-a] host-name [port]\r\n", cmd); | |
116 | - seteuid(getuid()); | |
117 | - setuid(getuid()); | |
118 | return 0; | |
119 | } | |
120 | if (hostp == 0) | |
121 | @@ -2340,185 +2337,80 @@ | |
122 | temp = sourceroute(hostp, &srp, &srlen); | |
123 | if (temp == 0) { | |
124 | herror(srp); | |
125 | - seteuid(getuid()); | |
126 | - setuid(getuid()); | |
127 | return 0; | |
128 | } else if (temp == -1) { | |
129 | printf("Bad source route option: %s\r\n", hostp); | |
130 | - seteuid(getuid()); | |
131 | - setuid(getuid()); | |
132 | return 0; | |
133 | } else { | |
134 | abort(); | |
135 | } | |
136 | - } else { | |
137 | -#endif | |
138 | - memset (&sin, 0, sizeof(sin)); | |
139 | -#if defined(HAVE_INET_PTON) && defined(AF_INET6) | |
140 | - memset (&sin6, 0, sizeof(sin6)); | |
141 | - | |
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; | |
148 | - } else | |
149 | -#endif | |
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; | |
156 | - } else { | |
157 | -#ifdef HAVE_GETHOSTBYNAME2 | |
158 | - host = gethostbyname2(hostp, AF_INET6); | |
159 | - if(host == NULL) | |
160 | - host = gethostbyname2(hostp, AF_INET); | |
161 | -#else | |
162 | - host = gethostbyname(hostp); | |
163 | -#endif | |
164 | - if (host) { | |
165 | - strncpy(_hostname, host->h_name, sizeof(_hostname)); | |
166 | - family = host->h_addrtype; | |
167 | - | |
168 | - switch(family) { | |
169 | - case AF_INET: | |
170 | - memset(&sin, 0, sizeof(sin)); | |
171 | - sa_size = sizeof(sin); | |
172 | - sa = (struct sockaddr *)&sin; | |
173 | - sin.sin_family = family; | |
174 | - | |
175 | - memcpy(&sin.sin_addr, *host->h_addr_list, sizeof(struct in_addr)); | |
176 | - break; | |
177 | -#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6) | |
178 | - case AF_INET6: | |
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)); | |
184 | - break; | |
185 | -#endif | |
186 | - default: | |
187 | - fprintf(stderr, "Bad address family: %d\n", family); | |
188 | - return 0; | |
189 | - } | |
190 | - | |
191 | - _hostname[sizeof(_hostname)-1] = '\0'; | |
192 | - hostname = _hostname; | |
193 | - } else { | |
194 | - herror(hostp); | |
195 | - seteuid(getuid()); | |
196 | - setuid(getuid()); | |
197 | - return 0; | |
198 | - } | |
199 | - } | |
200 | -#if defined(IP_OPTIONS) && defined(IPPROTO_IP) | |
201 | - } | |
202 | + } else | |
203 | #endif | |
204 | - if (portp) { | |
205 | - if (*portp == '-') { | |
206 | - portp++; | |
207 | - telnetport = 1; | |
208 | - } else | |
209 | - telnetport = 0; | |
210 | - port = atoi(portp); | |
211 | - if (port == 0) { | |
212 | - sp = getservbyname(portp, "tcp"); | |
213 | - if (sp) | |
214 | - port = sp->s_port; | |
215 | - else { | |
216 | - printf("%s: bad port number\r\n", portp); | |
217 | - seteuid(getuid()); | |
218 | - setuid(getuid()); | |
219 | - return 0; | |
220 | - } | |
221 | - } else { | |
222 | - port = htons(port); | |
223 | - } | |
224 | - } else { | |
225 | - if (sp == 0) { | |
226 | - sp = getservbyname("telnet", "tcp"); | |
227 | - if (sp == 0) { | |
228 | - fprintf(stderr, "telnet: tcp/telnet: unknown service\r\n"); | |
229 | - seteuid(getuid()); | |
230 | - setuid(getuid()); | |
231 | - return 0; | |
232 | - } | |
233 | - port = sp->s_port; | |
234 | + { | |
235 | + hostname = hostp; | |
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) { | |
241 | + portp = "telnet"; | |
242 | + } else if (*portp == '-') { | |
243 | + portp++; | |
244 | + telnetport = 1; | |
245 | + } | |
246 | + h_errno = 0; | |
247 | + error = getaddrinfo(hostp, portp, &hints, &res0); | |
248 | + if (error) { | |
249 | + if (error == EAI_SERVICE) | |
250 | + warnx("%s: bad port", portp); | |
251 | + else | |
252 | + warnx("%s: %s", hostp, gai_strerror(error)); | |
253 | + if (h_errno) | |
254 | + herror(hostp); | |
255 | + return 0; | |
256 | } | |
257 | - telnetport = 1; | |
258 | } | |
259 | - switch(family) { | |
260 | - case AF_INET: | |
261 | - sin.sin_port = port; | |
262 | - printf("Trying %s...\r\n", inet_ntoa(sin.sin_addr)); | |
263 | - break; | |
264 | -#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6) | |
265 | - case AF_INET6: { | |
266 | -#ifndef INET6_ADDRSTRLEN | |
267 | -#define INET6_ADDRSTRLEN 46 | |
268 | -#endif | |
269 | ||
270 | - char buf[INET6_ADDRSTRLEN]; | |
271 | - | |
272 | - sin6.sin6_port = port; | |
273 | -#ifdef HAVE_INET_NTOP | |
274 | - printf("Trying %s...\r\n", inet_ntop(AF_INET6, | |
275 | - &sin6.sin6_addr, | |
276 | - buf, | |
277 | - sizeof(buf))); | |
278 | -#endif | |
279 | - break; | |
280 | - } | |
281 | -#endif | |
282 | - default: | |
283 | - abort(); | |
284 | - } | |
285 | - | |
286 | - do { | |
287 | - net = socket(family, SOCK_STREAM, 0); | |
288 | - seteuid(getuid()); | |
289 | - setuid(getuid()); | |
290 | - if (net < 0) { | |
291 | - perror("telnet: socket"); | |
292 | - return 0; | |
293 | + net = -1; | |
294 | + retry = 0; | |
295 | + for (res = res0; res; res = res->ai_next) { | |
296 | + if (1 /* retry */) { | |
297 | + char hbuf[NI_MAXHOST]; | |
298 | + | |
299 | + if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf), | |
300 | + NULL, 0, niflags) != 0) { | |
301 | + strcpy(hbuf, "(invalid)"); | |
302 | + } | |
303 | + printf("Trying %s...\r\n", hbuf); | |
304 | } | |
305 | + net = socket(res->ai_family, res->ai_socktype, res->ai_protocol); | |
306 | + if (net < 0) | |
307 | + continue; | |
308 | + | |
309 | if (aliasp) { | |
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); | |
316 | - } else { | |
317 | - alias = gethostbyname(aliasp); | |
318 | - if (alias) { | |
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, | |
325 | - alias->h_length); | |
326 | -#endif /* defined(h_addr) */ | |
327 | - } else { | |
328 | - herror(aliasp); | |
329 | - return 0; | |
330 | - } | |
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); | |
337 | + if (error) { | |
338 | + warn("%s: %s", aliasp, gai_strerror(error)); | |
339 | + close(net); | |
340 | + freeaddrinfo(ares); | |
341 | + continue; | |
342 | } | |
343 | - ladr.sin_port = htons(0); | |
344 | - | |
345 | - if (bind (net, (struct sockaddr *)&ladr, sizeof(ladr)) < 0) { | |
346 | - perror(aliasp);; | |
347 | + if (bind(net, ares->ai_addr, ares->ai_addrlen) < 0) { | |
348 | + perror(aliasp); | |
349 | (void) close(net); /* dump descriptor */ | |
350 | - return 0; | |
351 | + freeaddrinfo(ares); | |
352 | + continue; | |
353 | } | |
354 | + freeaddrinfo(ares); | |
355 | } | |
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)"); | |
361 | #endif | |
362 | #if defined(IPPROTO_IP) && defined(IP_TOS) | |
363 | @@ -2542,65 +2434,32 @@ | |
364 | perror("setsockopt (SO_DEBUG)"); | |
365 | } | |
366 | ||
367 | - if (connect(net, sa, sa_size) < 0) { | |
368 | - int retry = 0; | |
369 | - | |
370 | - if (host && host->h_addr_list[1]) { | |
371 | - int oerrno = errno; | |
372 | - retry = 1; | |
373 | - | |
374 | - switch(family) { | |
375 | - case AF_INET : | |
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)); | |
380 | - break; | |
381 | -#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6) | |
382 | - case AF_INET6: { | |
383 | - char buf[INET6_ADDRSTRLEN]; | |
384 | - | |
385 | - fprintf(stderr, "telnet: connect to address %s: ", | |
386 | - inet_ntop(AF_INET6, &sin6.sin6_addr, buf, | |
387 | - sizeof(buf))); | |
388 | - ++host->h_addr_list; | |
389 | - memcpy(&sin6.sin6_addr, *host->h_addr_list, sizeof(struct in6_addr)); | |
390 | - break; | |
391 | - } | |
392 | -#endif | |
393 | - default: | |
394 | - abort(); | |
395 | - } | |
396 | - | |
397 | - errno = oerrno; | |
398 | - perror(NULL); | |
399 | - | |
400 | - switch(family) { | |
401 | - case AF_INET : | |
402 | - printf("Trying %s...\r\n", inet_ntoa(sin.sin_addr)); | |
403 | - break; | |
404 | -#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6) | |
405 | - case AF_INET6: { | |
406 | - printf("Trying %s...\r\n", inet_ntop(AF_INET6, | |
407 | - &sin6.sin6_addr, | |
408 | - buf, | |
409 | - sizeof(buf))); | |
410 | - break; | |
411 | - } | |
412 | -#endif | |
413 | - } | |
414 | - | |
415 | - (void) NetClose(net); | |
416 | - continue; | |
417 | + if (connect(net, res->ai_addr, res->ai_addrlen) < 0) { | |
418 | + char hbuf[NI_MAXHOST]; | |
419 | + | |
420 | + if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf), | |
421 | + NULL, 0, NI_NUMERICHOST) != 0) { | |
422 | + strcpy(hbuf, "(invalid)"); | |
423 | } | |
424 | - perror("telnet: Unable to connect to remote host"); | |
425 | - return 0; | |
426 | + fprintf(stderr, "telnet: connect to address %s: %s\n", hbuf, | |
427 | + strerror(errno)); | |
428 | + | |
429 | + close(net); | |
430 | + net = -1; | |
431 | + retry++; | |
432 | + continue; | |
433 | } | |
434 | + | |
435 | connected++; | |
436 | #if defined(AUTHENTICATION) || defined(ENCRYPTION) | |
437 | auth_encrypt_connect(connected); | |
438 | #endif /* defined(AUTHENTICATION) */ | |
439 | - } while (connected == 0); | |
440 | + break; | |
441 | + } | |
442 | + freeaddrinfo(res0); | |
443 | + if (net < 0) { | |
444 | + return 0; | |
445 | + } | |
446 | cmdrc(hostp, hostname); | |
447 | if (autologin && user == NULL) { | |
448 | struct passwd *pw; | |
449 | @@ -2652,6 +2511,9 @@ | |
450 | encrypthelp[] = "turn on (off) encryption ('encrypt ?' for more)", | |
451 | #endif | |
452 | zhelp[] = "suspend telnet", | |
453 | +#ifdef SKEY | |
454 | + skeyhelp[] = "compute response to s/key challenge", | |
455 | +#endif | |
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 }, | |
462 | #if defined(SKEY) | |
463 | - { "skey", NULL, skey_calc, 0 }, | |
464 | + { "skey", skeyhelp, skey_calc, 0 }, | |
465 | #endif | |
466 | { 0, 0, 0, 0 } | |
467 | }; | |
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 | |
471 | @@ -1,4 +1,4 @@ | |
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 $ */ | |
475 | ||
476 | /* | |
477 | @@ -447,7 +447,7 @@ | |
478 | *Ibackp, /* Oldest byte of 3270 data */ | |
479 | Ibuf[], /* 3270 buffer */ | |
480 | *Ifrontp, /* Where next 3270 byte goes */ | |
481 | - tline[], | |
482 | + tline[200], | |
483 | *transcom; /* Transparent command */ | |
484 | ||
485 | extern int | |
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 | |
489 | @@ -1,4 +1,4 @@ | |
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 $ */ | |
493 | ||
494 | /* | |
495 | @@ -81,10 +81,10 @@ | |
496 | prompt, | |
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 ] ", | |
501 | #else | |
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 ] ", | |
505 | #endif | |
506 | #if defined(TN3270) && defined(unix) | |
507 | # ifdef AUTHENTICATION | |
508 | @@ -95,13 +95,11 @@ | |
509 | #else | |
510 | "[-r] ", | |
511 | #endif | |
512 | + "\n\r " | |
513 | #ifdef ENCRYPTION | |
514 | - "[-x] [host-name [port]]" | |
515 | -#else | |
516 | - | |
517 | - "[host-name [port]]" | |
518 | + "[-x] " | |
519 | #endif | |
520 | - ); | |
521 | + "[host-name [port]]"); | |
522 | exit(1); | |
523 | } | |
524 | ||
525 | @@ -276,8 +274,8 @@ | |
526 | break; | |
527 | case 't': | |
528 | #if defined(TN3270) && defined(unix) | |
529 | + (void)strncpy(tline, optarg, sizeof(tline)); | |
530 | transcom = tline; | |
531 | - (void)strcpy(transcom, optarg); | |
532 | #else | |
533 | fprintf(stderr, | |
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 | |
538 | @@ -1,4 +1,4 @@ | |
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 $ */ | |
542 | ||
543 | /* | |
544 | @@ -35,6 +35,7 @@ | |
545 | */ | |
546 | ||
547 | #include "telnet_locl.h" | |
548 | +#include <err.h> | |
549 | ||
550 | /* | |
551 | * The following routines try to encapsulate what is system dependent | |
552 | @@ -198,9 +199,10 @@ | |
553 | TerminalFlushOutput(void) | |
554 | { | |
555 | #ifdef TIOCFLUSH | |
556 | - (void) ioctl(fileno(stdout), TIOCFLUSH, (char *) 0); | |
557 | + int com = FWRITE; | |
558 | + (void) ioctl(fileno(stdout), TIOCFLUSH, (int *) &com); | |
559 | #else | |
560 | - (void) ioctl(fileno(stdout), TCFLSH, (char *) 0); | |
561 | + (void) ioctl(fileno(stdout), TCFLSH, (int *) 0); | |
562 | #endif | |
563 | } | |
564 | ||
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 | |
568 | @@ -1,4 +1,4 @@ | |
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 $ */ | |
572 | ||
573 | /* | |
574 | @@ -35,6 +35,8 @@ | |
575 | */ | |
576 | ||
577 | #include "telnet_locl.h" | |
578 | +#include <curses.h> | |
579 | +#include <term.h> | |
580 | ||
581 | #define strip(x) (eight ? (x) : ((x) & 0x7f)) | |
582 | ||
583 | @@ -523,10 +525,9 @@ | |
584 | } | |
585 | ||
586 | /* | |
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). | |
594 | */ | |
595 | ||
596 | int is_unique P((char *, char **, char **)); | |
597 | @@ -554,7 +555,7 @@ | |
598 | /* | |
599 | * Count up the number of names. | |
600 | */ | |
601 | - for (n = 1, cp = buf; *cp && *cp != ':'; cp++) { | |
602 | + for (n = 1, cp = buf; *cp; cp++) { | |
603 | if (*cp == '|') | |
604 | n++; | |
605 | } | |
606 | @@ -659,25 +660,6 @@ | |
607 | return (1); | |
608 | } | |
609 | ||
610 | -static char termbuf[1024]; | |
611 | - | |
612 | -int telnet_setupterm P((char *tname, int fd, int *errp)); /* XXX move elsewhere */ | |
613 | - /*ARGSUSED*/ | |
614 | - int | |
615 | -telnet_setupterm(char *tname, int fd, int *errp) | |
616 | -{ | |
617 | - (void)fd; | |
618 | - if (tgetent(termbuf, tname) == 1) { | |
619 | - termbuf[1023] = '\0'; | |
620 | - if (errp) | |
621 | - *errp = 1; | |
622 | - return(0); | |
623 | - } | |
624 | - if (errp) | |
625 | - *errp = 0; | |
626 | - return(-1); | |
627 | -} | |
628 | - | |
629 | int resettermname = 1; | |
630 | ||
631 | char *gettermname P((void)); /* XXX move elsewhere */ | |
632 | @@ -687,15 +669,15 @@ | |
633 | char *tname; | |
634 | static char **tnamep = 0; | |
635 | static char **next; | |
636 | - int err; | |
637 | + int errret; | |
638 | ||
639 | if (resettermname) { | |
640 | resettermname = 0; | |
641 | if (tnamep && tnamep != unknown) | |
642 | free(tnamep); | |
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); | |
648 | } else { | |
649 | if (tname && ((int)strlen(tname) <= 40)) { | |
650 | unknown[0] = tname; | |
651 | @@ -1482,10 +1464,15 @@ | |
652 | void | |
653 | env_opt_start(void) | |
654 | { | |
655 | - if (opt_reply) | |
656 | - opt_reply = (unsigned char *)realloc(opt_reply, OPT_REPLY_SIZE); | |
657 | - else | |
658 | - opt_reply = (unsigned char *)malloc(OPT_REPLY_SIZE); | |
659 | + unsigned char *p; | |
660 | + | |
661 | + if (opt_reply) { | |
662 | + p = (unsigned char *)realloc(opt_reply, OPT_REPLY_SIZE); | |
663 | + if (p == NULL) | |
664 | + free(opt_reply); | |
665 | + } else | |
666 | + p = (unsigned char *)malloc(OPT_REPLY_SIZE); | |
667 | + opt_reply = p; | |
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) | |
673 | { | |
674 | int len; | |
675 | + unsigned char *p; | |
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); | |
680 | + if (p == NULL) | |
681 | + free(opt_reply); | |
682 | + opt_reply = p; | |
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); | |
688 | continue; | |
689 | } | |
690 | - if (sc == escape) { | |
691 | + if (sc == escape && escape != _POSIX_VDISABLE) { | |
692 | command(0, (char *)tbp, tcc); | |
693 | bol = 1; | |
694 | count += tcc; | |
695 | @@ -1962,7 +1953,7 @@ | |
696 | } | |
697 | if ((sc == '\n') || (sc == '\r')) | |
698 | bol = 1; | |
699 | - } else if (sc == escape) { | |
700 | + } else if (sc == escape && escape != _POSIX_VDISABLE) { | |
701 | /* | |
702 | * Double escape is a pass through of a single escape character. | |
703 | */ | |
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 | |
707 | @@ -1,4 +1,4 @@ | |
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 $ */ | |
711 | ||
712 | /* | |
713 | @@ -86,7 +86,5 @@ | |
714 | #include "defines.h" | |
715 | #include "types.h" | |
716 | ||
717 | -#undef AF_INET6 /* XXX - it has not been tested and it doesn't exist yet */ | |
718 | - | |
719 | /* prototypes */ | |
720 | ||
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 @@ | |
725 | char ts[MAXPATHLEN]; | |
726 | struct passwd *pw = getpwnam(UserNameRequested); | |
727 | ||
728 | - if(pw){ | |
729 | + if (pw) { | |
730 | snprintf(ts, sizeof(ts), | |
731 | - "%s%u", | |
732 | - TKT_ROOT, | |
733 | - (unsigned)pw->pw_uid); | |
734 | + "%s%u", TKT_ROOT, (unsigned)pw->pw_uid); | |
735 | + /* XXX allocation failure? */ | |
736 | setenv("KRBTKFILE", ts, 1); | |
737 | } | |
738 | Data(ap, KRB_ACCEPT, NULL, 0); | |
739 | @@ -609,16 +608,26 @@ | |
740 | { | |
741 | unsigned char *p = buf; | |
742 | ||
743 | - p += krb_put_nir(cred->service, cred->instance, cred->realm, p); | |
744 | + memcpy (p, cred->service, ANAME_SZ); | |
745 | + p += ANAME_SZ; | |
746 | + memcpy (p, cred->instance, INST_SZ); | |
747 | + p += INST_SZ; | |
748 | + memcpy (p, cred->realm, REALM_SZ); | |
749 | + p += REALM_SZ; | |
750 | memcpy(p, cred->session, 8); | |
751 | p += 8; | |
752 | *p++ = cred->lifetime; | |
753 | *p++ = cred->kvno; | |
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'; | |
763 | + p += ANAME_SZ; | |
764 | + strncpy (cred->pinst, p, INST_SZ); | |
765 | + cred->pinst[INST_SZ - 1] = '\0'; | |
766 | + p += INST_SZ; | |
767 | return p - buf; | |
768 | } | |
769 | ||
770 | @@ -627,7 +636,16 @@ | |
771 | { | |
772 | unsigned char *p = buf; | |
773 | ||
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'; | |
777 | + p += ANAME_SZ; | |
778 | + strncpy (cred->instance, p, INST_SZ); | |
779 | + cred->instance[INST_SZ - 1] = '\0'; | |
780 | + p += INST_SZ; | |
781 | + strncpy (cred->realm, p, REALM_SZ); | |
782 | + cred->realm[REALM_SZ - 1] = '\0'; | |
783 | + p += REALM_SZ; | |
784 | + | |
785 | memcpy(cred->session, p, 8); | |
786 | p += 8; | |
787 | cred->lifetime = *p++; | |
788 | @@ -636,7 +654,10 @@ | |
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), | |
796 | + NULL, 0); | |
797 | return 0; | |
798 | } | |
799 | ||
800 | --- telnet/telnet.1 Thu Nov 12 01:01:46 1998 | |
801 | +++ telnet.obsd-cvs/telnet.1 Thu Nov 9 19:52:41 2000 | |
802 | @@ -1,4 +1,4 @@ | |
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 $ | |
806 | .\" | |
807 | .\" Copyright (c) 1983, 1990, 1993 | |
808 | @@ -36,45 +36,34 @@ | |
809 | .\" | |
810 | .Dd February 3, 1994 | |
811 | .Dt TELNET 1 | |
812 | -.Os BSD 4.2 | |
813 | +.Os | |
814 | .Sh NAME | |
815 | .Nm telnet | |
816 | -.Nd user interface to the | |
817 | +.Nd user interface to the | |
818 | .Tn TELNET | |
819 | protocol | |
820 | .Sh SYNOPSIS | |
821 | .Nm telnet | |
822 | -.Op Fl 8 | |
823 | -.Op Fl E | |
824 | -.Op Fl F | |
825 | -.Op Fl K | |
826 | -.Op Fl L | |
827 | -.Op Fl S Ar tos | |
828 | +.Op Fl 8EFKLacdfrx | |
829 | .Op Fl X Ar authtype | |
830 | -.Op Fl a | |
831 | .Op Fl b Ar hostalias | |
832 | -.Op Fl c | |
833 | -.Op Fl d | |
834 | .Op Fl e Ar escapechar | |
835 | -.Op Fl f | |
836 | .Op Fl k Ar realm | |
837 | .Op Fl l Ar user | |
838 | .Op Fl n Ar tracefile | |
839 | -.Op Fl r | |
840 | -.Op Fl x | |
841 | .Oo | |
842 | .Ar host | |
843 | .Op Ar port | |
844 | .Oc | |
845 | .Sh DESCRIPTION | |
846 | The | |
847 | -.Nm telnet | |
848 | +.Nm | |
849 | command | |
850 | -is used to communicate with another host using the | |
851 | +is used to communicate with another host using the | |
852 | .Tn TELNET | |
853 | protocol. | |
854 | If | |
855 | -.Nm telnet | |
856 | +.Nm | |
857 | is invoked without the | |
858 | .Ar host | |
859 | argument, it enters command mode, | |
860 | @@ -85,11 +74,11 @@ | |
861 | .Ic open | |
862 | command with those arguments. | |
863 | .Pp | |
864 | -Options: | |
865 | -.Bl -tag -width indent | |
866 | +The options are as follows: | |
867 | +.Bl -tag -width Ds | |
868 | .It Fl 8 | |
869 | -Specifies an 8-bit data path. This causes an attempt to | |
870 | -negotiate the | |
871 | +Specifies an 8-bit data path. | |
872 | +This causes an attempt to negotiate the | |
873 | .Dv TELNET BINARY | |
874 | option on both input and output. | |
875 | .It Fl E | |
876 | @@ -103,18 +92,9 @@ | |
877 | .It Fl K | |
878 | Specifies no automatic login to the remote system. | |
879 | .It Fl L | |
880 | -Specifies an 8-bit data path on output. This causes the | |
881 | -BINARY option to be negotiated on output. | |
882 | -.It Fl S Ar tos | |
883 | -Sets the IP type-of-service (TOS) option for the telnet | |
884 | -connection to the value | |
885 | -.Ar tos , | |
886 | -which can be a numeric TOS value | |
887 | -or, on systems that support it, a symbolic | |
888 | -TOS name found in the | |
889 | -.Pa /etc/iptos | |
890 | -file. | |
891 | -.It Fl X Ar atype | |
892 | +Specifies an 8-bit data path on output. | |
893 | +This causes the BINARY option to be negotiated on output. | |
894 | +.It Fl X Ar atype | |
895 | Disables the | |
896 | .Ar atype | |
897 | type of authentication. | |
898 | @@ -144,7 +124,8 @@ | |
899 | .It Fl c | |
900 | Disables the reading of the user's | |
901 | .Pa \&.telnetrc | |
902 | -file. (See the | |
903 | +file. | |
904 | +(See the | |
905 | .Ic toggle skiprc | |
906 | command on this man page.) | |
907 | .It Fl d | |
908 | @@ -152,7 +133,7 @@ | |
909 | .Ic debug | |
910 | toggle to | |
911 | .Dv TRUE . | |
912 | -.It Fl e Ar escapechar | |
913 | +.It Fl e Ar escapechar | |
914 | Sets the initial | |
915 | .Nm | |
916 | escape character to | |
917 | @@ -169,14 +150,14 @@ | |
918 | If Kerberos authentication is being used, the | |
919 | .Fl k | |
920 | option requests that | |
921 | -.Nm telnet | |
922 | +.Nm | |
923 | obtain tickets for the remote host in | |
924 | realm | |
925 | .Ar realm | |
926 | instead of the remote host's realm, as determined | |
927 | by | |
928 | .Xr krb_realmofhost 3 . | |
929 | -.It Fl l Ar user | |
930 | +.It Fl l Ar user | |
931 | When connecting to the remote system, if the remote system | |
932 | understands the | |
933 | .Ev ENVIRON | |
934 | @@ -189,7 +170,7 @@ | |
935 | This option may also be used with the | |
936 | .Ic open | |
937 | command. | |
938 | -.It Fl n Ar tracefile | |
939 | +.It Fl n Ar tracefile | |
940 | Opens | |
941 | .Ar tracefile | |
942 | for recording trace information. | |
943 | @@ -210,35 +191,38 @@ | |
944 | Indicates the official name, an alias, or the Internet address | |
945 | of a remote host. | |
946 | .It Ar port | |
947 | -Indicates a port number (address of an application). If a number is | |
948 | -not specified, the default | |
949 | -.Nm telnet | |
950 | +Indicates a port number (address of an application). | |
951 | +If a number is not specified, the default | |
952 | +.Nm | |
953 | port is used. | |
954 | .El | |
955 | .Pp | |
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. | |
962 | .Pp | |
963 | Once a connection has been opened, | |
964 | -.Nm telnet | |
965 | +.Nm | |
966 | will attempt to enable the | |
967 | .Dv TELNET LINEMODE | |
968 | option. | |
969 | If this fails, | |
970 | -.Nm telnet | |
971 | +.Nm | |
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. | |
976 | .Pp | |
977 | -When | |
978 | +When | |
979 | .Dv LINEMODE | |
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. | |
983 | +When input | |
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. | |
990 | .Pp | |
991 | @@ -252,7 +236,7 @@ | |
992 | (this would mostly be used to enter passwords | |
993 | without the password being echoed). | |
994 | .Pp | |
995 | -If the | |
996 | +If the | |
997 | .Dv LINEMODE | |
998 | option is enabled, or if the | |
999 | .Ic localchars | |
1000 | @@ -267,7 +251,7 @@ | |
1001 | characters are trapped locally, and sent as | |
1002 | .Tn TELNET | |
1003 | protocol sequences to the remote side. | |
1004 | -If | |
1005 | +If | |
1006 | .Dv LINEMODE | |
1007 | has ever been enabled, then the user's | |
1008 | .Ic susp | |
1009 | @@ -278,9 +262,9 @@ | |
1010 | protocol sequences, | |
1011 | and | |
1012 | .Ic quit | |
1013 | -is sent as a | |
1014 | +is sent as a | |
1015 | .Dv TELNET ABORT | |
1016 | -instead of | |
1017 | +instead of | |
1018 | .Dv BREAK . | |
1019 | There are options (see | |
1020 | .Ic toggle | |
1021 | @@ -296,17 +280,26 @@ | |
1022 | (in the case of | |
1023 | .Ic quit | |
1024 | and | |
1025 | -.Ic intr ) . | |
1026 | +.Ic intr ) . | |
1027 | .Pp | |
1028 | While connected to a remote host, | |
1029 | -.Nm telnet | |
1030 | +.Nm | |
1031 | command mode may be entered by typing the | |
1032 | -.Nm telnet | |
1033 | +.Nm | |
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 | |
1037 | +invocation of | |
1038 | +.Nm | |
1039 | +that has the controlling terminal. | |
1040 | +Use the | |
1041 | +.Cm send escape | |
1042 | +command to switch to command mode in subsequent | |
1043 | +.Nm | |
1044 | +processes on remote hosts. | |
1045 | .Pp | |
1046 | The following | |
1047 | -.Nm telnet | |
1048 | +.Nm | |
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 @@ | |
1053 | .Ic display | |
1054 | commands). | |
1055 | .Bl -tag -width "mode type" | |
1056 | -.It Ic auth Ar argument Op Ar ... | |
1057 | +.It Ic auth Ar argument Op Ar ... | |
1058 | The | |
1059 | .Ic auth | |
1060 | command manipulates the information sent through the | |
1061 | .Dv TELNET AUTHENTICATE | |
1062 | -option. Valid arguments for the | |
1063 | -auth command are as follows: | |
1064 | +option. | |
1065 | +Valid arguments for the | |
1066 | +.Ic auth | |
1067 | +command are as follows: | |
1068 | .Bl -tag -width "disable type" | |
1069 | .It Ic disable Ar type | |
1070 | Disables the specified | |
1071 | .Ar type | |
1072 | -of authentication. To | |
1073 | -obtain a list of available types, use the | |
1074 | +of authentication. | |
1075 | +To obtain a list of available types, use the | |
1076 | .Ic auth disable \&? | |
1077 | command. | |
1078 | .It Ic enable Ar type | |
1079 | Enables the specified | |
1080 | .Ar type | |
1081 | -of authentication. To | |
1082 | -obtain a list of available types, use the | |
1083 | +of authentication. | |
1084 | +To obtain a list of available types, use the | |
1085 | .Ic auth enable \&? | |
1086 | command. | |
1087 | .It Ic status | |
1088 | @@ -350,7 +345,7 @@ | |
1089 | Close a | |
1090 | .Tn TELNET | |
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 | |
1095 | .Ic set | |
1096 | and | |
1097 | @@ -368,26 +363,27 @@ | |
1098 | .It Ic disable Ar type Ic [input|output] | |
1099 | Disables the specified | |
1100 | .Ar type | |
1101 | -of encryption. If you | |
1102 | -omit | |
1103 | +of encryption. | |
1104 | +If you omit | |
1105 | .Ic input | |
1106 | and | |
1107 | .Ic output , | |
1108 | both input and output | |
1109 | -are disabled. To obtain a list of available | |
1110 | -types, use the | |
1111 | +are disabled. | |
1112 | +To obtain a list of available types, use the | |
1113 | .Ic encrypt disable \&? | |
1114 | command. | |
1115 | .It Ic enable Ar type Ic [input|output] | |
1116 | Enables the specified | |
1117 | .Ar type | |
1118 | -of encryption. If you | |
1119 | -omit | |
1120 | +of encryption. | |
1121 | +If you omit | |
1122 | .Ic input | |
1123 | and | |
1124 | .Ic output , | |
1125 | both input and output are | |
1126 | -enabled. To obtain a list of available types, use the | |
1127 | +enabled. | |
1128 | +To obtain a list of available types, use the | |
1129 | .Ic encrypt enable \&? | |
1130 | command. | |
1131 | .It Ic input | |
1132 | @@ -407,18 +403,20 @@ | |
1133 | .Ic encrypt stop output | |
1134 | command. | |
1135 | .It Ic start Ic [input|output] | |
1136 | -Attempts to start encryption. If you omit | |
1137 | +Attempts to start encryption. | |
1138 | +If you omit | |
1139 | .Ic input | |
1140 | and | |
1141 | -.Ic output, | |
1142 | -both input and output are enabled. To | |
1143 | -obtain a list of available types, use the | |
1144 | +.Ic output , | |
1145 | +both input and output are enabled. | |
1146 | +To obtain a list of available types, use the | |
1147 | .Ic encrypt enable \&? | |
1148 | command. | |
1149 | .It Ic status | |
1150 | Lists the current status of encryption. | |
1151 | .It Ic stop Ic [input|output] | |
1152 | -Stops encryption. If you omit | |
1153 | +Stops encryption. | |
1154 | +If you omit | |
1155 | .Ic input | |
1156 | and | |
1157 | .Ic output , | |
1158 | @@ -431,7 +429,7 @@ | |
1159 | .Ic encrypt stop | |
1160 | commands. | |
1161 | .El | |
1162 | -.It Ic environ Ar arguments Op Ar ... | |
1163 | +.It Ic environ Ar arguments Op Ar ... | |
1164 | The | |
1165 | .Ic environ | |
1166 | command is used to manipulate the | |
1167 | @@ -456,7 +454,7 @@ | |
1168 | .Ic environ | |
1169 | command are: | |
1170 | .Bl -tag -width Fl | |
1171 | -.It Ic define Ar variable value | |
1172 | +.It Ic define Ar variable value | |
1173 | Define the variable | |
1174 | .Ar variable | |
1175 | to have a value of | |
1176 | @@ -466,15 +464,15 @@ | |
1177 | .Ar value | |
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 | |
1182 | Remove | |
1183 | .Ar variable | |
1184 | from the list of environment variables. | |
1185 | -.It Ic export Ar variable | |
1186 | +.It Ic export Ar variable | |
1187 | Mark the variable | |
1188 | .Ar variable | |
1189 | to be exported to the remote side. | |
1190 | -.It Ic unexport Ar variable | |
1191 | +.It Ic unexport Ar variable | |
1192 | Mark the variable | |
1193 | .Ar variable | |
1194 | to not be exported unless | |
1195 | @@ -508,7 +506,7 @@ | |
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 | |
1201 | .Ar type | |
1202 | is one of several options, depending on the state of the | |
1203 | .Tn TELNET | |
1204 | @@ -529,40 +527,40 @@ | |
1205 | option, or, if the remote side does not understand the | |
1206 | .Dv LINEMODE | |
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 | |
1212 | .Dv TRAPSIG | |
1213 | -mode of the | |
1214 | +mode of the | |
1215 | .Dv LINEMODE | |
1216 | option. | |
1217 | -This requires that the | |
1218 | +This requires that the | |
1219 | .Dv LINEMODE | |
1220 | option be enabled. | |
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 | |
1225 | .Dv EDIT | |
1226 | -mode of the | |
1227 | +mode of the | |
1228 | .Dv LINEMODE | |
1229 | option. | |
1230 | -This requires that the | |
1231 | +This requires that the | |
1232 | .Dv LINEMODE | |
1233 | option be enabled. | |
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 | |
1238 | .Dv SOFT_TAB | |
1239 | -mode of the | |
1240 | +mode of the | |
1241 | .Dv LINEMODE | |
1242 | option. | |
1243 | -This requires that the | |
1244 | +This requires that the | |
1245 | .Dv LINEMODE | |
1246 | option be enabled. | |
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 | |
1251 | .Dv LIT_ECHO | |
1252 | -mode of the | |
1253 | +mode of the | |
1254 | .Dv LINEMODE | |
1255 | option. | |
1256 | -This requires that the | |
1257 | +This requires that the | |
1258 | .Dv LINEMODE | |
1259 | option be enabled. | |
1260 | .It Ic \&? | |
1261 | @@ -579,7 +577,7 @@ | |
1262 | Open a connection to the named host. | |
1263 | If no port number | |
1264 | is specified, | |
1265 | -.Nm telnet | |
1266 | +.Nm | |
1267 | will attempt to contact a | |
1268 | .Tn TELNET | |
1269 | server at the default port. | |
1270 | @@ -594,24 +592,29 @@ | |
1271 | .Ev ENVIRON | |
1272 | option. | |
1273 | When connecting to a non-standard port, | |
1274 | -.Nm telnet | |
1275 | +.Nm | |
1276 | omits any automatic initiation of | |
1277 | .Tn TELNET | |
1278 | -options. When the port number is preceded by a minus sign, | |
1279 | +options. | |
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 | |
1283 | .Pa \&.telnetrc | |
1284 | in the | |
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 | |
1291 | -.Nm telnet | |
1292 | +user's home directory is opened. | |
1293 | +Lines beginning with a ``#'' are | |
1294 | +comment lines. | |
1295 | +Blank lines are ignored. | |
1296 | +Lines that begin | |
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 | |
1302 | +.Nm | |
1303 | commands and are processed as if they had been typed | |
1304 | in manually to the | |
1305 | -.Nm telnet | |
1306 | +.Nm | |
1307 | command prompt. | |
1308 | .It Ic quit | |
1309 | Close any open | |
1310 | @@ -619,7 +622,7 @@ | |
1311 | session and exit | |
1312 | .Nm telnet . | |
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): | |
1319 | @@ -673,7 +676,7 @@ | |
1320 | sequence. | |
1321 | .It Ic escape | |
1322 | Sends the current | |
1323 | -.Nm telnet | |
1324 | +.Nm | |
1325 | escape character (initially ``^]''). | |
1326 | .It Ic ga | |
1327 | Sends the | |
1328 | @@ -788,12 +791,12 @@ | |
1329 | .Ic send | |
1330 | command. | |
1331 | .El | |
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 | |
1336 | The | |
1337 | .Ic set | |
1338 | command will set any one of a number of | |
1339 | -.Nm telnet | |
1340 | +.Nm | |
1341 | variables to a specific value or to | |
1342 | .Dv TRUE . | |
1343 | The special value | |
1344 | @@ -811,7 +814,8 @@ | |
1345 | .Ic display | |
1346 | command. | |
1347 | The variables which may be set or unset, but not toggled, are | |
1348 | -listed here. In addition, any of the variables for the | |
1349 | +listed here. | |
1350 | +In addition, any of the variables for the | |
1351 | .Ic toggle | |
1352 | command may be explicitly set or unset using | |
1353 | the | |
1354 | @@ -832,7 +836,8 @@ | |
1355 | sequence (see | |
1356 | .Ic send ayt | |
1357 | preceding) is sent to the | |
1358 | -remote host. The initial value for the "Are You There" | |
1359 | +remote host. | |
1360 | +The initial value for the "Are You There" | |
1361 | character is the terminal's status character. | |
1362 | .It Ic echo | |
1363 | This is the value (initially ``^E'') which, when in | |
1364 | @@ -841,7 +846,7 @@ | |
1365 | echoing of entered characters (for entering, say, a password). | |
1366 | .It Ic eof | |
1367 | If | |
1368 | -.Nm telnet | |
1369 | +.Nm | |
1370 | is operating in | |
1371 | .Dv LINEMODE | |
1372 | or ``old line by line'' mode, entering this character | |
1373 | @@ -854,7 +859,7 @@ | |
1374 | character. | |
1375 | .It Ic erase | |
1376 | If | |
1377 | -.Nm telnet | |
1378 | +.Nm | |
1379 | is in | |
1380 | .Ic localchars | |
1381 | mode (see | |
1382 | @@ -862,7 +867,7 @@ | |
1383 | .Ic localchars | |
1384 | below), | |
1385 | and if | |
1386 | -.Nm telnet | |
1387 | +.Nm | |
1388 | is operating in ``character at a time'' mode, then when this | |
1389 | character is typed, a | |
1390 | .Dv TELNET EC | |
1391 | @@ -879,14 +884,14 @@ | |
1392 | character. | |
1393 | .It Ic escape | |
1394 | This is the | |
1395 | -.Nm telnet | |
1396 | +.Nm | |
1397 | escape character (initially ``^['') which causes entry | |
1398 | into | |
1399 | -.Nm telnet | |
1400 | +.Nm | |
1401 | command mode (when connected to a remote system). | |
1402 | .It Ic flushoutput | |
1403 | If | |
1404 | -.Nm telnet | |
1405 | +.Nm | |
1406 | is in | |
1407 | .Ic localchars | |
1408 | mode (see | |
1409 | @@ -916,12 +921,13 @@ | |
1410 | .Dv LINEMODE , | |
1411 | these are the | |
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. | |
1418 | .It Ic interrupt | |
1419 | If | |
1420 | -.Nm telnet | |
1421 | +.Nm | |
1422 | is in | |
1423 | .Ic localchars | |
1424 | mode (see | |
1425 | @@ -945,7 +951,7 @@ | |
1426 | character. | |
1427 | .It Ic kill | |
1428 | If | |
1429 | -.Nm telnet | |
1430 | +.Nm | |
1431 | is in | |
1432 | .Ic localchars | |
1433 | mode (see | |
1434 | @@ -953,7 +959,7 @@ | |
1435 | .Ic localchars | |
1436 | below), | |
1437 | and if | |
1438 | -.Nm telnet | |
1439 | +.Nm | |
1440 | is operating in ``character at a time'' mode, then when this | |
1441 | character is typed, a | |
1442 | .Dv TELNET EL | |
1443 | @@ -970,7 +976,7 @@ | |
1444 | character. | |
1445 | .It Ic lnext | |
1446 | If | |
1447 | -.Nm telnet | |
1448 | +.Nm | |
1449 | is operating in | |
1450 | .Dv LINEMODE | |
1451 | or ``old line by line'' mode, then this character is taken to | |
1452 | @@ -985,7 +991,7 @@ | |
1453 | character. | |
1454 | .It Ic quit | |
1455 | If | |
1456 | -.Nm telnet | |
1457 | +.Nm | |
1458 | is in | |
1459 | .Ic localchars | |
1460 | mode (see | |
1461 | @@ -1009,7 +1015,7 @@ | |
1462 | character. | |
1463 | .It Ic reprint | |
1464 | If | |
1465 | -.Nm telnet | |
1466 | +.Nm | |
1467 | is operating in | |
1468 | .Dv LINEMODE | |
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 | |
1473 | suspends the | |
1474 | -.Nm telnet | |
1475 | -command. The initial state is to | |
1476 | +.Nm | |
1477 | +command. | |
1478 | +The initial state is to | |
1479 | disable the | |
1480 | .Ic rlogin | |
1481 | escape character. | |
1482 | @@ -1066,7 +1073,7 @@ | |
1483 | character. | |
1484 | .It Ic susp | |
1485 | If | |
1486 | -.Nm telnet | |
1487 | +.Nm | |
1488 | is in | |
1489 | .Ic localchars | |
1490 | mode, or | |
1491 | @@ -1093,12 +1100,13 @@ | |
1492 | .Ic option | |
1493 | tracing being | |
1494 | .Dv TRUE , | |
1495 | -will be written. If it is set to | |
1496 | +will be written. | |
1497 | +If it is set to | |
1498 | .Dq Fl , | |
1499 | then tracing information will be written to standard output (the default). | |
1500 | .It Ic worderase | |
1501 | If | |
1502 | -.Nm telnet | |
1503 | +.Nm | |
1504 | is operating in | |
1505 | .Dv LINEMODE | |
1506 | or ``old line by line'' mode, then this character is taken to | |
1507 | @@ -1117,25 +1125,32 @@ | |
1508 | .Pq Ic unset | |
1509 | commands. | |
1510 | .El | |
1511 | -.It Ic slc Ar state | |
1512 | +.It Ic skey Ar sequence challenge | |
1513 | +The | |
1514 | +.Ic skey | |
1515 | +command computes a response to the S/Key challenge. | |
1516 | +See | |
1517 | +.Xr skey 1 | |
1518 | +for more information on the S/Key system. | |
1519 | +.It Ic slc Ar state | |
1520 | The | |
1521 | .Ic slc | |
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 | |
1526 | .Dv TELNET LINEMODE | |
1527 | option has | |
1528 | -been enabled. Special characters are characters that get | |
1529 | -mapped to | |
1530 | +been enabled. | |
1531 | +Special characters are characters that get mapped to | |
1532 | .Tn TELNET | |
1533 | commands sequences (like | |
1534 | .Ic ip | |
1535 | or | |
1536 | -.Ic quit ) | |
1537 | +.Ic quit ) | |
1538 | or line editing characters (like | |
1539 | .Ic erase | |
1540 | and | |
1541 | -.Ic kill ) . | |
1542 | +.Ic kill ) . | |
1543 | By default, the local special characters are exported. | |
1544 | .Bl -tag -width Fl | |
1545 | .It Ic check | |
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. | |
1549 | .It Ic export | |
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 | |
1554 | the time when | |
1555 | -.Nm telnet | |
1556 | +.Nm | |
1557 | was started. | |
1558 | .It Ic import | |
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 | |
1563 | .Tn TELNET | |
1564 | connection was established. | |
1565 | .It Ic \&? | |
1566 | @@ -1165,13 +1180,13 @@ | |
1567 | .Nm telnet . | |
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 ... | |
1572 | Toggle (between | |
1573 | .Dv TRUE | |
1574 | and | |
1575 | .Dv FALSE ) | |
1576 | various flags that control how | |
1577 | -.Nm telnet | |
1578 | +.Nm | |
1579 | responds to events. | |
1580 | These flags may be set explicitly to | |
1581 | .Dv TRUE | |
1582 | @@ -1206,7 +1221,7 @@ | |
1583 | sequences; see | |
1584 | .Ic set | |
1585 | above for details), | |
1586 | -.Nm telnet | |
1587 | +.Nm | |
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 | |
1593 | .Dv FALSE | |
1594 | (see | |
1595 | -.Xr stty 1 ) . | |
1596 | +.Xr stty 1 ) . | |
1597 | .It Ic autodecrypt | |
1598 | When the | |
1599 | .Dv TELNET ENCRYPT | |
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. | |
1604 | +The | |
1605 | .Ic autoencrypt | |
1606 | .Pq Ic autodecrypt | |
1607 | command states that encryption of the | |
1608 | @@ -1238,7 +1254,8 @@ | |
1609 | .Dv TELNET AUTHENTICATION | |
1610 | option | |
1611 | .Tn TELNET | |
1612 | -attempts to use it to perform automatic authentication. If the | |
1613 | +attempts to use it to perform automatic authentication. | |
1614 | +If the | |
1615 | .Dv 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 | |
1620 | .Dv FALSE . | |
1621 | .It Ic debug | |
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 | |
1625 | .Dv FALSE . | |
1626 | .It Ic encdebug | |
1627 | @@ -1340,7 +1357,7 @@ | |
1628 | .Ic brk , | |
1629 | .Ic ec , | |
1630 | and | |
1631 | -.Ic el ; | |
1632 | +.Ic el ; | |
1633 | see | |
1634 | .Ic send | |
1635 | above). | |
1636 | @@ -1379,7 +1396,7 @@ | |
1637 | .Dv FALSE . | |
1638 | .It Ic options | |
1639 | Toggles the display of some internal | |
1640 | -.Nm telnet | |
1641 | +.Nm | |
1642 | protocol processing (having to do with | |
1643 | .Tn TELNET | |
1644 | options). | |
1645 | @@ -1404,8 +1421,8 @@ | |
1646 | skips the reading of the | |
1647 | .Pa \&.telnetrc | |
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 | |
1653 | .Dv FALSE . | |
1654 | .It Ic termdata | |
1655 | Toggles the display of all terminal data (in hexadecimal format). | |
1656 | @@ -1416,9 +1433,10 @@ | |
1657 | .Ic verbose_encrypt | |
1658 | toggle is | |
1659 | .Dv TRUE , | |
1660 | -.Nm telnet | |
1661 | +.Nm | |
1662 | prints out a message each time encryption is enabled or | |
1663 | -disabled. The initial value for this toggle is | |
1664 | +disabled. | |
1665 | +The initial value for this toggle is | |
1666 | .Dv FALSE . | |
1667 | .It Ic \&? | |
1668 | Displays the legal | |
1669 | @@ -1430,22 +1448,24 @@ | |
1670 | .Nm telnet . | |
1671 | This command only works when the user is using the | |
1672 | .Xr csh 1 . | |
1673 | -.It Ic \&! Op Ar command | |
1674 | +.It Ic \&! Op Ar command | |
1675 | Execute a single command in a subshell on the local | |
1676 | -system. If | |
1677 | +system. | |
1678 | +If | |
1679 | .Ar command | |
1680 | is omitted, then an interactive | |
1681 | subshell is invoked. | |
1682 | -.It Ic \&? Op Ar command | |
1683 | -Get help. With no arguments, | |
1684 | -.Nm telnet | |
1685 | +.It Ic \&? Op Ar command | |
1686 | +Get help. | |
1687 | +With no arguments, | |
1688 | +.Nm | |
1689 | prints a help summary. | |
1690 | If a command is specified, | |
1691 | -.Nm telnet | |
1692 | +.Nm | |
1693 | will print the help information for just that command. | |
1694 | .El | |
1695 | .Sh ENVIRONMENT | |
1696 | -.Nm telnet | |
1697 | +.Nm | |
1698 | uses at least the | |
1699 | .Ev HOME , | |
1700 | .Ev SHELL , | |
1701 | @@ -1464,16 +1484,18 @@ | |
1702 | .El | |
1703 | .Sh HISTORY | |
1704 | The | |
1705 | -.Nm telnet | |
1706 | +.Nm | |
1707 | command appeared in | |
1708 | .Bx 4.2 . | |
1709 | .Sh NOTES | |
1710 | On some remote systems, echo has to be turned off manually when in | |
1711 | ``old line by line'' mode. | |
1712 | .Pp | |
1713 | -In ``old line by line'' mode or | |
1714 | +In ``old line by line'' mode or | |
1715 | .Dv LINEMODE | |
1716 | the terminal's | |
1717 | .Ic eof | |
1718 | character is only recognized (and sent to the remote system) | |
1719 | when it is the first character on a line. | |
1720 | +.Pp | |
1721 | +Source routing is not supported yet for IPv6. |