summaryrefslogtreecommitdiffstats
path: root/secure
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 /secure
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 'secure')
-rw-r--r--secure/lib/libtelnet/Makefile18
-rw-r--r--secure/lib/libtelnet/auth.c9
-rw-r--r--secure/lib/libtelnet/enc_des.c24
-rw-r--r--secure/lib/libtelnet/encrypt.c9
-rw-r--r--secure/lib/libtelnet/genget.c2
-rw-r--r--secure/lib/libtelnet/kerberos.c10
-rw-r--r--secure/lib/libtelnet/kerberos5.c26
-rw-r--r--secure/lib/libtelnet/krb4encpwd.c20
-rw-r--r--secure/lib/libtelnet/read_password.c18
-rw-r--r--secure/lib/libtelnet/rsaencpwd.c22
-rw-r--r--secure/lib/libtelnet/spx.c2
-rw-r--r--secure/libexec/telnetd/Makefile13
-rw-r--r--secure/libexec/telnetd/authenc.c4
-rw-r--r--secure/libexec/telnetd/slc.c6
-rw-r--r--secure/libexec/telnetd/state.c20
-rw-r--r--secure/libexec/telnetd/sys_term.c216
-rw-r--r--secure/libexec/telnetd/telnetd.86
-rw-r--r--secure/libexec/telnetd/telnetd.c46
-rw-r--r--secure/libexec/telnetd/termstat.c4
-rw-r--r--secure/libexec/telnetd/utility.c16
-rw-r--r--secure/usr.bin/telnet/Makefile19
-rw-r--r--secure/usr.bin/telnet/commands.c30
-rw-r--r--secure/usr.bin/telnet/externs.h5
-rw-r--r--secure/usr.bin/telnet/main.c2
-rw-r--r--secure/usr.bin/telnet/ring.c6
-rw-r--r--secure/usr.bin/telnet/sys_bsd.c67
-rw-r--r--secure/usr.bin/telnet/telnet.110
-rw-r--r--secure/usr.bin/telnet/telnet.c10
-rw-r--r--secure/usr.bin/telnet/terminal.c5
-rw-r--r--secure/usr.bin/telnet/tn3270.c4
-rw-r--r--secure/usr.bin/telnet/utilities.c2
31 files changed, 459 insertions, 192 deletions
diff --git a/secure/lib/libtelnet/Makefile b/secure/lib/libtelnet/Makefile
index 90a0be8..9e7df0b 100644
--- a/secure/lib/libtelnet/Makefile
+++ b/secure/lib/libtelnet/Makefile
@@ -1,12 +1,26 @@
# From: @(#)Makefile 8.2 (Berkeley) 12/15/93
-# $Id: Makefile,v 1.2 1994/08/05 02:02:36 wollman Exp $
+# $Id: Makefile,v 1.1.1.1 1994/08/12 22:02:57 csgr Exp $
LIB= telnet
SRCS= auth.c encrypt.c genget.c getent.c misc.c
SRCS+= kerberos.c enc_des.c
-#SRCS+= kerberos5.c
+SRCS+= spx.c rsaencpwd.c read_password.c
CFLAGS+= -DHAS_CGETENT
+#ifdef ENCRYPTION
+CFLAGS+= -DENCRYPTION -DAUTHENTICATION
+
+.if exists(/usr/lib/libkrb.a)
+CFLAGS+= -DKRB4 -DKRB4_ENCPWD -DDES_ENCRYPTION -I/usr/include/kerberosIV
+SRCS+= krb4encpwd.c
+.endif
+
+.if exists(/usr/lib/libkrb5.a)
+CFLAGS+= -DKRB5 -DDES_ENCRYPTION -DFORWARD
+SRCS+= kerberos5.c forward.c
+.endif
+#endif /* ENCRYPTION */
+
# These are the sources that have encryption stuff in them.
CRYPT_SRC= auth.c enc-proto.h enc_des.c encrypt.c
CRYPT_SRC+= encrypt.h kerberos.c kerberos5.c krb4encpwd.c
diff --git a/secure/lib/libtelnet/auth.c b/secure/lib/libtelnet/auth.c
index 226a206..64f5ce9 100644
--- a/secure/lib/libtelnet/auth.c
+++ b/secure/lib/libtelnet/auth.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)auth.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)auth.c 8.3 (Berkeley) 5/30/95";
#endif /* not lint */
/*
@@ -222,6 +222,9 @@ auth_init(name, server)
Name,
ap->type, ap->way);
}
+ else if (auth_debug_mode)
+ printf(">>>%s: Init failed: auth type %d %d\r\n",
+ Name, ap->type, ap->way);
++ap;
}
}
@@ -416,7 +419,7 @@ auth_send(data, cnt)
auth_send_cnt = cnt > sizeof(_auth_send_data)
? sizeof(_auth_send_data)
: cnt;
- bcopy((void *)data, (void *)_auth_send_data, auth_send_cnt);
+ memmove((void *)_auth_send_data, (void *)data, auth_send_cnt);
auth_send_data = _auth_send_data;
} else {
/*
@@ -542,7 +545,7 @@ auth_name(data, cnt)
Name, cnt, sizeof(savename)-1);
return;
}
- bcopy((void *)data, (void *)savename, cnt);
+ memmove((void *)savename, (void *)data, cnt);
savename[cnt] = '\0'; /* Null terminate */
if (auth_debug_mode)
printf(">>>%s: Got NAME [%s]\r\n", Name, savename);
diff --git a/secure/lib/libtelnet/enc_des.c b/secure/lib/libtelnet/enc_des.c
index 6f90520..d6886fd 100644
--- a/secure/lib/libtelnet/enc_des.c
+++ b/secure/lib/libtelnet/enc_des.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)enc_des.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)enc_des.c 8.3 (Berkeley) 5/30/95";
#endif /* not lint */
#ifdef ENCRYPTION
@@ -143,7 +143,7 @@ ofb64_init(server)
fb64_init(fbp)
register struct fb *fbp;
{
- bzero((void *)fbp, sizeof(*fbp));
+ memset((void *)fbp, 0, sizeof(*fbp));
fbp->state[0] = fbp->state[1] = FAILED;
fbp->fb_feed[0] = IAC;
fbp->fb_feed[1] = SB;
@@ -374,7 +374,7 @@ fb64_reply(data, cnt, fbp)
break;
case FB64_IV_BAD:
- bzero(fbp->temp_feed, sizeof(Block));
+ memset(fbp->temp_feed, 0, sizeof(Block));
fb64_stream_iv(fbp->temp_feed, &fbp->streams[DIR_ENCRYPT-1]);
state = FAILED;
break;
@@ -422,7 +422,7 @@ fb64_session(key, server, fbp)
key ? key->type : -1, SK_DES);
return;
}
- bcopy((void *)key->data, (void *)fbp->krbdes_key, sizeof(Block));
+ memmove((void *)fbp->krbdes_key, (void *)key->data, sizeof(Block));
fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_ENCRYPT-1]);
fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_DECRYPT-1]);
@@ -549,8 +549,8 @@ fb64_stream_iv(seed, stp)
register struct stinfo *stp;
{
- bcopy((void *)seed, (void *)stp->str_iv, sizeof(Block));
- bcopy((void *)seed, (void *)stp->str_output, sizeof(Block));
+ memmove((void *)stp->str_iv, (void *)seed, sizeof(Block));
+ memmove((void *)stp->str_output, (void *)seed, sizeof(Block));
des_key_sched(stp->str_ikey, stp->str_sched);
@@ -562,10 +562,10 @@ fb64_stream_key(key, stp)
Block key;
register struct stinfo *stp;
{
- bcopy((void *)key, (void *)stp->str_ikey, sizeof(Block));
+ memmove((void *)stp->str_ikey, (void *)key, sizeof(Block));
des_key_sched(key, stp->str_sched);
- bcopy((void *)stp->str_iv, (void *)stp->str_output, sizeof(Block));
+ memmove((void *)stp->str_output, (void *)stp->str_iv, sizeof(Block));
stp->str_index = sizeof(Block);
}
@@ -605,7 +605,7 @@ cfb64_encrypt(s, c)
if (index == sizeof(Block)) {
Block b;
des_ecb_encrypt(stp->str_output, b, stp->str_sched, 1);
- bcopy((void *)b, (void *)stp->str_feed, sizeof(Block));
+ memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
index = 0;
}
@@ -639,7 +639,7 @@ cfb64_decrypt(data)
if (index == sizeof(Block)) {
Block b;
des_ecb_encrypt(stp->str_output, b, stp->str_sched, 1);
- bcopy((void *)b, (void *)stp->str_feed, sizeof(Block));
+ memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
stp->str_index = 1; /* Next time will be 1 */
index = 0; /* But now use 0 */
}
@@ -681,7 +681,7 @@ ofb64_encrypt(s, c)
if (index == sizeof(Block)) {
Block b;
des_ecb_encrypt(stp->str_feed, b, stp->str_sched, 1);
- bcopy((void *)b, (void *)stp->str_feed, sizeof(Block));
+ memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
index = 0;
}
*s++ ^= stp->str_feed[index];
@@ -712,7 +712,7 @@ ofb64_decrypt(data)
if (index == sizeof(Block)) {
Block b;
des_ecb_encrypt(stp->str_feed, b, stp->str_sched, 1);
- bcopy((void *)b, (void *)stp->str_feed, sizeof(Block));
+ memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
stp->str_index = 1; /* Next time will be 1 */
index = 0; /* But now use 0 */
}
diff --git a/secure/lib/libtelnet/encrypt.c b/secure/lib/libtelnet/encrypt.c
index 1ced89b..432df0c 100644
--- a/secure/lib/libtelnet/encrypt.c
+++ b/secure/lib/libtelnet/encrypt.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)encrypt.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)encrypt.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
/*
@@ -763,12 +763,13 @@ encrypt_keyid(kp, keyid, len)
if (ep->keyid)
(void)(*ep->keyid)(dir, kp->keyid, &kp->keylen);
- } else if ((len != kp->keylen) || (bcmp(keyid, kp->keyid, len) != 0)) {
+ } else if ((len != kp->keylen) ||
+ (memcmp(keyid, kp->keyid, len) != 0)) {
/*
* Length or contents are different
*/
kp->keylen = len;
- bcopy(keyid, kp->keyid, len);
+ memmove(kp->keyid, keyid, len);
if (ep->keyid)
(void)(*ep->keyid)(dir, kp->keyid, &kp->keylen);
} else {
@@ -795,7 +796,7 @@ encrypt_send_keyid(dir, keyid, keylen, saveit)
? ENCRYPT_ENC_KEYID : ENCRYPT_DEC_KEYID;
if (saveit) {
struct key_info *kp = &ki[(dir == DIR_ENCRYPT) ? 0 : 1];
- bcopy(keyid, kp->keyid, keylen);
+ memmove(kp->keyid, keyid, keylen);
kp->keylen = keylen;
}
diff --git a/secure/lib/libtelnet/genget.c b/secure/lib/libtelnet/genget.c
index a43579f..f87fcf0 100644
--- a/secure/lib/libtelnet/genget.c
+++ b/secure/lib/libtelnet/genget.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)genget.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)genget.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
diff --git a/secure/lib/libtelnet/kerberos.c b/secure/lib/libtelnet/kerberos.c
index 5eef373..33599b9 100644
--- a/secure/lib/libtelnet/kerberos.c
+++ b/secure/lib/libtelnet/kerberos.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)kerberos.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)kerberos.c 8.3 (Berkeley) 5/30/95";
#endif /* not lint */
/*
@@ -185,7 +185,7 @@ kerberos4_send(ap)
return(0);
}
- bzero(instance, sizeof(instance));
+ memset(instance, 0, sizeof(instance));
if (realm = krb_get_phost(RemoteHostName))
strncpy(instance, realm, sizeof(instance));
@@ -280,7 +280,7 @@ kerberos4_is(ap, data, cnt)
printf("No local realm\r\n");
return;
}
- bcopy((void *)data, (void *)auth.dat, auth.length = cnt);
+ memmove((void *)auth.dat, (void *)data, auth.length = cnt);
if (auth_debug_mode) {
printf("Got %d bytes of authentication data\r\n", cnt);
printf("CK: %d:", kerberos4_cksum(auth.dat, auth.length));
@@ -297,7 +297,7 @@ kerberos4_is(ap, data, cnt)
return;
}
#ifdef ENCRYPTION
- bcopy((void *)adat.session, (void *)session_key, sizeof(Block));
+ memmove((void *)session_key, (void *)adat.session, sizeof(Block));
#endif /* ENCRYPTION */
krb_kntoln(&adat, name);
@@ -329,7 +329,7 @@ kerberos4_is(ap, data, cnt)
*/
des_init_random_number_generator(session_key);
des_key_sched(session_key, sched);
- bcopy((void *)data, (void *)datablock, sizeof(Block));
+ memmove((void *)datablock, (void *)data, sizeof(Block));
/*
* Take the received encrypted challenge, and encrypt
* it again to get a unique session_key for the
diff --git a/secure/lib/libtelnet/kerberos5.c b/secure/lib/libtelnet/kerberos5.c
index f167b38..69a381a 100644
--- a/secure/lib/libtelnet/kerberos5.c
+++ b/secure/lib/libtelnet/kerberos5.c
@@ -1,7 +1,7 @@
/*
* $Source: /home/ncvs/src/secure/lib/libtelnet/kerberos5.c,v $
- * $Author: csgr $
- * $Id: kerberos5.c,v 1.1.1.1 1994/08/12 22:02:59 csgr Exp $
+ * $Author: rgrimes $
+ * $Id: kerberos5.c,v 1.2 1995/05/30 06:11:54 rgrimes Exp $
*/
#if !defined(lint) && !defined(SABER)
@@ -9,7 +9,7 @@ static
#ifdef __STDC__
const
#endif
-char rcsid_kerberos5_c[] = "$Id: kerberos5.c,v 1.1.1.1 1994/08/12 22:02:59 csgr Exp $";
+char rcsid_kerberos5_c[] = "$Id: kerberos5.c,v 1.2 1995/05/30 06:11:54 rgrimes Exp $";
#endif /* lint */
/*-
@@ -46,7 +46,7 @@ char rcsid_kerberos5_c[] = "$Id: kerberos5.c,v 1.1.1.1 1994/08/12 22:02:59 csgr
*/
#ifndef lint
-static char sccsid[] = "@(#)kerberos5.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)kerberos5.c 8.3 (Berkeley) 5/30/95";
#endif /* not lint */
/*
@@ -203,7 +203,7 @@ kerberos5_send(ap)
ksum.checksum_type = CKSUMTYPE_CRC32;
ksum.contents = sum;
ksum.length = sizeof(sum);
- bzero((Voidptr )sum, sizeof(sum));
+ memset((Voidptr )sum, 0, sizeof(sum));
if (!UserNameRequested) {
if (auth_debug_mode) {
@@ -256,7 +256,7 @@ kerberos5_send(ap)
}
- bzero((char *)&creds, sizeof(creds));
+ memset((char *)&creds, 0, sizeof(creds));
creds.server = server;
if (r = krb5_cc_get_principal(ccache, &creds.client)) {
@@ -305,12 +305,12 @@ kerberos5_send(ap)
if (newkey->keytype != KEYTYPE_DES) {
if (creds.keyblock.keytype == KEYTYPE_DES)
/* use the session key in credentials instead */
- memcpy((char *)session_key,
+ memmove((char *)session_key,
(char *)creds.keyblock.contents, sizeof(Block));
else
/* XXX ? */;
} else {
- memcpy((char *)session_key, (char *)newkey->contents,
+ memmove((char *)session_key, (char *)newkey->contents,
sizeof(Block));
}
krb5_free_keyblock(newkey);
@@ -455,12 +455,14 @@ kerberos5_is(ap, data, cnt)
free(name);
if (authdat->authenticator->subkey &&
authdat->authenticator->subkey->keytype == KEYTYPE_DES) {
- bcopy((Voidptr )authdat->authenticator->subkey->contents,
- (Voidptr )session_key, sizeof(Block));
+ memmove((Voidptr )session_key,
+ (Voidptr )authdat->authenticator->subkey->contents,
+ sizeof(Block));
} else if (authdat->ticket->enc_part2->session->keytype ==
KEYTYPE_DES) {
- bcopy((Voidptr )authdat->ticket->enc_part2->session->contents,
- (Voidptr )session_key, sizeof(Block));
+ memmove((Voidptr )session_key,
+ (Voidptr )authdat->ticket->enc_part2->session->contents,
+ sizeof(Block));
} else
break;
diff --git a/secure/lib/libtelnet/krb4encpwd.c b/secure/lib/libtelnet/krb4encpwd.c
index 3d17b53..00f32e8 100644
--- a/secure/lib/libtelnet/krb4encpwd.c
+++ b/secure/lib/libtelnet/krb4encpwd.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)krb4encpwd.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)krb4encpwd.c 8.3 (Berkeley) 5/30/95";
#endif /* not lint */
@@ -167,7 +167,7 @@ krb4encpwd_init(ap, server)
str_data[3] = TELQUAL_IS;
gethostname(hostname, sizeof(hostname));
realm = krb_realmofhost(hostname);
- cp = index(hostname, '.');
+ cp = strchr(hostname, '.');
if (*cp != NULL) *cp = NULL;
if (read_service_key(KRB_SERVICE_NAME, hostname, realm, 0,
KEYFILE, (char *)skey)) {
@@ -214,10 +214,10 @@ krb4encpwd_is(ap, data, cnt)
return;
switch (*data++) {
case KRB4_ENCPWD_AUTH:
- bcopy((void *)data, (void *)auth.dat, auth.length = cnt);
+ memmove((void *)auth.dat, (void *)data, auth.length = cnt);
gethostname(lhostname, sizeof(lhostname));
- if ((cp = index(lhostname, '.')) != 0) *cp = '\0';
+ if ((cp = strchr(lhostname, '.')) != 0) *cp = '\0';
if (r = krb_rd_encpwd_req(&auth, KRB_SERVICE_NAME, lhostname, 0, &adat, NULL, challenge, r_user, r_passwd)) {
Data(ap, KRB4_ENCPWD_REJECT, (void *)"Auth failed", -1);
@@ -234,7 +234,7 @@ krb4encpwd_is(ap, data, cnt)
return;
}
- bcopy((void *)adat.session, (void *)session_key, sizeof(Block));
+ memmove((void *)session_key, (void *)adat.session, sizeof(Block));
Data(ap, KRB4_ENCPWD_ACCEPT, (void *)0, 0);
auth_finished(ap, AUTH_USER);
break;
@@ -244,7 +244,7 @@ krb4encpwd_is(ap, data, cnt)
* Take the received random challenge text and save
* for future authentication.
*/
- bcopy((void *)data, (void *)challenge, sizeof(Block));
+ memmove((void *)challenge, (void *)data, sizeof(Block));
break;
@@ -255,7 +255,7 @@ krb4encpwd_is(ap, data, cnt)
/*
* If we are doing mutual authentication, get set up to send
- * the challange, and verify it when the response comes back.
+ * the challenge, and verify it when the response comes back.
*/
if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
@@ -310,13 +310,13 @@ krb4encpwd_reply(ap, data, cnt)
gethostname(hostname, sizeof(hostname));
realm = krb_realmofhost(hostname);
- bcopy((void *)data, (void *)challenge, cnt);
- bzero(user_passwd, sizeof(user_passwd));
+ memmove((void *)challenge, (void *)data, cnt);
+ memset(user_passwd, 0, sizeof(user_passwd));
local_des_read_pw_string(user_passwd, sizeof(user_passwd)-1, "Password: ", 0);
UserPassword = user_passwd;
Challenge = challenge;
strcpy(instance, RemoteHostName);
- if ((cp = index(instance, '.')) != 0) *cp = '\0';
+ if ((cp = strchr(instance, '.')) != 0) *cp = '\0';
if (r = krb_mk_encpwd_req(&krb_token, KRB_SERVICE_NAME, instance, realm, Challenge, UserNameRequested, user_passwd)) {
krb_token.length = 0;
diff --git a/secure/lib/libtelnet/read_password.c b/secure/lib/libtelnet/read_password.c
index d487ab6..4676ed3 100644
--- a/secure/lib/libtelnet/read_password.c
+++ b/secure/lib/libtelnet/read_password.c
@@ -32,12 +32,12 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)read_password.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)read_password.c 8.3 (Berkeley) 5/30/95";
#endif /* not lint */
/*
- * $Source: /home/ncvs/src/secure/lib/libtelnet/read_password.c,v $
- * $Author: csgr $
+ * $Source: /mit/kerberos/src/lib/des/RCS/read_password.c,v $
+ * $Author: jon $
*
* Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
* of Technology.
@@ -86,7 +86,7 @@ local_des_read_pw_string(s,max,prompt,verify)
}
/* XXX assume jmp_buf is typedef'ed to an array */
- bcopy((char *)old_env, (char *)env, sizeof(env));
+ memmove((char *)env, (char *)old_env, sizeof(env));
if (setjmp(env))
goto lose;
@@ -105,7 +105,7 @@ local_des_read_pw_string(s,max,prompt,verify)
(void) fflush(stdout);
while (!fgets(s, max, stdin));
- if ((ptr = index(s, '\n')))
+ if ((ptr = strchr(s, '\n')))
*ptr = '\0';
if (verify) {
printf("\nVerifying, please re-enter %s",prompt);
@@ -114,7 +114,7 @@ local_des_read_pw_string(s,max,prompt,verify)
clearerr(stdin);
continue;
}
- if ((ptr = index(key_string, '\n')))
+ if ((ptr = strchr(key_string, '\n')))
*ptr = '\0';
if (strcmp(s,key_string)) {
printf("\n\07\07Mismatch - try again\n");
@@ -127,7 +127,7 @@ local_des_read_pw_string(s,max,prompt,verify)
lose:
if (!ok)
- bzero(s, max);
+ memset(s, 0, max);
printf("\n");
/* turn echo back on */
tty_state.sg_flags |= ECHO;
@@ -136,9 +136,9 @@ lose:
/*
pop_signals();
*/
- bcopy((char *)env, (char *)old_env, sizeof(env));
+ memmove((char *)old_env, (char *)env, sizeof(env));
if (verify)
- bzero(key_string, sizeof (key_string));
+ memset(key_string, 0, sizeof (key_string));
s[max-1] = 0; /* force termination */
return !ok; /* return nonzero if not okay */
}
diff --git a/secure/lib/libtelnet/rsaencpwd.c b/secure/lib/libtelnet/rsaencpwd.c
index 4c1cb48..3492132 100644
--- a/secure/lib/libtelnet/rsaencpwd.c
+++ b/secure/lib/libtelnet/rsaencpwd.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)rsaencpwd.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)rsaencpwd.c 8.3 (Berkeley) 5/30/95";
#endif /* not lint */
@@ -158,9 +158,9 @@ rsaencpwd_init(ap, server)
if (server) {
str_data[3] = TELQUAL_REPLY;
- bzero(key_file, sizeof(key_file));
+ memset(key_file, 0, sizeof(key_file));
gethostname(lhostname, sizeof(lhostname));
- if ((cp = index(lhostname, '.')) != 0) *cp = '\0';
+ if ((cp = strchr(lhostname, '.')) != 0) *cp = '\0';
strcpy(key_file, "/etc/.");
strcat(key_file, lhostname);
strcat(key_file, "_privkey");
@@ -210,7 +210,7 @@ rsaencpwd_is(ap, data, cnt)
cnt--;
switch (*data++) {
case RSA_ENCPWD_AUTH:
- bcopy((void *)data, (void *)auth.dat, auth.length = cnt);
+ memmove((void *)auth.dat, (void *)data, auth.length = cnt);
if ((fp=fopen(key_file, "r"))==NULL) {
Data(ap, RSA_ENCPWD_REJECT, (void *)"Auth failed", -1);
@@ -252,7 +252,7 @@ rsaencpwd_is(ap, data, cnt)
/*
* If we are doing mutual authentication, get set up to send
- * the challange, and verify it when the response comes back.
+ * the challenge, and verify it when the response comes back.
*/
if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_ONE_WAY) {
register int i;
@@ -294,12 +294,12 @@ rsaencpwd_is(ap, data, cnt)
ptr +=NumEncodeLengthOctets(chalkey_len);
*ptr++ = 0x04; /* OCTET STRING */
*ptr++ = challenge_len;
- bcopy(challenge, ptr, challenge_len);
+ memmove(ptr, challenge, challenge_len);
ptr += challenge_len;
*ptr++ = 0x04; /* OCTET STRING */
EncodeLength(ptr, i);
ptr += NumEncodeLengthOctets(i);
- bcopy(key, ptr, i);
+ memmove(ptr, key, i);
chalkey_len = 1+NumEncodeLengthOctets(chalkey_len)+chalkey_len;
Data(ap, RSA_ENCPWD_CHALLENGEKEY, (void *)chalkey, chalkey_len);
}
@@ -345,7 +345,7 @@ rsaencpwd_reply(ap, data, cnt)
* Verify that the response to the challenge is correct.
*/
- bcopy((void *)data, (void *)chalkey, cnt);
+ memmove((void *)chalkey, (void *)data, cnt);
ptr = (char *) &chalkey[0];
ptr += DecodeHeaderLength(chalkey);
if (*ptr != 0x04) {
@@ -354,7 +354,7 @@ rsaencpwd_reply(ap, data, cnt)
*ptr++;
challenge_len = DecodeValueLength(ptr);
ptr += NumEncodeLengthOctets(challenge_len);
- bcopy(ptr, challenge, challenge_len);
+ memmove(challenge, ptr, challenge_len);
ptr += challenge_len;
if (*ptr != 0x04) {
return;
@@ -362,8 +362,8 @@ rsaencpwd_reply(ap, data, cnt)
*ptr++;
pubkey_len = DecodeValueLength(ptr);
ptr += NumEncodeLengthOctets(pubkey_len);
- bcopy(ptr, pubkey, pubkey_len);
- bzero(user_passwd, sizeof(user_passwd));
+ memmove(pubkey, ptr, pubkey_len);
+ memset(user_passwd, 0, sizeof(user_passwd));
local_des_read_pw_string(user_passwd, sizeof(user_passwd)-1, "Password: ", 0);
UserPassword = user_passwd;
Challenge = challenge;
diff --git a/secure/lib/libtelnet/spx.c b/secure/lib/libtelnet/spx.c
index b4634d0..5b625c7 100644
--- a/secure/lib/libtelnet/spx.c
+++ b/secure/lib/libtelnet/spx.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)spx.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)spx.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
#ifdef SPX
diff --git a/secure/libexec/telnetd/Makefile b/secure/libexec/telnetd/Makefile
index 0bfa3c3..79dbb75 100644
--- a/secure/libexec/telnetd/Makefile
+++ b/secure/libexec/telnetd/Makefile
@@ -4,14 +4,23 @@ PROG= telnetd
CFLAGS+=-DLINEMODE -DKLUDGELINEMODE -DUSE_TERMIO -DDIAGNOSTICS
CFLAGS+=-DOLD_ENVIRON -DENV_HACK
CFLAGS+=-I${.CURDIR}/../../lib
-#CFLAGS+=-DAUTHENTICATION -DENCRYPTION
SRCS= authenc.c global.c slc.c state.c sys_term.c telnetd.c \
termstat.c utility.c
DPADD= ${LIBUTIL} ${LIBTERMCAP}
LDADD= -lutil -ltermcap -ltelnet
-#LDADD+= -lkrb -ldes
+
MAN8= telnetd.8
+#ifdef ENCRYPTION
+
+CFLAGS+=-DAUTHENTICATION -DENCRYPTION
+
+.if exists(/usr/lib/libkrb.a)
+LDADD+= -lkrb -ldes
+.endif
+
+#endif /* ENCRYPTION */
+
# These are the sources that have encryption stuff in them.
CRYPT_SRC= authenc.c ext.h state.c telnetd.c termstat.c
CRYPT_SRC+= utility.c Makefile
diff --git a/secure/libexec/telnetd/authenc.c b/secure/libexec/telnetd/authenc.c
index fcd17fc..ccb463c 100644
--- a/secure/libexec/telnetd/authenc.c
+++ b/secure/libexec/telnetd/authenc.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)authenc.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)authenc.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
@@ -45,7 +45,7 @@ net_write(str, len)
int len;
{
if (nfrontp + len < netobuf + BUFSIZ) {
- bcopy((void *)str, (void *)nfrontp, len);
+ memmove((void *)nfrontp, (void *)str, len);
nfrontp += len;
return(len);
}
diff --git a/secure/libexec/telnetd/slc.c b/secure/libexec/telnetd/slc.c
index a03bd9d..6cbb7ab 100644
--- a/secure/libexec/telnetd/slc.c
+++ b/secure/libexec/telnetd/slc.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)slc.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)slc.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
@@ -372,7 +372,6 @@ change_slc(func, flag, val)
slctab[func].defset.val;
val = slctab[func].current.val;
}
-
}
add_slc(func, flag, val);
}
@@ -423,7 +422,6 @@ check_slc()
slctab[i].current.val);
}
}
-
} /* check_slc */
/*
@@ -465,7 +463,7 @@ do_opt_slc(ptr, len)
def_slcbuf = (unsigned char *)malloc((unsigned)len);
if (def_slcbuf == (unsigned char *)0)
return; /* too bad */
- bcopy(ptr, def_slcbuf, len);
+ memmove(def_slcbuf, ptr, len);
}
}
diff --git a/secure/libexec/telnetd/state.c b/secure/libexec/telnetd/state.c
index fc5cbda..4ee8bea 100644
--- a/secure/libexec/telnetd/state.c
+++ b/secure/libexec/telnetd/state.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)state.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)state.c 8.5 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
@@ -366,7 +366,7 @@ gotiac: switch (c) {
char xbuf2[BUFSIZ];
register char *cp;
int n = pfrontp - opfrontp, oc;
- bcopy(opfrontp, xptyobuf, n);
+ memmove(xptyobuf, opfrontp, n);
pfrontp = opfrontp;
pfrontp += term_input(xptyobuf, pfrontp, n, BUFSIZ+NETSLOP,
xbuf2, &oc, BUFSIZ);
@@ -716,7 +716,6 @@ wontoption(option)
*/
if (lmodetype != REAL_LINEMODE)
break;
- lmodetype = KLUDGE_LINEMODE;
# endif /* KLUDGELINEMODE */
clientstat(TELOPT_LINEMODE, WONT, 0);
break;
@@ -1520,8 +1519,8 @@ doclientstat()
clientstat(TELOPT_LINEMODE, WILL, 0);
}
-#define ADD(c) *ncp++ = c;
-#define ADD_DATA(c) { *ncp++ = c; if (c == SE) *ncp++ = c; }
+#define ADD(c) *ncp++ = c
+#define ADD_DATA(c) { *ncp++ = c; if (c == SE || c == IAC) *ncp++ = c; }
void
send_status()
{
@@ -1550,14 +1549,10 @@ send_status()
if (my_want_state_is_will(i)) {
ADD(WILL);
ADD_DATA(i);
- if (i == IAC)
- ADD(IAC);
}
if (his_want_state_is_will(i)) {
ADD(DO);
ADD_DATA(i);
- if (i == IAC)
- ADD(IAC);
}
}
@@ -1572,15 +1567,14 @@ send_status()
ADD(SE);
if (restartany >= 0) {
- ADD(SB)
+ ADD(SB);
ADD(TELOPT_LFLOW);
if (restartany) {
ADD(LFLOW_RESTART_ANY);
} else {
ADD(LFLOW_RESTART_XON);
}
- ADD(SE)
- ADD(SB);
+ ADD(SE);
}
}
@@ -1593,8 +1587,6 @@ send_status()
ADD(TELOPT_LINEMODE);
ADD(LM_MODE);
ADD_DATA(editmode);
- if (editmode == IAC)
- ADD(IAC);
ADD(SE);
ADD(SB);
diff --git a/secure/libexec/telnetd/sys_term.c b/secure/libexec/telnetd/sys_term.c
index 000cfb5..b699a64 100644
--- a/secure/libexec/telnetd/sys_term.c
+++ b/secure/libexec/telnetd/sys_term.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)sys_term.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)sys_term.c 8.4 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
@@ -69,21 +69,16 @@ char wtmpf[] = "/etc/wtmp";
# ifdef CRAY
#include <tmpdir.h>
#include <sys/wait.h>
-# if defined(_SC_CRAY_SECURE_SYS) && !defined(SCM_SECURITY)
- /*
- * UNICOS 6.0/6.1 do not have SCM_SECURITY defined, so we can
- * use it to tell us to turn off all the socket security code,
- * since that is only used in UNICOS 7.0 and later.
- */
-# undef _SC_CRAY_SECURE_SYS
+# if (UNICOS_LVL == '7.0') || (UNICOS_LVL == '7.1')
+# define UNICOS7x
# endif
-# if defined(_SC_CRAY_SECURE_SYS)
+# ifdef UNICOS7x
#include <sys/sysv.h>
#include <sys/secstat.h>
extern int secflag;
extern struct sysv sysv;
-# endif /* _SC_CRAY_SECURE_SYS */
+# endif /* UNICOS7x */
# endif /* CRAY */
#endif /* NEWINIT */
@@ -215,7 +210,7 @@ copy_termbuf(cp, len)
{
if (len > sizeof(termbuf))
len = sizeof(termbuf);
- bcopy(cp, (char *)&termbuf, len);
+ memmove((char *)&termbuf, cp, len);
termbuf2 = termbuf;
}
#endif /* defined(LINEMODE) && defined(TIOCPKT_IOCTL) */
@@ -227,17 +222,19 @@ set_termbuf()
* Only make the necessary changes.
*/
#ifndef USE_TERMIO
- if (bcmp((char *)&termbuf.sg, (char *)&termbuf2.sg, sizeof(termbuf.sg)))
+ if (memcmp((char *)&termbuf.sg, (char *)&termbuf2.sg,
+ sizeof(termbuf.sg)))
(void) ioctl(pty, TIOCSETN, (char *)&termbuf.sg);
- if (bcmp((char *)&termbuf.tc, (char *)&termbuf2.tc, sizeof(termbuf.tc)))
+ if (memcmp((char *)&termbuf.tc, (char *)&termbuf2.tc,
+ sizeof(termbuf.tc)))
(void) ioctl(pty, TIOCSETC, (char *)&termbuf.tc);
- if (bcmp((char *)&termbuf.ltc, (char *)&termbuf2.ltc,
+ if (memcmp((char *)&termbuf.ltc, (char *)&termbuf2.ltc,
sizeof(termbuf.ltc)))
(void) ioctl(pty, TIOCSLTC, (char *)&termbuf.ltc);
if (termbuf.lflags != termbuf2.lflags)
(void) ioctl(pty, TIOCLSET, (char *)&termbuf.lflags);
#else /* USE_TERMIO */
- if (bcmp((char *)&termbuf, (char *)&termbuf2, sizeof(termbuf)))
+ if (memcmp((char *)&termbuf, (char *)&termbuf2, sizeof(termbuf)))
# ifdef STREAMSPTY
(void) tcsetattr(ttyfd, TCSANOW, &termbuf);
# else
@@ -943,6 +940,15 @@ tty_iscrnl()
}
/*
+ * Try to guess whether speeds are "encoded" (4.2BSD) or just numeric (4.4BSD).
+ */
+#if B4800 != 4800
+#define DECODE_BAUD
+#endif
+
+#ifdef DECODE_BAUD
+
+/*
* A table of available terminal speeds
*/
struct termspeeds {
@@ -953,30 +959,68 @@ 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, B9600 },
- { 38400, B9600 }, { -1, B9600 }
+ { 4800, B4800 },
+#ifdef B7200
+ { 7200, B7200 },
+#endif
+ { 9600, B9600 },
+#ifdef B14400
+ { 14400, B14400 },
+#endif
+#ifdef B19200
+ { 19200, B19200 },
+#endif
+#ifdef B28800
+ { 28800, B28800 },
+#endif
+#ifdef B38400
+ { 38400, B38400 },
+#endif
+#ifdef B57600
+ { 57600, B57600 },
+#endif
+#ifdef B115200
+ { 115200, B115200 },
+#endif
+#ifdef B230400
+ { 230400, B230400 },
+#endif
+ { -1, 0 }
};
+#endif /* DECODE_BUAD */
void
tty_tspeed(val)
int val;
{
+#ifdef DECODE_BAUD
register struct termspeeds *tp;
for (tp = termspeeds; (tp->speed != -1) && (val > tp->speed); tp++)
;
+ if (tp->speed == -1) /* back up to last valid value */
+ --tp;
cfsetospeed(&termbuf, tp->value);
+#else /* DECODE_BUAD */
+ cfsetospeed(&termbuf, val);
+#endif /* DECODE_BUAD */
}
void
tty_rspeed(val)
int val;
{
+#ifdef DECODE_BAUD
register struct termspeeds *tp;
for (tp = termspeeds; (tp->speed != -1) && (val > tp->speed); tp++)
;
+ if (tp->speed == -1) /* back up to last valid value */
+ --tp;
cfsetispeed(&termbuf, tp->value);
+#else /* DECODE_BAUD */
+ cfsetispeed(&termbuf, val);
+#endif /* DECODE_BAUD */
}
#if defined(CRAY2) && defined(UNICOS5)
@@ -1092,7 +1136,7 @@ getptyslave()
init_termbuf();
# ifdef TIOCGWINSZ
if (def_row || def_col) {
- bzero((char *)&ws, sizeof(ws));
+ memset((char *)&ws, 0, sizeof(ws));
ws.ws_col = def_col;
ws.ws_row = def_row;
(void)ioctl(t, TIOCSWINSZ, (char *)&ws);
@@ -1172,9 +1216,9 @@ cleanopen(line)
char *line;
{
register int t;
-#if defined(_SC_CRAY_SECURE_SYS)
+#ifdef UNICOS7x
struct secstat secbuf;
-#endif /* _SC_CRAY_SECURE_SYS */
+#endif /* UNICOS7x */
#ifndef STREAMSPTY
/*
@@ -1188,7 +1232,7 @@ cleanopen(line)
# if !defined(CRAY) && (BSD > 43)
(void) revoke(line);
# endif
-#if defined(_SC_CRAY_SECURE_SYS)
+#ifdef UNICOS7x
if (secflag) {
if (secstat(line, &secbuf) < 0)
return(-1);
@@ -1197,18 +1241,18 @@ cleanopen(line)
if (setucmp(secbuf.st_compart) < 0)
return(-1);
}
-#endif /* _SC_CRAY_SECURE_SYS */
+#endif /* UNICOS7x */
t = open(line, O_RDWR|O_NOCTTY);
-#if defined(_SC_CRAY_SECURE_SYS)
+#ifdef UNICOS7x
if (secflag) {
if (setulvl(sysv.sy_minlvl) < 0)
return(-1);
if (setucmp(0) < 0)
return(-1);
}
-#endif /* _SC_CRAY_SECURE_SYS */
+#endif /* UNICOS7x */
if (t < 0)
return(-1);
@@ -1231,9 +1275,8 @@ cleanopen(line)
(void) signal(SIGHUP, SIG_IGN);
(void) ioctl(t, TCVHUP, (char *)0);
(void) signal(SIGHUP, SIG_DFL);
- setpgrp();
-#if defined(_SC_CRAY_SECURE_SYS)
+#ifdef UNICOS7x
if (secflag) {
if (secstat(line, &secbuf) < 0)
return(-1);
@@ -1242,18 +1285,18 @@ cleanopen(line)
if (setucmp(secbuf.st_compart) < 0)
return(-1);
}
-#endif /* _SC_CRAY_SECURE_SYS */
+#endif /* UNICOS7x */
i = open(line, O_RDWR);
-#if defined(_SC_CRAY_SECURE_SYS)
+#ifdef UNICOS7x
if (secflag) {
if (setulvl(sysv.sy_minlvl) < 0)
return(-1);
if (setucmp(0) < 0)
return(-1);
}
-#endif /* _SC_CRAY_SECURE_SYS */
+#endif /* UNICOS7x */
if (i < 0)
return(-1);
@@ -1302,7 +1345,11 @@ login_tty(t)
* setsid() call above may have set our pgrp, so clear
* it out before opening the tty...
*/
+# ifndef SOLARIS
(void) setpgrp(0, 0);
+# else
+ (void) setpgrp();
+# endif
close(open(line, O_RDWR));
# endif
if (t != 0)
@@ -1513,7 +1560,7 @@ start_login(host, autologin, name)
* Create utmp entry for child
*/
- bzero(&utmpx, sizeof(utmpx));
+ memset(&utmpx, 0, sizeof(utmpx));
SCPYN(utmpx.ut_user, ".telnet");
SCPYN(utmpx.ut_line, line + sizeof("/dev/") - 1);
utmpx.ut_pid = pid;
@@ -1523,8 +1570,8 @@ start_login(host, autologin, name)
utmpx.ut_id[3] = SC_WILDC;
utmpx.ut_type = LOGIN_PROCESS;
(void) time(&utmpx.ut_tv.tv_sec);
- if (makeutx(&utmpx) == NULL)
- fatal(net, "makeutx failed");
+ if (pututxline(&utmpx) == NULL)
+ fatal(net, "pututxline failed");
#endif
/*
@@ -1568,6 +1615,19 @@ start_login(host, autologin, name)
#if !defined(NO_LOGIN_P)
argv = addarg(argv, "-p");
#endif
+#ifdef LINEMODE
+ /*
+ * Set the environment variable "LINEMODE" to either
+ * "real" or "kludge" if we are operating in either
+ * real or kludge linemode.
+ */
+ if (lmodetype == REAL_LINEMODE)
+ setenv("LINEMODE", "real", 1);
+# ifdef KLUDGELINEMODE
+ else if (lmodetype == KLUDGE_LINEMODE || lmodetype == KLUDGE_OK)
+ setenv("LINEMODE", "kludge", 1);
+# endif
+#endif
#ifdef BFTPDAEMON
/*
* Are we working as the bftp daemon? If so, then ask login
@@ -1688,11 +1748,27 @@ start_login(host, autologin, name)
*/
unsetenv("USER");
}
+#ifdef SOLARIS
+ else {
+ char **p;
+
+ argv = addarg(argv, ""); /* no login name */
+ for (p = environ; *p; p++) {
+ argv = addarg(argv, *p);
+ }
+ }
+#endif /* SOLARIS */
#if defined(AUTHENTICATION) && defined(NO_LOGIN_F) && defined(LOGIN_R)
if (pty > 2)
close(pty);
#endif
closelog();
+ /*
+ * This sleep(1) is in here so that telnetd can
+ * finish up with the tty. There's a race condition
+ * the login banner message gets lost...
+ */
+ sleep(1);
execv(_PATH_LOGIN, argv);
syslog(LOG_ERR, "%s: %m\n", _PATH_LOGIN);
@@ -1722,7 +1798,7 @@ addarg(argv, val)
if (cpp == &argv[(int)argv[-1]]) {
--argv;
*argv = (char *)((int)(*argv) + 10);
- argv = (char **)realloc(argv, (int)(*argv) + 2);
+ argv = (char **)realloc(argv, sizeof(*argv)*((int)(*argv) + 2));
if (argv == NULL)
return(NULL);
argv++;
@@ -1775,6 +1851,8 @@ cleanup(sig)
# ifdef CRAY
static int incleanup = 0;
register int t;
+ int child_status; /* status of child process as returned by waitpid */
+ int flags = WNOHANG|WUNTRACED;
/*
* 1: Pick up the zombie, if we are being called
@@ -1785,9 +1863,17 @@ cleanup(sig)
* 5: Close down the network and pty connections.
* 6: Finish up the TMPDIR cleanup, if needed.
*/
- if (sig == SIGCHLD)
- while (waitpid(-1, 0, WNOHANG) > 0)
+ if (sig == SIGCHLD) {
+ while (waitpid(-1, &child_status, flags) > 0)
; /* VOID */
+ /* Check if the child process was stopped
+ * rather than exited. We want cleanup only if
+ * the child has died.
+ */
+ if (WIFSTOPPED(child_status)) {
+ return;
+ }
+ }
t = sigblock(sigmask(SIGCHLD));
if (incleanup) {
sigsetmask(t);
@@ -1795,6 +1881,7 @@ cleanup(sig)
}
incleanup = 1;
sigsetmask(t);
+#ifdef UNICOS7x
if (secflag) {
/*
* We need to set ourselves back to a null
@@ -1804,6 +1891,7 @@ cleanup(sig)
setulvl(sysv.sy_minlvl);
setucmp((long)0);
}
+#endif /* UNICOS7x */
t = cleantmp(&wtmp);
setutent(); /* just to make sure */
@@ -1904,6 +1992,28 @@ sigjob(sig)
}
/*
+ * jid_getutid:
+ * called by jobend() before calling cleantmp()
+ * to find the correct $TMPDIR to cleanup.
+ */
+
+ struct utmp *
+jid_getutid(jid)
+ int jid;
+{
+ struct utmp *cur = NULL;
+
+ setutent(); /* just to make sure */
+ while (cur = getutent()) {
+ if ( (cur->ut_type != NULL) && (jid == cur->ut_jid) ) {
+ return(cur);
+ }
+ }
+
+ return(0);
+}
+
+/*
* Clean up the TMPDIR that login created.
* The first time this is called we pick up the info
* from the utmp. If the job has already gone away,
@@ -1959,9 +2069,27 @@ jobend(jid, path, user)
register char *user;
{
static int saved_jid = 0;
+ static int pty_saved_jid = 0;
static char saved_path[sizeof(wtmp.ut_tpath)+1];
static char saved_user[sizeof(wtmp.ut_user)+1];
+ /*
+ * this little piece of code comes into play
+ * only when ptyreconnect is used to reconnect
+ * to an previous session.
+ *
+ * this is the only time when the
+ * "saved_jid != jid" code is executed.
+ */
+
+ if ( saved_jid && saved_jid != jid ) {
+ if (!path) { /* called from signal handler */
+ pty_saved_jid = jid;
+ } else {
+ pty_saved_jid = saved_jid;
+ }
+ }
+
if (path) {
strncpy(saved_path, path, sizeof(wtmp.ut_tpath));
strncpy(saved_user, user, sizeof(wtmp.ut_user));
@@ -1972,6 +2100,24 @@ jobend(jid, path, user)
saved_jid = jid;
return(0);
}
+
+ /* if the jid has changed, get the correct entry from the utmp file */
+
+ if ( saved_jid != jid ) {
+ struct utmp *utp = NULL;
+ struct utmp *jid_getutid();
+
+ utp = jid_getutid(pty_saved_jid);
+
+ if (utp == 0) {
+ syslog(LOG_ERR, "Can't get /etc/utmp entry to clean TMPDIR");
+ return(-1);
+ }
+
+ cleantmpdir(jid, utp->ut_tpath, utp->ut_user);
+ return(1);
+ }
+
cleantmpdir(jid, saved_path, saved_user);
return(1);
}
diff --git a/secure/libexec/telnetd/telnetd.8 b/secure/libexec/telnetd/telnetd.8
index fee5526..f618385 100644
--- a/secure/libexec/telnetd/telnetd.8
+++ b/secure/libexec/telnetd/telnetd.8
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)telnetd.8 8.3 (Berkeley) 3/1/94
+.\" @(#)telnetd.8 8.4 (Berkeley) 6/1/94
.\"
-.Dd March 1, 1994
+.Dd June 1, 1994
.Dt TELNETD 8
.Os BSD 4.2
.Sh NAME
@@ -308,6 +308,7 @@ indicates that only dotted decimal addresses
should be put into the
.Pa utmp
file.
+.ne 1i
.It Fl U
This option causes
.Nm telnetd
@@ -424,6 +425,7 @@ Whenever a
command is received, it is always responded
to with a
.Dv WILL TIMING-MARK
+.ne 1i
.It "WILL LOGOUT"
When a
.Dv DO LOGOUT
diff --git a/secure/libexec/telnetd/telnetd.c b/secure/libexec/telnetd/telnetd.c
index 66e040d..bfed2c2 100644
--- a/secure/libexec/telnetd/telnetd.c
+++ b/secure/libexec/telnetd/telnetd.c
@@ -38,7 +38,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)telnetd.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
@@ -451,7 +451,7 @@ main(argc, argv)
int szi = sizeof(int);
#endif /* SO_SEC_MULTI */
- bzero((char *)&dv, sizeof(dv));
+ memset((char *)&dv, 0, sizeof(dv));
if (getsysv(&sysv, sizeof(struct sysv)) != 0) {
perror("getsysv");
@@ -637,34 +637,40 @@ getterminaltype(name)
static unsigned char sb[] =
{ IAC, SB, TELOPT_TSPEED, TELQUAL_SEND, IAC, SE };
- bcopy(sb, nfrontp, sizeof sb);
+ memmove(nfrontp, sb, sizeof sb);
nfrontp += sizeof sb;
+ DIAG(TD_OPTIONS, printsub('>', sb + 2, sizeof sb - 2););
}
if (his_state_is_will(TELOPT_XDISPLOC)) {
static unsigned char sb[] =
{ IAC, SB, TELOPT_XDISPLOC, TELQUAL_SEND, IAC, SE };
- bcopy(sb, nfrontp, sizeof sb);
+ memmove(nfrontp, sb, sizeof sb);
nfrontp += sizeof sb;
+ DIAG(TD_OPTIONS, printsub('>', sb + 2, sizeof sb - 2););
}
if (his_state_is_will(TELOPT_NEW_ENVIRON)) {
static unsigned char sb[] =
{ IAC, SB, TELOPT_NEW_ENVIRON, TELQUAL_SEND, IAC, SE };
- bcopy(sb, nfrontp, sizeof sb);
+ memmove(nfrontp, sb, sizeof sb);
nfrontp += sizeof sb;
+ DIAG(TD_OPTIONS, printsub('>', sb + 2, sizeof sb - 2););
}
else if (his_state_is_will(TELOPT_OLD_ENVIRON)) {
static unsigned char sb[] =
{ IAC, SB, TELOPT_OLD_ENVIRON, TELQUAL_SEND, IAC, SE };
- bcopy(sb, nfrontp, sizeof sb);
+ memmove(nfrontp, sb, sizeof sb);
nfrontp += sizeof sb;
+ DIAG(TD_OPTIONS, printsub('>', sb + 2, sizeof sb - 2););
}
if (his_state_is_will(TELOPT_TTYPE)) {
- bcopy(ttytype_sbbuf, nfrontp, sizeof ttytype_sbbuf);
+ memmove(nfrontp, ttytype_sbbuf, sizeof ttytype_sbbuf);
nfrontp += sizeof ttytype_sbbuf;
+ DIAG(TD_OPTIONS, printsub('>', ttytype_sbbuf + 2,
+ sizeof ttytype_sbbuf - 2););
}
if (his_state_is_will(TELOPT_TSPEED)) {
while (sequenceIs(tspeedsubopt, baseline))
@@ -737,8 +743,10 @@ _gettermname()
if (his_state_is_wont(TELOPT_TTYPE))
return;
settimer(baseline);
- bcopy(ttytype_sbbuf, nfrontp, sizeof ttytype_sbbuf);
+ memmove(nfrontp, ttytype_sbbuf, sizeof ttytype_sbbuf);
nfrontp += sizeof ttytype_sbbuf;
+ DIAG(TD_OPTIONS, printsub('>', ttytype_sbbuf + 2,
+ sizeof ttytype_sbbuf - 2););
while (sequenceIs(ttypesubopt, baseline))
ttloop();
}
@@ -838,7 +846,8 @@ doit(who)
fatal(net, "Couldn't resolve your address into a host name.\r\n\
Please contact your net administrator");
} else if (hp &&
- (strlen(hp->h_name) <= ((utmp_len < 0) ? -utmp_len : utmp_len))) {
+ (strlen(hp->h_name) <= (unsigned int)((utmp_len < 0) ? -utmp_len
+ : utmp_len))) {
host = hp->h_name;
} else {
host = inet_ntoa(who->sin_addr);
@@ -927,6 +936,7 @@ telnet(f, p, host)
char *HN;
char *IM;
void netflush();
+ int nfd;
/*
* Initialize the slc mapping table.
@@ -1156,6 +1166,7 @@ telnet(f, p, host)
startslave(host);
#endif
+ nfd = ((f > p) ? f : p) + 1;
for (;;) {
fd_set ibits, obits, xbits;
register int c;
@@ -1187,7 +1198,7 @@ telnet(f, p, host)
if (!SYNCHing) {
FD_SET(f, &xbits);
}
- if ((c = select(16, &ibits, &obits, &xbits,
+ if ((c = select(nfd, &ibits, &obits, &xbits,
(struct timeval *)0)) < 1) {
if (c == -1) {
if (errno == EINTR) {
@@ -1326,6 +1337,9 @@ telnet(f, p, host)
*nfrontp++ = IAC;
*nfrontp++ = DM;
neturg = nfrontp-1; /* off by one XXX */
+ DIAG(TD_OPTIONS,
+ printoption("td: send IAC", DM));
+
#endif
}
if (his_state_is_will(TELOPT_LFLOW) &&
@@ -1342,6 +1356,9 @@ telnet(f, p, host)
: LFLOW_OFF,
IAC, SE);
nfrontp += 6;
+ DIAG(TD_OPTIONS, printsub('>',
+ (unsigned char *)nfrontp-4,
+ 4););
}
}
pcc--;
@@ -1507,6 +1524,14 @@ interrupt()
{
ptyflush(); /* half-hearted */
+#if defined(STREAMSPTY) && defined(TIOCSIGNAL)
+ /* Streams PTY style ioctl to post a signal */
+ {
+ int sig = SIGINT;
+ (void) ioctl(pty, TIOCSIGNAL, &sig);
+ (void) ioctl(pty, I_FLUSH, FLUSHR);
+ }
+#else
#ifdef TCSIG
(void) ioctl(pty, TCSIG, (char *)SIGINT);
#else /* TCSIG */
@@ -1514,6 +1539,7 @@ interrupt()
*pfrontp++ = slctab[SLC_IP].sptr ?
(unsigned char)*slctab[SLC_IP].sptr : '\177';
#endif /* TCSIG */
+#endif
}
/*
diff --git a/secure/libexec/telnetd/termstat.c b/secure/libexec/telnetd/termstat.c
index ec68442..ebc843a 100644
--- a/secure/libexec/telnetd/termstat.c
+++ b/secure/libexec/telnetd/termstat.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)termstat.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)termstat.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
@@ -632,7 +632,7 @@ defer_terminit()
if (def_col || def_row) {
struct winsize ws;
- bzero((char *)&ws, sizeof(ws));
+ memset((char *)&ws, 0, sizeof(ws));
ws.ws_col = def_col;
ws.ws_row = def_row;
(void) ioctl(pty, TIOCSWINSZ, (char *)&ws);
diff --git a/secure/libexec/telnetd/utility.c b/secure/libexec/telnetd/utility.c
index c24feb3..049fcd1 100644
--- a/secure/libexec/telnetd/utility.c
+++ b/secure/libexec/telnetd/utility.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)utility.c 8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
#endif /* not lint */
#define PRINTOPTIONS
@@ -220,7 +220,7 @@ netclear()
next = nextitem(next);
} while (wewant(next) && (nfrontp > next));
length = next-thisitem;
- bcopy(thisitem, good, length);
+ memmove(good, thisitem, length);
good += length;
thisitem = next;
} else {
@@ -327,7 +327,7 @@ writenet(ptr, len)
netflush();
}
- bcopy(ptr, nfrontp, len);
+ memmove(nfrontp, ptr, len);
nfrontp += len;
} /* end of writenet */
@@ -368,7 +368,7 @@ fatalperror(f, msg)
{
char buf[BUFSIZ], *strerror();
- (void) sprintf(buf, "%s: %s\r\n", msg, strerror(errno));
+ (void) sprintf(buf, "%s: %s", msg, strerror(errno));
fatal(f, buf);
}
@@ -449,9 +449,9 @@ putf(cp, where)
time_t t;
char db[100];
#ifdef STREAMSPTY
- extern char *index();
+ extern char *strchr();
#else
- extern char *rindex();
+ extern char *strrchr();
#endif
putlocation = where;
@@ -466,9 +466,9 @@ putf(cp, where)
case 't':
#ifdef STREAMSPTY
/* names are like /dev/pts/2 -- we want pts/2 */
- slash = index(line+1, '/');
+ slash = strchr(line+1, '/');
#else
- slash = rindex(line, '/');
+ slash = strrchr(line, '/');
#endif
if (slash == (char *) 0)
putstr(line);
diff --git a/secure/usr.bin/telnet/Makefile b/secure/usr.bin/telnet/Makefile
index 1c8bd26..1f4b288 100644
--- a/secure/usr.bin/telnet/Makefile
+++ b/secure/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/secure/usr.bin/telnet/commands.c b/secure/usr.bin/telnet/commands.c
index 3b7ee7b..a6967b5 100644
--- a/secure/usr.bin/telnet/commands.c
+++ b/secure/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/secure/usr.bin/telnet/externs.h b/secure/usr.bin/telnet/externs.h
index b721992..7c52be9 100644
--- a/secure/usr.bin/telnet/externs.h
+++ b/secure/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/secure/usr.bin/telnet/main.c b/secure/usr.bin/telnet/main.c
index e802271..09ac26c 100644
--- a/secure/usr.bin/telnet/main.c
+++ b/secure/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/secure/usr.bin/telnet/ring.c b/secure/usr.bin/telnet/ring.c
index 1080d12..37dfda8 100644
--- a/secure/usr.bin/telnet/ring.c
+++ b/secure/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/secure/usr.bin/telnet/sys_bsd.c b/secure/usr.bin/telnet/sys_bsd.c
index c55f85a..3ede7c4 100644
--- a/secure/usr.bin/telnet/sys_bsd.c
+++ b/secure/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/secure/usr.bin/telnet/telnet.1 b/secure/usr.bin/telnet/telnet.1
index 27079d9..b996fea 100644
--- a/secure/usr.bin/telnet/telnet.1
+++ b/secure/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/secure/usr.bin/telnet/telnet.c b/secure/usr.bin/telnet/telnet.c
index 687ac83..4402fdd 100644
--- a/secure/usr.bin/telnet/telnet.c
+++ b/secure/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/secure/usr.bin/telnet/terminal.c b/secure/usr.bin/telnet/terminal.c
index b6d3b86..b5ceeda 100644
--- a/secure/usr.bin/telnet/terminal.c
+++ b/secure/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/secure/usr.bin/telnet/tn3270.c b/secure/usr.bin/telnet/tn3270.c
index 1f285cf..a75cd1e 100644
--- a/secure/usr.bin/telnet/tn3270.c
+++ b/secure/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/secure/usr.bin/telnet/utilities.c b/secure/usr.bin/telnet/utilities.c
index 2f451ca..06d08a4 100644
--- a/secure/usr.bin/telnet/utilities.c
+++ b/secure/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