diff --git a/usr.bin/telnet/Makefile b/usr.bin/telnet/Makefile index 8ffd9d3d5041..8e1adfc0de3f 100644 --- a/usr.bin/telnet/Makefile +++ b/usr.bin/telnet/Makefile @@ -1,48 +1,12 @@ -# -# Copyright (c) 1990 The Regents of the University of California. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. All advertising materials mentioning features or use of this software -# must display the following acknowledgement: -# This product includes software developed by the University of -# California, Berkeley and its contributors. -# 4. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ -# -PROG= telnet +PROG= telnet -SRCS= authenc.c commands.c main.c network.c ring.c sys_bsd.c telnet.c \ - terminal.c tn3270.c utilities.c +CFLAGS+= -DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK -DOPIE \ + -I${.CURDIR}/../../lib -CFLAGS+=-DKLUDGELINEMODE -DUSE_TERMIO #-DAUTHENTICATION -DENCRYPTION -CFLAGS+=-DENV_HACK -CFLAGS+=-DSKEY -CFLAGS+=-I${.CURDIR}/../../lib +SRCS= commands.c main.c network.c ring.c sys_bsd.c \ + telnet.c terminal.c tn3270.c utilities.c .if exists(${.OBJDIR}/../../lib/libtelnet) LIBTELNET= ${.OBJDIR}/../../lib/libtelnet/libtelnet.a @@ -50,27 +14,18 @@ LIBTELNET= ${.OBJDIR}/../../lib/libtelnet/libtelnet.a LIBTELNET= ${.CURDIR}/../../lib/libtelnet/libtelnet.a .endif -DPADD= ${LIBTERMCAP} ${LIBTELNET} -LDADD= -ltermcap ${LIBTELNET} +DPADD= ${LIBTERMCAP} ${LIBTELNET} +LDADD= -ltermcap ${LIBTELNET} .if !defined(RELEASE_CRUNCH) -CFLAGS+=-DINET6 -CFLAGS+=-DIPSEC -DPADD+= ${LIBIPSEC} -LDADD+= -lipsec +CFLAGS+= -DINET6 -DIPSEC +DPADD+= ${LIBIPSEC} +LDADD+= -lipsec .else -.PATH: ${.CURDIR}/../../lib/libtelnet +.PATH: ${.CURDIR}/../../lib/libtelnet # XXX This was copied from lib/libtelnet/Makefile. -SRCS+= genget.c getent.c misc.c -CFLAGS+= -DHAS_CGETENT +SRCS+= genget.c getent.c misc.c +CFLAGS+= -DHAS_CGETENT .endif -# These are the sources that have encryption stuff in them. -CRYPT_SRC= authenc.c commands.c externs.h main.c network.c -CRYPT_SRC+= ring.c ring.h telnet.c terminal.c utilities.c Makefile -NOCRYPT_DIR=${.CURDIR}/Nocrypt - .include - -nocrypt: - @echo "Encryption code already removed." diff --git a/usr.bin/telnet/authenc.c b/usr.bin/telnet/authenc.c deleted file mode 100644 index 941a2026338d..000000000000 --- a/usr.bin/telnet/authenc.c +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static char sccsid[] = "@(#)authenc.c 8.1 (Berkeley) 6/6/93"; -#endif /* not lint */ - -#if defined(AUTHENTICATION) -#include -#include -#include -#include - -#include "general.h" -#include "ring.h" -#include "externs.h" -#include "defines.h" -#include "types.h" - - int -net_write(str, len) - unsigned char *str; - int len; -{ - if (NETROOM() > len) { - ring_supply_data(&netoring, str, len); - if (str[0] == IAC && str[1] == SE) - printsub('>', &str[2], len-2); - return(len); - } - return(0); -} - - void -net_encrypt() -{ -} - - int -telnet_spin() -{ - return(-1); -} - - char * -telnet_getenv(val) - char *val; -{ - return((char *)env_getvalue((unsigned char *)val)); -} - - char * -telnet_gets(prompt, result, length, echo) - char *prompt; - char *result; - int length; - int echo; -{ - extern char *getpass(); - extern int globalmode; - int om = globalmode; - char *res; - - TerminalNewMode(-1); - if (echo) { - printf("%s", prompt); - res = fgets(result, length, stdin); - } else if (res = getpass(prompt)) { - strncpy(result, res, length); - res = result; - } - TerminalNewMode(om); - return(res); -} -#endif /* defined(AUTHENTICATION) */ diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c index fb3139cd3227..468d70858158 100644 --- a/usr.bin/telnet/commands.c +++ b/usr.bin/telnet/commands.c @@ -34,7 +34,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)commands.c 8.2 (Berkeley) 12/15/93"; +static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95"; #endif /* not lint */ #if defined(unix) @@ -60,6 +60,8 @@ static char sccsid[] = "@(#)commands.c 8.2 (Berkeley) 12/15/93"; #include #include #include +#include +#include #include #include @@ -98,9 +100,11 @@ extern int isprefix(); extern char **genget(); extern int Ambiguous(); +static int help(int argc, char *argv[]); +static int call(); +static void cmdrc(char *m1, char *m2); static int switch_af(struct addrinfo **aip); - -static call(); +int quit(void); typedef struct { char *name; /* command name */ @@ -114,11 +118,11 @@ static char saveline[256]; static int margc; static char *margv[20]; -#if defined(SKEY) +#if defined(OPIE) #include -#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; { @@ -131,7 +135,7 @@ skey_calc(argc, argv) switch(fork()) { case 0: - execv(PATH_SKEY, argv); + execv(PATH_OPIEKEY, argv); exit (1); case -1: perror("fork"); @@ -159,7 +163,7 @@ makeargv() margc++; cp++; } - while (c = *cp) { + while ((c = *cp)) { register int inquote = 0; while (isspace(c)) c = *++cp; @@ -202,7 +206,7 @@ makeargv() * Todo: 1. Could take random integers (12, 0x12, 012, 0b1). */ - static + static int special(s) register char *s; { @@ -331,7 +335,6 @@ sendcmd(argc, argv) { int count; /* how many bytes we are going to need to send */ int i; - int question = 0; /* was at least one argument a question */ struct sendlist *s; /* pointer to current command */ int success = 0; int needconnect = 0; @@ -654,9 +657,6 @@ togxbinary(val) static int togglehelp P((void)); -#if defined(AUTHENTICATION) -extern int auth_togdebug P((int)); -#endif struct togglelist { char *name; /* name of toggle */ @@ -677,18 +677,6 @@ static struct togglelist Togglelist[] = { 0, &autosynch, "send interrupt characters in urgent mode" }, -#if defined(AUTHENTICATION) - { "autologin", - "automatic sending of login and/or authentication info", - 0, - &autologin, - "send login name and/or authentication information" }, - { "authdebug", - "Toggle authentication debugging", - auth_togdebug, - 0, - "print authentication debugging information" }, -#endif { "skiprc", "don't read ~/.telnetrc file", 0, @@ -1099,6 +1087,7 @@ dokludgemode() send_wont(TELOPT_LINEMODE, 1); send_dont(TELOPT_SGA, 1); send_dont(TELOPT_ECHO, 1); + return 1; } #endif @@ -1149,7 +1138,7 @@ dolmmode(bit, on) } int -setmode(bit) +setmod(bit) { return dolmmode(bit, 1); } @@ -1181,17 +1170,17 @@ static struct modelist ModeList[] = { #endif { "", "", 0 }, { "", "These require the LINEMODE option to be enabled", 0 }, - { "isig", "Enable signal trapping", setmode, 1, MODE_TRAPSIG }, - { "+isig", 0, setmode, 1, MODE_TRAPSIG }, + { "isig", "Enable signal trapping", setmod, 1, MODE_TRAPSIG }, + { "+isig", 0, setmod, 1, MODE_TRAPSIG }, { "-isig", "Disable signal trapping", clearmode, 1, MODE_TRAPSIG }, - { "edit", "Enable character editing", setmode, 1, MODE_EDIT }, - { "+edit", 0, setmode, 1, MODE_EDIT }, + { "edit", "Enable character editing", setmod, 1, MODE_EDIT }, + { "+edit", 0, setmod, 1, MODE_EDIT }, { "-edit", "Disable character editing", clearmode, 1, MODE_EDIT }, - { "softtabs", "Enable tab expansion", setmode, 1, MODE_SOFT_TAB }, - { "+softtabs", 0, setmode, 1, MODE_SOFT_TAB }, + { "softtabs", "Enable tab expansion", setmod, 1, MODE_SOFT_TAB }, + { "+softtabs", 0, setmod, 1, MODE_SOFT_TAB }, { "-softtabs", "Disable character editing", clearmode, 1, MODE_SOFT_TAB }, - { "litecho", "Enable literal character echo", setmode, 1, MODE_LIT_ECHO }, - { "+litecho", 0, setmode, 1, MODE_LIT_ECHO }, + { "litecho", "Enable literal character echo", setmod, 1, MODE_LIT_ECHO }, + { "+litecho", 0, setmod, 1, MODE_LIT_ECHO }, { "-litecho", "Disable literal character echo", clearmode, 1, MODE_LIT_ECHO }, { "help", 0, modehelp, 0 }, #ifdef KLUDGELINEMODE @@ -1370,7 +1359,7 @@ suspend() (void) kill(0, SIGTSTP); /* * If we didn't get the window size before the SUSPEND, but we - * can get them now (???), then send the NAWS to make sure that + * can get them now (?), then send the NAWS to make sure that * we are set up for the right window size. */ if (TerminalWindowSize(&newrows, &newcols) && connected && @@ -1410,12 +1399,11 @@ shell(argc, argv) * Fire up the shell in the child. */ register char *shellp, *shellname; - extern char *rindex(); shellp = getenv("SHELL"); if (shellp == NULL) shellp = "/bin/sh"; - if ((shellname = rindex(shellp, '/')) == 0) + if ((shellname = strrchr(shellp, '/')) == 0) shellname = shellp; else shellname++; @@ -1442,7 +1430,7 @@ extern int shell(); #endif /* !defined(TN3270) */ /*VARARGS*/ - static + static int bye(argc, argv) int argc; /* Number of arguments */ char *argv[]; /* arguments */ @@ -1455,9 +1443,6 @@ bye(argc, argv) (void) NetClose(net); connected = 0; resettermname = 1; -#if defined(AUTHENTICATION) - auth_encrypt_connect(connected); -#endif /* defined(AUTHENTICATION) */ /* reset options */ tninit(); #if defined(TN3270) @@ -1472,6 +1457,7 @@ bye(argc, argv) } /*VARARGS*/ + int quit() { (void) call(bye, "bye", "fromquit", 0); @@ -1537,7 +1523,7 @@ getslc(name) genget(name, (char **) SlcList, sizeof(struct slclist)); } - static + static int slccmd(argc, argv) int argc; char *argv[]; @@ -1551,14 +1537,14 @@ slccmd(argc, argv) } c = getslc(argv[1]); if (c == 0) { - fprintf(stderr, "'%s': unknown argument ('slc ?' for help).\n", + fprintf(stderr, "'%s': unknown argument ('slc ?' for help).\n", argv[1]); - return 0; + return 0; } if (Ambiguous(c)) { - fprintf(stderr, "'%s': ambiguous argument ('slc ?' for help).\n", + fprintf(stderr, "'%s': ambiguous argument ('slc ?' for help).\n", argv[1]); - return 0; + return 0; } (*c->handler)(c->arg); slcstate(); @@ -1634,6 +1620,7 @@ getenvcmd(name) genget(name, (char **) EnvList, sizeof(struct envlist)); } + int env_cmd(argc, argv) int argc; char *argv[]; @@ -1647,14 +1634,14 @@ env_cmd(argc, argv) } c = getenvcmd(argv[1]); if (c == 0) { - fprintf(stderr, "'%s': unknown argument ('environ ?' for help).\n", + fprintf(stderr, "'%s': unknown argument ('environ ?' for help).\n", argv[1]); - return 0; + return 0; } if (Ambiguous(c)) { - fprintf(stderr, "'%s': ambiguous argument ('environ ?' for help).\n", + fprintf(stderr, "'%s': ambiguous argument ('environ ?' for help).\n", argv[1]); - return 0; + return 0; } if (c->narg + 2 != argc) { fprintf(stderr, @@ -1697,10 +1684,9 @@ env_init() extern char **environ; register char **epp, *cp; register struct env_lst *ep; - extern char *index(); for (epp = environ; *epp; epp++) { - if (cp = index(*epp, '=')) { + if ((cp = strchr(*epp, '='))) { *cp = '\0'; ep = env_define((unsigned char *)*epp, (unsigned char *)cp+1); @@ -1715,9 +1701,9 @@ env_init() */ if ((ep = env_find("DISPLAY")) && ((*ep->value == ':') - || (strncmp((char *)ep->value, "unix:", 5) == 0))) { + || (strncmp((char *)ep->value, "unix:", 5) == 0))) { char hbuf[256+1]; - char *cp2 = index((char *)ep->value, ':'); + char *cp2 = strchr((char *)ep->value, ':'); gethostname(hbuf, 256); hbuf[256] = '\0'; @@ -1745,7 +1731,7 @@ env_define(var, value) { register struct env_lst *ep; - if (ep = env_find(var)) { + if ((ep = env_find(var))) { if (ep->var) free(ep->var); if (ep->value) @@ -1771,7 +1757,7 @@ env_undefine(var) { register struct env_lst *ep; - if (ep = env_find(var)) { + if ((ep = env_find(var))) { ep->prev->next = ep->next; if (ep->next) ep->next->prev = ep->prev; @@ -1789,7 +1775,7 @@ env_export(var) { register struct env_lst *ep; - if (ep = env_find(var)) + if ((ep = env_find(var))) ep->export = 1; } @@ -1799,7 +1785,7 @@ env_unexport(var) { register struct env_lst *ep; - if (ep = env_find(var)) + if ((ep = env_find(var))) ep->export = 0; } @@ -1809,7 +1795,7 @@ env_send(var) { register struct env_lst *ep; - if (my_state_is_wont(TELOPT_NEW_ENVIRON) + if (my_state_is_wont(TELOPT_NEW_ENVIRON) #ifdef OLD_ENVIRON && my_state_is_wont(TELOPT_OLD_ENVIRON) #endif @@ -1849,10 +1835,10 @@ env_default(init, welldefined) if (init) { nep = &envlisthead; - return; + return(NULL); } if (nep) { - while (nep = nep->next) { + while ((nep = nep->next)) { if (nep->export && (nep->welldefined == welldefined)) return(nep->var); } @@ -1866,7 +1852,7 @@ env_getvalue(var) { register struct env_lst *ep; - if (ep = env_find(var)) + if ((ep = env_find(var))) return(ep->value); return(NULL); } @@ -1909,81 +1895,6 @@ unknown: } #endif -#if defined(AUTHENTICATION) -/* - * The AUTHENTICATE command. - */ - -struct authlist { - char *name; - char *help; - int (*handler)(); - int narg; -}; - -extern int - auth_enable P((int)), - auth_disable P((int)), - auth_status P((void)); -static int - auth_help P((void)); - -struct authlist AuthList[] = { - { "status", "Display current status of authentication information", - auth_status, 0 }, - { "disable", "Disable an authentication type ('auth disable ?' for more)", - auth_disable, 1 }, - { "enable", "Enable an authentication type ('auth enable ?' for more)", - auth_enable, 1 }, - { "help", 0, auth_help, 0 }, - { "?", "Print help information", auth_help, 0 }, - { 0 }, -}; - - static int -auth_help() -{ - struct authlist *c; - - for (c = AuthList; c->name; c++) { - if (c->help) { - if (*c->help) - printf("%-15s %s\n", c->name, c->help); - else - printf("\n"); - } - } - return 0; -} - -auth_cmd(argc, argv) - int argc; - char *argv[]; -{ - struct authlist *c; - - c = (struct authlist *) - genget(argv[1], (char **) AuthList, sizeof(struct authlist)); - if (c == 0) { - fprintf(stderr, "'%s': unknown argument ('auth ?' for help).\n", - argv[1]); - return 0; - } - if (Ambiguous(c)) { - fprintf(stderr, "'%s': ambiguous argument ('auth ?' for help).\n", - argv[1]); - return 0; - } - if (c->narg + 2 != argc) { - fprintf(stderr, - "Need %s%d argument%s to 'auth %s' command. 'auth ?' for help.\n", - c->narg < argc + 2 ? "only " : "", - c->narg, c->narg == 1 ? "" : "s", c->name); - return 0; - } - return((*c->handler)(argv[2], argv[3])); -} -#endif #if defined(unix) && defined(TN3270) @@ -2023,7 +1934,7 @@ filestuff(fd) * Print status about the connection. */ /*ARGSUSED*/ - static + static int status(argc, argv) int argc; char *argv[]; @@ -2093,6 +2004,7 @@ status(argc, argv) /* * Function that gets called when SIGINFO is received. */ + void ayt_status() { (void) call(status, "status", "notmuch", 0); @@ -2181,12 +2093,12 @@ switch_af(aip) } #endif -int + int tn(argc, argv) int argc; char *argv[]; { - char *srp = 0, *strrchr(); + char *srp = 0; int proto, opt; int sourceroute(), srlen; int srcroute = 0, result; @@ -2211,7 +2123,7 @@ tn(argc, argv) cmd = *argv; --argc; ++argv; while (argc) { - if (isprefix(*argv, "help") || isprefix(*argv, "?")) + if (strcmp(*argv, "help") == 0 || isprefix(*argv, "?")) goto usage; if (strcmp(*argv, "-l") == 0) { --argc; ++argv; @@ -2245,7 +2157,7 @@ tn(argc, argv) continue; } usage: - printf("usage: telnet [-l user] [-a] [-s src_addr] host-name [port]\n"); + printf("usage: %s [-l user] [-a] [-s src_addr] host-name [port]\n", cmd); setuid(getuid()); return 0; } @@ -2454,8 +2366,8 @@ tn(argc, argv) struct addrinfo *next; next = res->ai_next; - /* If already an af failed, only try same af. */ - if (af_error != 0) + /* If already an af failed, only try same af. */ + if (af_error != 0) while (next != NULL && next->ai_family != res->ai_family) next = next->ai_next; warn("connect to address %s", sockaddr_ntop(res->ai_addr)); @@ -2469,9 +2381,6 @@ tn(argc, argv) goto fail; } connected++; -#if defined(AUTHENTICATION) - auth_encrypt_connect(connected); -#endif /* defined(AUTHENTICATION) */ } while (connected == 0); freeaddrinfo(res0); if (src_res0 != NULL) @@ -2483,8 +2392,8 @@ tn(argc, argv) user = getenv("USER"); if (user == NULL || - (pw = getpwnam(user)) && pw->pw_uid != getuid()) { - if (pw = getpwuid(getuid())) + ((pw = getpwnam(user)) && pw->pw_uid != getuid())) { + if ((pw = getpwuid(getuid()))) user = pw->pw_name; else user = NULL; @@ -2526,21 +2435,16 @@ static char #if defined(TN3270) && defined(unix) transcomhelp[] = "specify Unix command for transparent mode pipe", #endif /* defined(TN3270) && defined(unix) */ -#if defined(AUTHENTICATION) - authhelp[] = "turn on (off) authentication ('auth ?' for more)", -#endif #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)", modestring[] = "try to enter line or character mode ('mode ?' for more)"; -static int help(); - static Command cmdtab[] = { { "close", closehelp, bye, 1 }, { "logout", logouthelp, logout, 1 }, @@ -2558,9 +2462,6 @@ static Command cmdtab[] = { #if defined(TN3270) && defined(unix) { "transcom", transcomhelp, settranscom, 0 }, #endif /* defined(TN3270) && defined(unix) */ -#if defined(AUTHENTICATION) - { "auth", authhelp, auth_cmd, 0 }, -#endif #if defined(unix) { "z", zhelp, suspend, 0 }, #endif /* defined(unix) */ @@ -2571,10 +2472,10 @@ 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, 0 } }; static char crmodhelp[] = "deprecated command -- use 'toggle crmod' instead"; @@ -2584,7 +2485,7 @@ static Command cmdtab2[] = { { "help", 0, help, 0 }, { "escape", escapehelp, setescape, 0 }, { "crmod", crmodhelp, togcrmod, 0 }, - 0 + { 0, 0, 0, 0 } }; @@ -2593,7 +2494,7 @@ static Command cmdtab2[] = { */ /*VARARGS1*/ - static + static int call(va_alist) va_dcl { @@ -2619,7 +2520,7 @@ getcmd(name) { Command *cm; - if (cm = (Command *) genget(name, (char **) cmdtab, sizeof(Command))) + if ((cm = (Command *) genget(name, (char **) cmdtab, sizeof(Command)))) return cm; return (Command *) genget(name, (char **) cmdtab2, sizeof(Command)); } @@ -2654,7 +2555,7 @@ command(top, tbuf, cnt) goto getline; *cp = '\0'; if (rlogin == _POSIX_VDISABLE) - printf("%s\n", line); + printf("%s\n", line); } else { getline: if (rlogin != _POSIX_VDISABLE) @@ -2708,7 +2609,7 @@ command(top, tbuf, cnt) /* * Help command. */ - static + static int help(argc, argv) int argc; char *argv[]; @@ -2724,7 +2625,7 @@ help(argc, argv) } return 0; } - while (--argc > 0) { + else while (--argc > 0) { register char *arg; arg = *++argv; c = getcmd(arg); @@ -2741,6 +2642,7 @@ help(argc, argv) static char *rcname = 0; static char rcbuf[128]; + void cmdrc(m1, m2) char *m1, *m2; { @@ -2986,7 +2888,7 @@ sourceroute(ai, arg, cpp, lenp, protop, optp) #endif c == ':') cp2 = 0; - else for (cp2 = cp; c = *cp2; cp2++) { + else for (cp2 = cp; (c = *cp2); cp2++) { if (c == ',') { *cp2++ = '\0'; if (*cp2 == '@') diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h index 0ec33132ddec..afa3fdc0510c 100644 --- a/usr.bin/telnet/externs.h +++ b/usr.bin/telnet/externs.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)externs.h 8.2 (Berkeley) 12/15/93 + * @(#)externs.h 8.3 (Berkeley) 5/30/95 * $FreeBSD$ */ @@ -84,8 +84,9 @@ typedef unsigned char cc_t; #ifndef NO_STRING_H #include -#endif +#else #include +#endif #if defined(IPSEC) #include @@ -128,12 +129,12 @@ extern int flushout, /* flush output */ connected, /* Are we connected to the other side? */ globalmode, /* Mode tty should be in */ - In3270, /* Are we in 3270 mode? */ + In3270, /* Are we in 3270 mode? */ telnetport, /* Are we connected to the telnet port? */ localflow, /* Flow control handled locally */ restartany, /* If flow control, restart output on any character */ localchars, /* we recognize interrupt/quit */ - donelclchars, /* the user has set "localchars" */ + donelclchars, /* the user has set "localchars" */ showoptions, net, /* Network file descriptor */ tin, /* Terminal input file descriptor */ @@ -252,6 +253,7 @@ extern jmp_buf extern void command P((int, char *, int)), Dump P((int, unsigned char *, int)), + ExitString P((char *, int)), init_3270 P((void)), printoption P((char *, int, int)), printsub P((int, unsigned char *, int)), @@ -297,7 +299,14 @@ extern void slc_add_reply P((int, int, int)), slc_end_reply P((void)); extern int - slc_update P((void)); + NetClose P((int)), + netflush P((void)), + SetSockOpt P((int, int, int, int)), + slc_update P((void)), + telrcv P((void)), + TerminalWrite P((char *, int)), + TerminalAutoFlush P((void)), + ttyflush P((int)); extern void env_opt P((unsigned char *, int)), diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c index 91da94dce6ac..0cf715d5ed15 100644 --- a/usr.bin/telnet/main.c +++ b/usr.bin/telnet/main.c @@ -34,19 +34,20 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1988, 1990, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 12/15/93"; +static const char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95"; #endif /* not lint */ -#include -#include #include #include +#include +#include +#include #include "ring.h" #include "externs.h" @@ -54,13 +55,19 @@ static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 12/15/93"; /* These values need to be the same as defined in libtelnet/kerberos5.c */ /* Either define them in both places, or put in some common header file. */ -#define OPTS_FORWARD_CREDS 0x00000002 -#define OPTS_FORWARDABLE_CREDS 0x00000001 +#define OPTS_FORWARD_CREDS 0x00000002 +#define OPTS_FORWARDABLE_CREDS 0x00000001 #if 0 #define FORWARD #endif +void init_terminal(void); +void init_network(void); +void init_telnet(void); +void init_sys(void); +void init_3270(void); + #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) char *ipsec_policy_in = NULL; char *ipsec_policy_out = NULL; @@ -92,28 +99,18 @@ usage() { fprintf(stderr, "Usage: %s %s%s%s%s\n", prompt, -#ifdef AUTHENTICATION - "[-4] [-6] [-8] [-E] [-K] [-L] [-N] [-S tos] [-X atype] [-a] [-c] [-d]", - "\n\t[-e char] [-k realm] [-l user] [-f/-F] [-n tracefile] ", -#else - "[-4] [-6] [-8] [-E] [-L] [-N] [-S tos] [-a] [-c] [-d]", + "[-4] [-6] [-8] [-E] [-L] [-N] [-S tos] [-c] [-d]", "\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 #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) "[-P policy] " #endif - "\n\t[host-name [port]]" + "[host-name [port]]" ); exit(1); } @@ -122,7 +119,7 @@ usage() * main. Parse arguments, invoke the protocol or command parser. */ - + int main(argc, argv) int argc; char *argv[]; @@ -141,7 +138,7 @@ main(argc, argv) TerminalSaveState(); - if (prompt = strrchr(argv[0], '/')) + if ((prompt = strrchr(argv[0], '/'))) ++prompt; else prompt = argv[0]; @@ -157,10 +154,9 @@ main(argc, argv) #define IPSECOPT #endif while ((ch = getopt(argc, argv, - "468EKLNS:X:acde:fFk:l:n:rs:t:ux" IPSECOPT)) != -1) + "468EKLNS:X:acde:fFk:l:n:rs:t:uxy" IPSECOPT)) != -1) #undef IPSECOPT { - switch(ch) { case '4': family = AF_INET; @@ -177,9 +173,6 @@ main(argc, argv) rlogin = escape = _POSIX_VDISABLE; break; case 'K': -#ifdef AUTHENTICATION - autologin = 0; -#endif break; case 'L': eight |= 2; /* binary output only */ @@ -205,9 +198,6 @@ main(argc, argv) } break; case 'X': -#ifdef AUTHENTICATION - auth_disable_name(optarg); -#endif break; case 'a': autologin = 1; @@ -222,48 +212,19 @@ main(argc, argv) set_escape_char(optarg); break; case 'f': -#if defined(AUTHENTICATION) && defined(KRB5) && defined(FORWARD) - if (forward_flags & OPTS_FORWARD_CREDS) { - fprintf(stderr, - "%s: Only one of -f and -F allowed.\n", - prompt); - usage(); - } - forward_flags |= OPTS_FORWARD_CREDS; -#else fprintf(stderr, "%s: Warning: -f ignored, no Kerberos V5 support.\n", prompt); -#endif break; case 'F': -#if defined(AUTHENTICATION) && defined(KRB5) && defined(FORWARD) - if (forward_flags & OPTS_FORWARD_CREDS) { - fprintf(stderr, - "%s: Only one of -f and -F allowed.\n", - prompt); - usage(); - } - forward_flags |= OPTS_FORWARD_CREDS; - forward_flags |= OPTS_FORWARDABLE_CREDS; -#else fprintf(stderr, "%s: Warning: -F ignored, no Kerberos V5 support.\n", prompt); -#endif break; case 'k': -#if defined(AUTHENTICATION) && defined(KRB4) - { - extern char *dest_realm, dst_realm_buf[], dst_realm_sz; - dest_realm = dst_realm_buf; - (void)strncpy(dest_realm, optarg, dst_realm_sz); - } -#else fprintf(stderr, "%s: Warning: -k ignored, no Kerberos V4 support.\n", prompt); -#endif break; case 'l': autologin = 1; @@ -366,4 +327,5 @@ main(argc, argv) #endif command(1, 0, 0); } + return 0; } diff --git a/usr.bin/telnet/network.c b/usr.bin/telnet/network.c index 60e8591be8a3..5c9b0c5c9d8b 100644 --- a/usr.bin/telnet/network.c +++ b/usr.bin/telnet/network.c @@ -32,7 +32,12 @@ */ #ifndef lint -static char sccsid[] = "@(#)network.c 8.2 (Berkeley) 12/15/93"; +#if 0 +static const char sccsid[] = "@(#)network.c 8.2 (Berkeley) 12/15/93"; +#else +static const char rcsid[] = + "$FreeBSD$"; +#endif #endif /* not lint */ #include @@ -42,6 +47,7 @@ static char sccsid[] = "@(#)network.c 8.2 (Berkeley) 12/15/93"; #include #include +#include #include "ring.h" diff --git a/usr.bin/telnet/ring.c b/usr.bin/telnet/ring.c index dc18750a1dda..b414d165fe90 100644 --- a/usr.bin/telnet/ring.c +++ b/usr.bin/telnet/ring.c @@ -32,7 +32,12 @@ */ #ifndef lint -static char sccsid[] = "@(#)ring.c 8.1 (Berkeley) 6/6/93"; +#if 0 +static const char sccsid[] = "@(#)ring.c 8.2 (Berkeley) 5/30/95"; +#else +static const char rcsid[] = + "$FreeBSD$"; +#endif #endif /* not lint */ /* @@ -46,9 +51,9 @@ static char sccsid[] = "@(#)ring.c 8.1 (Berkeley) 6/6/93"; * */ +#include #include #include -#include #ifdef size_t #undef size_t @@ -100,8 +105,9 @@ static u_long ring_clock = 0; /* Buffer state transition routines */ - ring_init(ring, buffer, count) -Ring *ring; + int +ring_init(ring, buffer, count) + Ring *ring; unsigned char *buffer; int count; { diff --git a/usr.bin/telnet/ring.h b/usr.bin/telnet/ring.h index cc2cb123332c..480d0b3c46fd 100644 --- a/usr.bin/telnet/ring.h +++ b/usr.bin/telnet/ring.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)ring.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ #if defined(P) @@ -92,5 +93,5 @@ extern int extern void - ring_clear_mark(), - ring_mark(); + ring_clear_mark P((Ring *)), + ring_mark P((Ring *)); diff --git a/usr.bin/telnet/sys_bsd.c b/usr.bin/telnet/sys_bsd.c index beddb6496ee1..ac93ea83520b 100644 --- a/usr.bin/telnet/sys_bsd.c +++ b/usr.bin/telnet/sys_bsd.c @@ -32,7 +32,12 @@ */ #ifndef lint -static char sccsid[] = "@(#)sys_bsd.c 8.2 (Berkeley) 12/15/93"; +#if 0 +static const char sccsid[] = "@(#)sys_bsd.c 8.4 (Berkeley) 5/30/95"; +#else +static const char rcsid[] = + "$FreeBSD$"; +#endif #endif /* not lint */ /* @@ -611,6 +616,12 @@ TerminalNewMode(f) } if (f != -1) { +#ifdef SIGINT + SIG_FUNC_RET intr(); +#endif /* SIGINT */ +#ifdef SIGQUIT + SIG_FUNC_RET intr2(); +#endif /* SIGQUIT */ #ifdef SIGTSTP SIG_FUNC_RET susp(); #endif /* SIGTSTP */ @@ -618,6 +629,12 @@ TerminalNewMode(f) SIG_FUNC_RET ayt(); #endif +#ifdef SIGINT + (void) signal(SIGINT, intr); +#endif +#ifdef SIGQUIT + (void) signal(SIGQUIT, intr2); +#endif #ifdef SIGTSTP (void) signal(SIGTSTP, susp); #endif /* SIGTSTP */ @@ -668,9 +685,19 @@ TerminalNewMode(f) (void) signal(SIGINFO, ayt_status); #endif +#ifdef SIGINT + (void) signal(SIGINT, SIG_DFL); +#endif +#ifdef SIGQUIT + (void) signal(SIGQUIT, SIG_DFL); +#endif #ifdef SIGTSTP (void) signal(SIGTSTP, SIG_DFL); +# ifndef SOLARIS (void) sigsetmask(sigblock(0) & ~(1<<(SIGTSTP-1))); +# else SOLARIS + (void) sigrelse(SIGTSTP); +# endif SOLARIS #endif /* SIGTSTP */ #ifndef USE_TERMIO ltc = oltc; @@ -713,14 +740,43 @@ TerminalNewMode(f) #endif #ifdef DECODE_BAUD +#ifndef B7200 +#define B7200 B4800 +#endif + +#ifndef B14400 +#define B14400 B9600 +#endif + #ifndef B19200 -# define B19200 B9600 +# define B19200 B14400 +#endif + +#ifndef B28800 +#define B28800 B19200 #endif #ifndef B38400 -# define B38400 B19200 +# define B38400 B28800 #endif +#ifndef B57600 +#define B57600 B38400 +#endif + +#ifndef B76800 +#define B76800 B57600 +#endif + +#ifndef B115200 +#define B115200 B76800 +#endif + +#ifndef B230400 +#define B230400 B115200 +#endif + + /* * This code assumes that the values B0, B50, B75... * are in ascending order. They do not have to be @@ -730,12 +786,14 @@ struct termspeeds { long speed; long value; } termspeeds[] = { - { 0, B0 }, { 50, B50 }, { 75, B75 }, - { 110, B110 }, { 134, B134 }, { 150, B150 }, - { 200, B200 }, { 300, B300 }, { 600, B600 }, - { 1200, B1200 }, { 1800, B1800 }, { 2400, B2400 }, - { 4800, B4800 }, { 9600, B9600 }, { 19200, B19200 }, - { 38400, B38400 }, { -1, B38400 } + { 0, B0 }, { 50, B50 }, { 75, B75 }, + { 110, B110 }, { 134, B134 }, { 150, B150 }, + { 200, B200 }, { 300, B300 }, { 600, B600 }, + { 1200, B1200 }, { 1800, B1800 }, { 2400, B2400 }, + { 4800, B4800 }, { 7200, B7200 }, { 9600, B9600 }, + { 14400, B14400 }, { 19200, B19200 }, { 28800, B28800 }, + { 38400, B38400 }, { 57600, B57600 }, { 115200, B115200 }, + { 230400, B230400 }, { -1, B230400 } }; #endif /* DECODE_BAUD */ @@ -1102,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 && - bcmp(netiring.supply, netiring.supply + c, i) == 0) { + memcmp(netiring.supply, netiring.supply + c, i) == 0) { bogus_oob = 1; first = 0; } else if (i < 0) { @@ -1156,19 +1214,14 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll) if (c < 0 && errno == EWOULDBLOCK) { c = 0; } else { - if (c < 0) { - return -1; - } - if (c == 0) { + /* EOF detection for line mode!!!! */ + if ((c == 0) && MODE_LOCAL_CHARS(globalmode) && isatty(tin)) { /* must be an EOF... */ - if (MODE_LOCAL_CHARS(globalmode) && isatty(tin)) { *ttyiring.supply = termEofChar; c = 1; - } else { - clienteof = 1; - shutdown(net, 1); - return 0; } + if (c <= 0) { + return -1; } if (termdata) { Dump('<', ttyiring.supply, c); diff --git a/usr.bin/telnet/telnet.1 b/usr.bin/telnet/telnet.1 index 042b139c039b..7e06a0b556ab 100644 --- a/usr.bin/telnet/telnet.1 +++ b/usr.bin/telnet/telnet.1 @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)telnet.1 8.5 (Berkeley) 3/1/94 +.\" @(#)telnet.1 8.6 (Berkeley) 6/1/94 .\" $FreeBSD$ .\" .Dd January 27, 2000 @@ -42,7 +42,7 @@ protocol .Sh SYNOPSIS .Nm -.Op Fl 468EFKLNacdfrux +.Op Fl 468EFKLNacdfruxy .Op Fl S Ar tos .Op Fl X Ar authtype .Op Fl e Ar escapechar @@ -209,6 +209,8 @@ addresses only (e.g., domain sockets, accessed with a file path). .It Fl x Turns on encryption of the data stream if possible. +.It Fl y +Suppresses encryption of the data stream. .It Ar host Indicates the official name, an alias, or the Internet address of a remote host. @@ -435,7 +437,7 @@ commands. The .Ic environ command is used to manipulate the -variables that my be sent through the +variables that may be sent through the .Dv TELNET ENVIRON option. The initial set of variables is taken from the users @@ -1046,10 +1048,10 @@ 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. +.Ic opie +command computes a response to the OPIE challenge. .It Ic slc Ar state The .Ic slc diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c index 2481387f1804..ee2c31feeaa4 100644 --- a/usr.bin/telnet/telnet.c +++ b/usr.bin/telnet/telnet.c @@ -34,7 +34,12 @@ */ #ifndef lint -static char sccsid[] = "@(#)telnet.c 8.2 (Berkeley) 12/15/93"; +#if 0 +static const char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95"; +#else +static const char rcsid[] = + "$FreeBSD$"; +#endif #endif /* not lint */ #include @@ -48,9 +53,9 @@ static char sccsid[] = "@(#)telnet.c 8.2 (Berkeley) 12/15/93"; #endif /* defined(unix) */ #include - -#include #include +#include +#include #include "ring.h" @@ -60,7 +65,7 @@ static char sccsid[] = "@(#)telnet.c 8.2 (Berkeley) 12/15/93"; #include "general.h" -#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x)) +#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x)) static unsigned char subbuffer[SUBBUFSIZE], *subpointer, *subend; /* buffer for sub-options */ @@ -182,9 +187,6 @@ init_telnet() ClearArray(options); connected = In3270 = ISend = localflow = donebinarytoggle = 0; -#if defined(AUTHENTICATION) - auth_encrypt_connect(connected); -#endif /* defined(AUTHENTICATION) */ restartany = -1; SYNCHing = 0; @@ -371,9 +373,6 @@ willoption(option) settimer(modenegotiated); /* FALL THROUGH */ case TELOPT_STATUS: -#if defined(AUTHENTICATION) - case TELOPT_AUTHENTICATION: -#endif new_state_ok = 1; break; @@ -507,12 +506,6 @@ dooption(option) new_state_ok = 1; break; -#if defined(AUTHENTICATION) - case TELOPT_AUTHENTICATION: - if (autologin) - new_state_ok = 1; - break; -#endif case TELOPT_XDISPLOC: /* X Display location */ if (env_getvalue((unsigned char *)"DISPLAY")) @@ -969,37 +962,6 @@ suboption() } break; -#if defined(AUTHENTICATION) - case TELOPT_AUTHENTICATION: { - if (!autologin) - break; - if (SB_EOF()) - return; - switch(SB_GET()) { - case TELQUAL_IS: - if (my_want_state_is_dont(TELOPT_AUTHENTICATION)) - return; - auth_is(subpointer, SB_LEN()); - break; - case TELQUAL_SEND: - if (my_want_state_is_wont(TELOPT_AUTHENTICATION)) - return; - auth_send(subpointer, SB_LEN()); - break; - case TELQUAL_REPLY: - if (my_want_state_is_wont(TELOPT_AUTHENTICATION)) - return; - auth_reply(subpointer, SB_LEN()); - break; - case TELQUAL_NAME: - if (my_want_state_is_dont(TELOPT_AUTHENTICATION)) - return; - auth_name(subpointer, SB_LEN()); - break; - } - } - break; -#endif default: break; } @@ -1147,7 +1109,7 @@ slc_init() #define initfunc(func, flags) { \ spcp = &spc_data[func]; \ - if (spcp->valp = tcval(func)) { \ + if ((spcp->valp = tcval(func))) { \ spcp->val = *spcp->valp; \ spcp->mylevel = SLC_VARIABLE|flags; \ } else { \ @@ -1555,12 +1517,12 @@ env_opt_add(ep) if (ep == NULL || *ep == '\0') { /* Send user defined variables first. */ env_default(1, 0); - while (ep = env_default(0, 0)) + while ((ep = env_default(0, 0))) env_opt_add(ep); /* Now add the list of well know variables. */ env_default(1, 1); - while (ep = env_default(0, 1)) + while ((ep = env_default(0, 1))) env_opt_add(ep); return; } @@ -1590,7 +1552,7 @@ env_opt_add(ep) else *opt_replyp++ = ENV_USERVAR; for (;;) { - while (c = *ep++) { + while ((c = *ep++)) { switch(c&0xff) { case IAC: *opt_replyp++ = IAC; @@ -1604,7 +1566,7 @@ env_opt_add(ep) } *opt_replyp++ = c; } - if (ep = vp) { + if ((ep = vp)) { #ifdef OLD_ENVIRON if (telopt_environ == TELOPT_OLD_ENVIRON) *opt_replyp++ = old_env_value; @@ -2139,7 +2101,7 @@ Scheduler(block) ring_full_consecutive(&ttyiring)); if (c) { returnValue = 1; - ring_consumed(&ttyiring, c); + ring_consumed(&ttyiring, c); } } else { # endif /* defined(TN3270) */ @@ -2168,24 +2130,8 @@ telnet(user) { sys_telnet_init(); -#if defined(AUTHENTICATION) - { - static char local_host[256] = { 0 }; - - if (!local_host[0]) { - gethostname(local_host, sizeof(local_host)); - local_host[sizeof(local_host)-1] = 0; - } - auth_encrypt_init(local_host, hostname, "TELNET", 0); - auth_encrypt_user(user); - } -#endif /* defined(AUTHENTICATION) */ # if !defined(TN3270) if (telnetport) { -#if defined(AUTHENTICATION) - if (autologin) - send_will(TELOPT_AUTHENTICATION, 1); -#endif send_do(TELOPT_SGA, 1); send_will(TELOPT_TTYPE, 1); send_will(TELOPT_NAWS, 1); diff --git a/usr.bin/telnet/terminal.c b/usr.bin/telnet/terminal.c index aeacbb0ffade..4464681f3b49 100644 --- a/usr.bin/telnet/terminal.c +++ b/usr.bin/telnet/terminal.c @@ -32,7 +32,12 @@ */ #ifndef lint -static char sccsid[] = "@(#)terminal.c 8.1 (Berkeley) 6/6/93"; +#if 0 +static const char sccsid[] = "@(#)terminal.c 8.2 (Berkeley) 2/16/95"; +#else +static const char rcsid[] = + "$FreeBSD$"; +#endif #endif /* not lint */ #include diff --git a/usr.bin/telnet/tn3270.c b/usr.bin/telnet/tn3270.c index a75cd1ecb5a9..92219b7f239b 100644 --- a/usr.bin/telnet/tn3270.c +++ b/usr.bin/telnet/tn3270.c @@ -32,7 +32,12 @@ */ #ifndef lint -static char sccsid[] = "@(#)tn3270.c 8.2 (Berkeley) 5/30/95"; +#if 0 +static const char sccsid[] = "@(#)tn3270.c 8.2 (Berkeley) 5/30/95"; +#else +static const char rcsid[] = + "$FreeBSD$"; +#endif #endif /* not lint */ #include diff --git a/usr.bin/telnet/utilities.c b/usr.bin/telnet/utilities.c index b6451920b9b5..ff6e1eb3617e 100644 --- a/usr.bin/telnet/utilities.c +++ b/usr.bin/telnet/utilities.c @@ -32,7 +32,12 @@ */ #ifndef lint -static char sccsid[] = "@(#)utilities.c 8.2 (Berkeley) 12/15/93"; +#if 0 +static const char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95"; +#else +static const char rcsid[] = + "$FreeBSD$"; +#endif #endif /* not lint */ #define TELOPTS @@ -40,9 +45,10 @@ static char sccsid[] = "@(#)utilities.c 8.2 (Berkeley) 12/15/93"; #define SLC_NAMES #include #include +#include #include - #include +#include #include "general.h" @@ -134,7 +140,6 @@ Dump(direction, buffer, length) # define min(x,y) ((x= length) { - fprintf(NetTrace, "(partial suboption??\?)"); - break; - } - fprintf(NetTrace, "%s|%s ", - ((pointer[i] & AUTH_WHO_MASK) == AUTH_WHO_CLIENT) ? - "CLIENT" : "SERVER", - ((pointer[i] & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) ? - "MUTUAL" : "ONE-WAY"); - ++i; - } - break; - - case TELQUAL_NAME: - i = 2; - fprintf(NetTrace, " NAME \""); - while (i < length) - putc(pointer[i++], NetTrace); - putc('"', NetTrace); - break; - - default: - for (i = 2; i < length; i++) - fprintf(NetTrace, " ?%d?", pointer[i]); - break; - } - break; -#endif case TELOPT_LINEMODE: @@ -749,7 +688,6 @@ printsub(direction, pointer, length) break; default: - def_case: if (isprint(pointer[i]) && pointer[i] != '"') { if (noquote) { putc('"', NetTrace);