summaryrefslogtreecommitdiffstats
path: root/eBones/usr.bin
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1995-07-20 11:40:06 +0000
committerpst <pst@FreeBSD.org>1995-07-20 11:40:06 +0000
commitd6b93135e2743f89332a3ea7f97d682dd40c7b85 (patch)
tree16908c200b05bff2e4532927f105621ae791d795 /eBones/usr.bin
parentb8e783516fe93f74be3f95b44fbeb5719a33d819 (diff)
downloadFreeBSD-src-d6b93135e2743f89332a3ea7f97d682dd40c7b85.zip
FreeBSD-src-d6b93135e2743f89332a3ea7f97d682dd40c7b85.tar.gz
Update telnet to the 95.05.31 release.
Obtained from: Dave Borman <dab@cray.com>
Diffstat (limited to 'eBones/usr.bin')
-rw-r--r--eBones/usr.bin/telnet/Makefile19
-rw-r--r--eBones/usr.bin/telnet/commands.c30
-rw-r--r--eBones/usr.bin/telnet/externs.h5
-rw-r--r--eBones/usr.bin/telnet/main.c2
-rw-r--r--eBones/usr.bin/telnet/ring.c6
-rw-r--r--eBones/usr.bin/telnet/sys_bsd.c67
-rw-r--r--eBones/usr.bin/telnet/telnet.110
-rw-r--r--eBones/usr.bin/telnet/telnet.c10
-rw-r--r--eBones/usr.bin/telnet/terminal.c5
-rw-r--r--eBones/usr.bin/telnet/tn3270.c4
-rw-r--r--eBones/usr.bin/telnet/utilities.c2
11 files changed, 117 insertions, 43 deletions
diff --git a/eBones/usr.bin/telnet/Makefile b/eBones/usr.bin/telnet/Makefile
index 1c8bd26..1f4b288 100644
--- a/eBones/usr.bin/telnet/Makefile
+++ b/eBones/usr.bin/telnet/Makefile
@@ -35,14 +35,27 @@
PROG= telnet
-CFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO #-DAUTHENTICATION -DENCRYPTION
+CFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO
CFLAGS+=-DENV_HACK
CFLAGS+=-I${.CURDIR}/../../lib
-#CFLAGS+= -DKRB4
+#ifdef ENCRYPTION
+
+CFLAGS+=-DAUTHENTICATION -DENCRYPTION
+
+.if exists(/usr/lib/libkrb.a)
+CFLAGS+= -DKRB4
+LDADD+= -lkrb -ldes
+.endif
+
+.if exists(/usr/lib/libkrb4.a)
+CFLAGS+= -DKRB5 -DFORWARD
+LDADD+= -lkrb5 -ldes
+.endif
+
+#endif /* ENCRYPTION */
LDADD= -ltermcap -ltelnet
-#LDADD+= -lkrb -ldes
DPADD= ${LIBTERMCAP}
SRCS= authenc.c commands.c main.c network.c ring.c sys_bsd.c telnet.c \
diff --git a/eBones/usr.bin/telnet/commands.c b/eBones/usr.bin/telnet/commands.c
index 3b7ee7b..a6967b5 100644
--- a/eBones/usr.bin/telnet/commands.c
+++ b/eBones/usr.bin/telnet/commands.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)commands.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
#endif /* not lint */
#if defined(unix)
@@ -1363,7 +1363,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 &&
@@ -1403,12 +1403,12 @@ shell(argc, argv)
* Fire up the shell in the child.
*/
register char *shellp, *shellname;
- extern char *rindex();
+ extern char *strrchr();
shellp = getenv("SHELL");
if (shellp == NULL)
shellp = "/bin/sh";
- if ((shellname = rindex(shellp, '/')) == 0)
+ if ((shellname = strrchr(shellp, '/')) == 0)
shellname = shellp;
else
shellname++;
@@ -1690,10 +1690,10 @@ env_init()
extern char **environ;
register char **epp, *cp;
register struct env_lst *ep;
- extern char *index();
+ extern char *strchr();
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);
@@ -1710,7 +1710,7 @@ env_init()
&& ((*ep->value == ':')
|| (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';
@@ -2240,7 +2240,7 @@ tn(argc, argv)
char *cmd, *hostp = 0, *portp = 0, *user = 0;
/* clear the socket address prior to use */
- bzero((char *)&sin, sizeof(sin));
+ memset((char *)&sin, 0, sizeof(sin));
if (connected) {
printf("?Already connected to %s\n", hostname);
@@ -2258,7 +2258,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;
@@ -2323,10 +2323,10 @@ tn(argc, argv)
if (host) {
sin.sin_family = host->h_addrtype;
#if defined(h_addr) /* In 4.3, this is a #define */
- memcpy((caddr_t)&sin.sin_addr,
+ memmove((caddr_t)&sin.sin_addr,
host->h_addr_list[0], host->h_length);
#else /* defined(h_addr) */
- memcpy((caddr_t)&sin.sin_addr, host->h_addr, host->h_length);
+ memmove((caddr_t)&sin.sin_addr, host->h_addr, host->h_length);
#endif /* defined(h_addr) */
strncpy(_hostname, host->h_name, sizeof(_hostname));
_hostname[sizeof(_hostname)-1] = '\0';
@@ -2417,7 +2417,7 @@ tn(argc, argv)
errno = oerrno;
perror((char *)0);
host->h_addr_list++;
- memcpy((caddr_t)&sin.sin_addr,
+ memmove((caddr_t)&sin.sin_addr,
host->h_addr_list[0], host->h_length);
(void) NetClose(net);
continue;
@@ -2901,16 +2901,16 @@ sourceroute(arg, cpp, lenp)
sin_addr.s_addr = tmp;
} else if (host = gethostbyname(cp)) {
#if defined(h_addr)
- memcpy((caddr_t)&sin_addr,
+ memmove((caddr_t)&sin_addr,
host->h_addr_list[0], host->h_length);
#else
- memcpy((caddr_t)&sin_addr, host->h_addr, host->h_length);
+ memmove((caddr_t)&sin_addr, host->h_addr, host->h_length);
#endif
} else {
*cpp = cp;
return(0);
}
- memcpy(lsrp, (char *)&sin_addr, 4);
+ memmove(lsrp, (char *)&sin_addr, 4);
lsrp += 4;
if (cp2)
cp = cp2;
diff --git a/eBones/usr.bin/telnet/externs.h b/eBones/usr.bin/telnet/externs.h
index b721992..7c52be9 100644
--- a/eBones/usr.bin/telnet/externs.h
+++ b/eBones/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
*/
#ifndef BSD
@@ -83,8 +83,9 @@ typedef unsigned char cc_t;
#ifndef NO_STRING_H
#include <string.h>
-#endif
+#else
#include <strings.h>
+#endif
#ifndef _POSIX_VDISABLE
# ifdef sun
diff --git a/eBones/usr.bin/telnet/main.c b/eBones/usr.bin/telnet/main.c
index e802271..09ac26c 100644
--- a/eBones/usr.bin/telnet/main.c
+++ b/eBones/usr.bin/telnet/main.c
@@ -38,7 +38,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95";
#endif /* not lint */
#include <sys/types.h>
diff --git a/eBones/usr.bin/telnet/ring.c b/eBones/usr.bin/telnet/ring.c
index 1080d12..37dfda8 100644
--- a/eBones/usr.bin/telnet/ring.c
+++ b/eBones/usr.bin/telnet/ring.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)ring.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)ring.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
/*
@@ -295,7 +295,7 @@ ring_supply_data(ring, buffer, count)
while (count) {
i = MIN(count, ring_empty_consecutive(ring));
- memcpy(ring->supply, buffer, i);
+ memmove(ring->supply, buffer, i);
ring_supplied(ring, i);
count -= i;
buffer += i;
@@ -317,7 +317,7 @@ ring_consume_data(ring, buffer, count)
while (count) {
i = MIN(count, ring_full_consecutive(ring));
- memcpy(buffer, ring->consume, i);
+ memmove(buffer, ring->consume, i);
ring_consumed(ring, i);
count -= i;
buffer += i;
diff --git a/eBones/usr.bin/telnet/sys_bsd.c b/eBones/usr.bin/telnet/sys_bsd.c
index c55f85a..3ede7c4 100644
--- a/eBones/usr.bin/telnet/sys_bsd.c
+++ b/eBones/usr.bin/telnet/sys_bsd.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)sys_bsd.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)sys_bsd.c 8.4 (Berkeley) 5/30/95";
#endif /* not lint */
/*
@@ -328,7 +328,7 @@ TerminalDefaultChars()
nttyb.sg_kill = ottyb.sg_kill;
nttyb.sg_erase = ottyb.sg_erase;
#else /* USE_TERMIO */
- memcpy(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
+ memmove(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
# ifndef VDISCARD
termFlushChar = CONTROL('O');
# endif
@@ -669,7 +669,11 @@ TerminalNewMode(f)
#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;
@@ -704,14 +708,51 @@ TerminalNewMode(f)
}
+/*
+ * Try to guess whether speeds are "encoded" (4.2BSD) or just numeric (4.4BSD).
+ */
+#if B4800 != 4800
+#define DECODE_BAUD
+#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
@@ -725,16 +766,21 @@ struct termspeeds {
{ 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 }
+ { 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 */
void
TerminalSpeeds(ispeed, ospeed)
long *ispeed;
long *ospeed;
{
+#ifdef DECODE_BAUD
register struct termspeeds *tp;
+#endif /* DECODE_BAUD */
register long in, out;
out = cfgetospeed(&old_tc);
@@ -742,6 +788,7 @@ TerminalSpeeds(ispeed, ospeed)
if (in == 0)
in = out;
+#ifdef DECODE_BAUD
tp = termspeeds;
while ((tp->speed != -1) && (tp->value < in))
tp++;
@@ -751,6 +798,10 @@ TerminalSpeeds(ispeed, ospeed)
while ((tp->speed != -1) && (tp->value < out))
tp++;
*ospeed = tp->speed;
+#else /* DECODE_BAUD */
+ *ispeed = in;
+ *ospeed = out;
+#endif /* DECODE_BAUD */
}
int
@@ -1085,7 +1136,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) {
@@ -1134,6 +1185,8 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll)
if (FD_ISSET(tin, &ibits)) {
FD_CLR(tin, &ibits);
c = TerminalRead(ttyiring.supply, ring_empty_consecutive(&ttyiring));
+ if (c < 0 && errno == EIO)
+ c = 0;
if (c < 0 && errno == EWOULDBLOCK) {
c = 0;
} else {
diff --git a/eBones/usr.bin/telnet/telnet.1 b/eBones/usr.bin/telnet/telnet.1
index 27079d9..b996fea 100644
--- a/eBones/usr.bin/telnet/telnet.1
+++ b/eBones/usr.bin/telnet/telnet.1
@@ -29,9 +29,9 @@
.\" 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
.\"
-.Dd March 1, 1994
+.Dd June 1, 1994
.Dt TELNET 1
.Os BSD 4.2
.Sh NAME
@@ -139,6 +139,7 @@ there will be no escape character.
If Kerberos V5 authentication is being used, the
.Fl f
option allows the local credentials to be forwarded to the remote system.
+.ne 1i
.It Fl k Ar realm
If Kerberos authentication is being used, the
.Fl k
@@ -508,6 +509,7 @@ option.
This requires that the
.Dv LINEMODE
option be enabled.
+.ne 1i
.It Ic litecho Pq Ic \-litecho
Attempt to enable (disable) the
.Dv LIT_ECHO
@@ -641,6 +643,7 @@ command,
.Ic getstatus
will send the subnegotiation to request that the server send
its current option status.
+.ne 1i
.It Ic ip
Sends the
.Dv TELNET IP
@@ -966,6 +969,7 @@ The initial value for the suspend character is taken to be
the terminal's
.Ic suspend
character.
+.ne 1i
.It Ic tracefile
This is the file to which the output, caused by
.Ic netdata
@@ -1108,6 +1112,7 @@ stream does not start automatically. The autoencrypt
(autodecrypt) command states that encryption of the
output (input) stream should be enabled as soon as
possible.
+.sp
.Pp
Note: Because of export controls, the
.Dv TELNET ENCRYPT
@@ -1263,6 +1268,7 @@ protocol processing (having to do with
options).
The initial value for this toggle is
.Dv FALSE .
+.ne 1i
.It Ic prettydump
When the
.Ic netdata
diff --git a/eBones/usr.bin/telnet/telnet.c b/eBones/usr.bin/telnet/telnet.c
index 687ac83..4402fdd 100644
--- a/eBones/usr.bin/telnet/telnet.c
+++ b/eBones/usr.bin/telnet/telnet.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)telnet.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95";
#endif /* not lint */
#include <sys/types.h>
@@ -57,7 +57,7 @@ static char sccsid[] = "@(#)telnet.c 8.2 (Berkeley) 12/15/93";
#include "general.h"
-#define strip(x) ((x)&0x7f)
+#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x))
static unsigned char subbuffer[SUBBUFSIZE],
*subpointer, *subend; /* buffer for sub-options */
@@ -623,7 +623,7 @@ mklist(buf, name)
register char c, *cp, **argvp, *cp2, **argv, **avt;
if (name) {
- if (strlen(name) > 40) {
+ if ((int)strlen(name) > 40) {
name = 0;
unknown[0] = name_unknown;
} else {
@@ -782,7 +782,7 @@ gettermname()
(setupterm(tname, 1, &err) == 0)) {
tnamep = mklist(termbuf, tname);
} else {
- if (tname && (strlen(tname) <= 40)) {
+ if (tname && ((int)strlen(tname) <= 40)) {
unknown[0] = tname;
upcase(tname);
} else
@@ -2431,7 +2431,7 @@ netclear()
next = nextitem(next);
} while (wewant(next) && (nfrontp > next));
length = next-thisitem;
- memcpy(good, thisitem, length);
+ memmove(good, thisitem, length);
good += length;
thisitem = next;
} else {
diff --git a/eBones/usr.bin/telnet/terminal.c b/eBones/usr.bin/telnet/terminal.c
index b6d3b86..b5ceeda 100644
--- a/eBones/usr.bin/telnet/terminal.c
+++ b/eBones/usr.bin/telnet/terminal.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)terminal.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)terminal.c 8.2 (Berkeley) 2/16/95";
#endif /* not lint */
#include <arpa/telnet.h>
@@ -140,7 +140,8 @@ ttyflush(drop)
n1 = n0 - n;
if (!drop)
n1 = TerminalWrite(ttyoring.bottom, n1);
- n += n1;
+ if (n1 > 0)
+ n += n1;
}
ring_consumed(&ttyoring, n);
}
diff --git a/eBones/usr.bin/telnet/tn3270.c b/eBones/usr.bin/telnet/tn3270.c
index 1f285cf..a75cd1e 100644
--- a/eBones/usr.bin/telnet/tn3270.c
+++ b/eBones/usr.bin/telnet/tn3270.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)tn3270.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)tn3270.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
#include <sys/types.h>
@@ -242,7 +242,7 @@ Push3270()
if (save) {
if (Ifrontp+save > Ibuf+sizeof Ibuf) {
if (Ibackp != Ibuf) {
- memcpy(Ibuf, Ibackp, Ifrontp-Ibackp);
+ memmove(Ibuf, Ibackp, Ifrontp-Ibackp);
Ifrontp -= (Ibackp-Ibuf);
Ibackp = Ibuf;
}
diff --git a/eBones/usr.bin/telnet/utilities.c b/eBones/usr.bin/telnet/utilities.c
index 2f451ca..06d08a4 100644
--- a/eBones/usr.bin/telnet/utilities.c
+++ b/eBones/usr.bin/telnet/utilities.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)utilities.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95";
#endif /* not lint */
#define TELOPTS
OpenPOWER on IntegriCloud