diff options
Diffstat (limited to 'contrib/telnet/telnet')
-rw-r--r-- | contrib/telnet/telnet/commands.c | 45 | ||||
-rw-r--r-- | contrib/telnet/telnet/main.c | 36 | ||||
-rw-r--r-- | contrib/telnet/telnet/ring.c | 12 | ||||
-rw-r--r-- | contrib/telnet/telnet/ring.h | 5 | ||||
-rw-r--r-- | contrib/telnet/telnet/sys_bsd.c | 6 | ||||
-rw-r--r-- | contrib/telnet/telnet/telnet.1 | 101 | ||||
-rw-r--r-- | contrib/telnet/telnet/telnet.c | 10 | ||||
-rw-r--r-- | contrib/telnet/telnet/utilities.c | 3 |
8 files changed, 117 insertions, 101 deletions
diff --git a/contrib/telnet/telnet/commands.c b/contrib/telnet/telnet/commands.c index ab25963..15cc503 100644 --- a/contrib/telnet/telnet/commands.c +++ b/contrib/telnet/telnet/commands.c @@ -53,6 +53,7 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95"; #include <fcntl.h> #endif /* CRAY */ +#include <string.h> #include <signal.h> #include <netdb.h> #include <ctype.h> @@ -63,6 +64,7 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95"; #include <stdlib.h> #include <arpa/telnet.h> +#include <arpa/inet.h> #include "general.h" @@ -88,10 +90,9 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95"; #include <netinet/ip.h> #include <netinet/ip6.h> - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif MAXHOSTNAMELEN +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 256 +#endif MAXHOSTNAMELEN #if defined(IPPROTO_IP) && defined(IP_TOS) int tos = -1; @@ -110,7 +111,6 @@ static int help(int argc, char *argv[]); static int call(); static void cmdrc(char *m1, char *m2); static int switch_af(struct addrinfo **aip); - int quit(void); typedef struct { @@ -125,11 +125,11 @@ static char saveline[256]; static int margc; static char *margv[20]; -#if defined(SKEY) +#if defined(OPIE) #include <sys/wait.h> -#define PATH_SKEY "/usr/bin/key" +#define PATH_OPIEKEY "/usr/bin/opiekey" int -skey_calc(argc, argv) +opie_calc(argc, argv) int argc; char **argv; { @@ -142,7 +142,7 @@ skey_calc(argc, argv) switch(fork()) { case 0: - execv(PATH_SKEY, argv); + execv(PATH_OPIEKEY, argv); exit (1); case -1: perror("fork"); @@ -1452,7 +1452,6 @@ shell(argc, argv) * Fire up the shell in the child. */ register char *shellp, *shellname; - extern char *strrchr(); shellp = getenv("SHELL"); if (shellp == NULL) @@ -1462,9 +1461,9 @@ shell(argc, argv) else shellname++; if (argc > 1) - execl(shellp, shellname, "-c", &saveline[1], 0); + execl(shellp, shellname, "-c", &saveline[1], (char *)0); else - execl(shellp, shellname, 0); + execl(shellp, shellname, (char *)0); perror("Execl"); _exit(1); } @@ -1741,7 +1740,6 @@ env_init() extern char **environ; register char **epp, *cp; register struct env_lst *ep; - extern char *strchr(); for (epp = environ; *epp; epp++) { if ((cp = strchr(*epp, '='))) { @@ -2362,7 +2360,7 @@ tn(argc, argv) int argc; char *argv[]; { - char *srp = 0, *strrchr(); + char *srp = 0; int proto, opt; int sourceroute(), srlen; int srcroute = 0, result; @@ -2582,7 +2580,7 @@ tn(argc, argv) tos = tp->t_tos; # endif if (tos < 0) - tos = 020; /* Low Delay bit */ + tos = IPTOS_LOWDELAY; if (tos && (setsockopt(net, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(int)) < 0) @@ -2711,8 +2709,8 @@ static char #if defined(unix) zhelp[] = "suspend telnet", #endif /* defined(unix) */ -#if defined(SKEY) - skeyhelp[] = "compute response to s/key challenge", +#if defined(OPIE) + opiehelp[] = "compute response to OPIE challenge", #endif shellhelp[] = "invoke a subshell", envhelp[] = "change environment variables ('environ ?' for more)", @@ -2723,6 +2721,7 @@ static Command cmdtab[] = { { "logout", logouthelp, logout, 1 }, { "display", displayhelp, display, 0 }, { "mode", modestring, modecmd, 0 }, + { "telnet", openhelp, tn, 0 }, { "open", openhelp, tn, 0 }, { "quit", quithelp, quit, 0 }, { "send", sendhelp, sendcmd, 0 }, @@ -2750,8 +2749,8 @@ static Command cmdtab[] = { #endif { "environ", envhelp, env_cmd, 0 }, { "?", helphelp, help, 0 }, -#if defined(SKEY) - { "skey", skeyhelp, skey_calc, 0 }, +#if defined(OPIE) + { "opie", opiehelp, opie_calc, 0 }, #endif { 0, 0, 0, 0 } }; @@ -2901,6 +2900,7 @@ help(argc, argv) printf("%-*s\t%s\n", HELPINDENT, c->name, c->help); } + return 0; } else while (--argc > 0) { register char *arg; @@ -2913,7 +2913,7 @@ help(argc, argv) else printf("%s\n", c->help); } - return(0); + return 0; } static char *rcname = 0; @@ -3186,7 +3186,7 @@ sourceroute(ai, arg, cpp, lenp, protop, optp) cp2 = 0; hints.ai_flags = AI_NUMERICHOST; - error = getaddrinfo(cp, NULL, &hints, &res); + error = getaddrinfo(cp, NULL, &hints, &res); if (error == EAI_NODATA) { hints.ai_flags = 0; error = getaddrinfo(cp, NULL, &hints, &res); @@ -3260,6 +3260,3 @@ sourceroute(ai, arg, cpp, lenp, protop, optp) freeaddrinfo(res); return 1; } - - - diff --git a/contrib/telnet/telnet/main.c b/contrib/telnet/telnet/main.c index b3b1e55..2f74f40 100644 --- a/contrib/telnet/telnet/main.c +++ b/contrib/telnet/telnet/main.c @@ -46,6 +46,8 @@ static const char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95"; #include <sys/types.h> #include <sys/socket.h> #include <stdlib.h> +#include <string.h> +#include <unistd.h> #include "ring.h" #include "externs.h" @@ -112,13 +114,8 @@ usage() "\n\t[-e char] [-l user] [-n tracefile] ", #endif #if defined(TN3270) && defined(unix) -# ifdef AUTHENTICATION - "[-noasynch] [-noasynctty]\n\t" - "[-noasyncnet] [-r] [-s src_addr] [-t transcom] ", -# else "[-noasynch] [-noasynctty] [-noasyncnet] [-r]\n\t" "[-s src_addr] [-t transcom] ", -# endif #else "[-r] [-s src_addr] [-u] ", #endif @@ -143,10 +140,8 @@ main(argc, argv) int argc; char *argv[]; { - extern char *optarg; - extern int optind; int ch; - char *user, *strrchr(); + char *user; char *src_addr = NULL; #ifdef FORWARD extern int forward_flags; @@ -167,7 +162,11 @@ main(argc, argv) user = NULL; rlogin = (strncmp(prompt, "rlog", 4) == 0) ? '~' : _POSIX_VDISABLE; +#ifdef AUTHENTICATION autologin = 1; +#else + autologin = -1; +#endif #if defined(ENCRYPTION) encrypt_auto(1); @@ -232,7 +231,11 @@ main(argc, argv) #endif break; case 'a': +#ifdef AUTHENTICATION /* It's the default now, so ignore */ +#else + autologin = 1; +#endif break; case 'c': skiprc = 1; @@ -288,6 +291,11 @@ main(argc, argv) #endif break; case 'l': +#ifdef AUTHENTICATION + /* This is the default now, so ignore it */ +#else + autologin = 1; +#endif user = optarg; break; case 'n': @@ -326,12 +334,22 @@ main(argc, argv) family = AF_UNIX; break; case 'x': +#ifdef ENCRYPTION /* This is the default now, so ignore it */ +#else + fprintf(stderr, + "%s: Warning: -x ignored, no ENCRYPT support.\n", + prompt); +#endif /* ENCRYPTION */ break; case 'y': #ifdef ENCRYPTION encrypt_auto(0); decrypt_auto(0); +#else + fprintf(stderr, + "%s: Warning: -y ignored, no ENCRYPT support.\n", + prompt); #endif /* ENCRYPTION */ break; #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) @@ -350,6 +368,8 @@ main(argc, argv) /* NOTREACHED */ } } + if (autologin == -1) + autologin = (rlogin == _POSIX_VDISABLE) ? 0 : 1; argc -= optind; argv += optind; diff --git a/contrib/telnet/telnet/ring.c b/contrib/telnet/telnet/ring.c index 268a418..065888b 100644 --- a/contrib/telnet/telnet/ring.c +++ b/contrib/telnet/telnet/ring.c @@ -51,8 +51,8 @@ static const char rcsid[] = * */ -#include <stdio.h> #include <errno.h> +#include <stdio.h> #include <string.h> #ifdef size_t @@ -105,9 +105,9 @@ static u_long ring_clock = 0; /* Buffer state transition routines */ - int - ring_init(ring, buffer, count) -Ring *ring; + int +ring_init(ring, buffer, count) + Ring *ring; unsigned char *buffer; int count; { @@ -302,7 +302,7 @@ ring_supply_data(ring, buffer, count) while (count) { i = MIN(count, ring_empty_consecutive(ring)); - memmove(ring->supply, buffer, i); + memcpy(ring->supply, buffer, i); ring_supplied(ring, i); count -= i; buffer += i; @@ -324,7 +324,7 @@ ring_consume_data(ring, buffer, count) while (count) { i = MIN(count, ring_full_consecutive(ring)); - memmove(buffer, ring->consume, i); + memcpy(buffer, ring->consume, i); ring_consumed(ring, i); count -= i; buffer += i; diff --git a/contrib/telnet/telnet/ring.h b/contrib/telnet/telnet/ring.h index 2a36781..dc5cbc4 100644 --- a/contrib/telnet/telnet/ring.h +++ b/contrib/telnet/telnet/ring.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)ring.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ #if defined(P) @@ -101,5 +102,5 @@ extern void #endif /* ENCRYPTION */ extern void - ring_clear_mark(), - ring_mark(); + ring_clear_mark P((Ring *)), + ring_mark P((Ring *)); diff --git a/contrib/telnet/telnet/sys_bsd.c b/contrib/telnet/telnet/sys_bsd.c index 1d63c22..ac93ea8 100644 --- a/contrib/telnet/telnet/sys_bsd.c +++ b/contrib/telnet/telnet/sys_bsd.c @@ -334,7 +334,7 @@ TerminalDefaultChars() nttyb.sg_kill = ottyb.sg_kill; nttyb.sg_erase = ottyb.sg_erase; #else /* USE_TERMIO */ - memmove(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc)); + memcpy(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc)); # ifndef VDISCARD termFlushChar = CONTROL('O'); # endif @@ -633,7 +633,7 @@ TerminalNewMode(f) (void) signal(SIGINT, intr); #endif #ifdef SIGQUIT - (void) signal(SIGQUIT, intr2); + (void) signal(SIGQUIT, intr2); #endif #ifdef SIGTSTP (void) signal(SIGTSTP, susp); @@ -1160,7 +1160,7 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll) int i; i = recv(net, netiring.supply + c, canread - c, MSG_OOB); if (i == c && - memcmp(netiring.supply, netiring.supply + c, i) == 0) { + memcmp(netiring.supply, netiring.supply + c, i) == 0) { bogus_oob = 1; first = 0; } else if (i < 0) { diff --git a/contrib/telnet/telnet/telnet.1 b/contrib/telnet/telnet/telnet.1 index 52d291e..2bbc0b7 100644 --- a/contrib/telnet/telnet/telnet.1 +++ b/contrib/telnet/telnet/telnet.1 @@ -37,12 +37,12 @@ .Os .Sh NAME .Nm telnet -.Nd user interface to the +.Nd user interface to the .Tn TELNET protocol .Sh SYNOPSIS .Nm -.Op Fl 468EFKLNcdfruy +.Op Fl 468EFKLNacdfruxy .Op Fl S Ar tos .Op Fl X Ar authtype .Op Fl e Ar escapechar @@ -58,7 +58,7 @@ protocol The .Nm command -is used to communicate with another host using the +is used to communicate with another host using the .Tn TELNET protocol. If @@ -114,7 +114,7 @@ or, on systems that support it, a symbolic TOS name found in the .Pa /etc/iptos file. -.It Fl X Ar atype +.It Fl X Ar atype Disables the .Ar atype type of authentication. @@ -142,7 +142,7 @@ Sets the initial value of the .Ic debug toggle to .Dv TRUE . -.It Fl e Ar escapechar +.It Fl e Ar escapechar Sets the initial .Nm escape character to @@ -165,7 +165,7 @@ realm .Ar realm instead of the remote host's realm, as determined by .Xr krb_realmofhost 3 . -.It Fl l Ar user +.It Fl l Ar user When connecting to the remote system, if the remote system understands the .Ev ENVIRON @@ -179,7 +179,7 @@ option. This option may also be used with the .Ic open command. -.It Fl n Ar tracefile +.It Fl n Ar tracefile Opens .Ar tracefile for recording trace information. @@ -252,7 +252,7 @@ either \*(Lqcharacter at a time\*(Rq or \*(Lqold line by line\*(Rq depending on what the remote system supports. .Pp -When +When .Dv LINEMODE is enabled, character processing is done on the local system, under the control of the remote system. When input @@ -271,7 +271,7 @@ to turn off and on the local echo (this would mostly be used to enter passwords without the password being echoed). .Pp -If the +If the .Dv LINEMODE option is enabled, or if the .Ic localchars @@ -286,7 +286,7 @@ and characters are trapped locally, and sent as .Tn TELNET protocol sequences to the remote side. -If +If .Dv LINEMODE has ever been enabled, then the user's .Ic susp @@ -297,9 +297,9 @@ are also sent as protocol sequences, and .Ic quit -is sent as a +is sent as a .Dv TELNET ABORT -instead of +instead of .Dv BREAK . There are options (see .Ic toggle @@ -340,7 +340,7 @@ and commands). .Pp .Bl -tag -width "mode type" -.It Ic auth Ar argument ... +.It Ic auth Ar argument ... The auth command manipulates the information sent through the .Dv TELNET AUTHENTICATE option. Valid arguments for the @@ -365,7 +365,7 @@ authentication. Close a .Tn TELNET session and return to command mode. -.It Ic display Ar argument ... +.It Ic display Ar argument ... Displays all, or some, of the .Ic set and @@ -460,7 +460,7 @@ Valid arguments for the .Ic environ command are: .Bl -tag -width Fl -.It Ic define Ar variable value +.It Ic define Ar variable value Define the variable .Ar variable to have a value of @@ -470,15 +470,15 @@ The .Ar value may be enclosed in single or double quotes so that tabs and spaces may be included. -.It Ic undefine Ar variable +.It Ic undefine Ar variable Remove .Ar variable from the list of environment variables. -.It Ic export Ar variable +.It Ic export Ar variable Mark the variable .Ar variable to be exported to the remote side. -.It Ic unexport Ar variable +.It Ic unexport Ar variable Mark the variable .Ar variable to not be exported unless @@ -512,7 +512,7 @@ If the remote side also supports the concept of suspending a user's session for later reattachment, the logout argument indicates that you should terminate the session immediately. -.It Ic mode Ar type +.It Ic mode Ar type .Ar Type is one of several options, depending on the state of the .Tn TELNET @@ -533,40 +533,40 @@ Enable the option, or, if the remote side does not understand the .Dv LINEMODE option, then attempt to enter \*(Lqold-line-by-line\*(Rq mode. -.It Ic isig Pq Ic \-isig -Attempt to enable (disable) the +.It Ic isig Pq Ic \-isig +Attempt to enable (disable) the .Dv TRAPSIG -mode of the +mode of the .Dv LINEMODE option. -This requires that the +This requires that the .Dv LINEMODE option be enabled. -.It Ic edit Pq Ic \-edit -Attempt to enable (disable) the +.It Ic edit Pq Ic \-edit +Attempt to enable (disable) the .Dv EDIT -mode of the +mode of the .Dv LINEMODE option. -This requires that the +This requires that the .Dv LINEMODE option be enabled. -.It Ic softtabs Pq Ic \-softtabs -Attempt to enable (disable) the +.It Ic softtabs Pq Ic \-softtabs +Attempt to enable (disable) the .Dv SOFT_TAB -mode of the +mode of the .Dv LINEMODE option. -This requires that the +This requires that the .Dv LINEMODE option be enabled. -.It Ic litecho Pq Ic \-litecho -Attempt to enable (disable) the +.It Ic litecho Pq Ic \-litecho +Attempt to enable (disable) the .Dv LIT_ECHO -mode of the +mode of the .Dv LINEMODE option. -This requires that the +This requires that the .Dv LINEMODE option be enabled. .It Ic ?\& @@ -623,7 +623,7 @@ Close any open session and exit .Nm . An end of file (in command mode) will also close a session and exit. -.It Ic send Ar arguments +.It Ic send Ar arguments Sends one or more special character sequences to the remote host. The following are the arguments which may be specified (more than one argument may be specified at a time): @@ -745,8 +745,8 @@ Prints out help information for the .Ic send command. .El -.It Ic set Ar argument value -.It Ic unset Ar argument value +.It Ic set Ar argument value +.It Ic unset Ar argument value The .Ic set command will set any one of a number of @@ -1050,20 +1050,20 @@ Displays the legal .Pq Ic unset commands. .El -.It Ic skey Ar sequence challenge +.It Ic opie Ar sequence challenge The -.Ic skey -command computes a response to the S/Key challenge. -.It Ic slc Ar state +.Ic opie +command computes a response to the OPIE challenge. +.It Ic slc Ar state The .Ic slc command (Set Local Characters) is used to set or change the state of the special -characters when the +characters when the .Dv TELNET LINEMODE option has been enabled. Special characters are characters that get -mapped to +mapped to .Tn TELNET commands sequences (like .Ic ip @@ -1089,7 +1089,7 @@ was started. .It Ic import Switch to the remote defaults for the special characters. The remote default characters are those of the remote system -at the time when the +at the time when the .Tn TELNET connection was established. .It Ic ?\& @@ -1102,7 +1102,7 @@ Show the current status of .Nm . This includes the peer one is connected to, as well as the current mode. -.It Ic toggle Ar arguments ... +.It Ic toggle Ar arguments ... Toggle (between .Dv TRUE and @@ -1365,17 +1365,17 @@ Suspend .Nm . This command only works when the user is using the .Xr csh 1 . -.It Ic \&! Op Ar command +.It Ic \&! Op Ar command Execute a single command in a subshell on the local system. If .Ar command is omitted, then an interactive subshell is invoked. -.It Ic ?\& Op Ar command +.It Ic ?\& Op Ar command Get help. With no arguments, .Nm prints a help summary. -If +If .Ar command is specified, .Nm @@ -1413,11 +1413,10 @@ command appeared in .Pp IPv6 support was added by WIDE/KAME project. .Sh NOTES -.Pp On some remote systems, echo has to be turned off manually when in \*(Lqold line by line\*(Rq mode. .Pp -In \*(Lqold line by line\*(Rq mode or +In \*(Lqold line by line\*(Rq mode or .Dv LINEMODE the terminal's .Ic eof diff --git a/contrib/telnet/telnet/telnet.c b/contrib/telnet/telnet/telnet.c index 68555b7..2135b24 100644 --- a/contrib/telnet/telnet/telnet.c +++ b/contrib/telnet/telnet/telnet.c @@ -53,9 +53,7 @@ static const char rcsid[] = #endif /* defined(unix) */ #include <arpa/telnet.h> - #include <ctype.h> - #include <stdlib.h> #include <unistd.h> @@ -126,7 +124,9 @@ int clienteof = 0; char *prompt = 0; +#ifdef ENCRYPTION char *line; /* hack around breakage in sra.c :-( !! */ +#endif cc_t escape; cc_t rlogin; @@ -643,7 +643,7 @@ mklist(buf, name) register char c, *cp, **argvp, *cp2, **argv, **avt; if (name) { - if ((int)strlen(name) > 40) { + if (strlen(name) > 40) { name = 0; unknown[0] = name_unknown; } else { @@ -802,7 +802,7 @@ gettermname() (setupterm(tname, 1, &err) == 0)) { tnamep = mklist(termbuf, tname); } else { - if (tname && ((int)strlen(tname) <= 40)) { + if (tname && (strlen(tname) <= 40)) { unknown[0] = tname; upcase(tname); } else @@ -2452,7 +2452,7 @@ netclear() next = nextitem(next); } while (wewant(next) && (nfrontp > next)); length = next-thisitem; - memmove(good, thisitem, length); + memcpy(good, thisitem, length); good += length; thisitem = next; } else { diff --git a/contrib/telnet/telnet/utilities.c b/contrib/telnet/telnet/utilities.c index fd9f5c9..2ee709a 100644 --- a/contrib/telnet/telnet/utilities.c +++ b/contrib/telnet/telnet/utilities.c @@ -47,9 +47,8 @@ static const char rcsid[] = #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> -#include <unistd.h> - #include <ctype.h> +#include <unistd.h> #include "general.h" |