First round of moving secure telnet (AKA kerberised telnet) to its new home
in eBones/. Peter has already (ages ago) done the repository copy. These are mainly -Wall cleanups. The makefile changes will follow in a day or so.
This commit is contained in:
parent
2c80f2dbdb
commit
4d188f4586
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19195
@ -1,8 +1,14 @@
|
||||
# From: @(#)Makefile.inc 5.1 (Berkeley) 6/25/90
|
||||
# $Id: Makefile.inc,v 1.11 1996/06/24 04:22:24 jkh Exp $
|
||||
# $Id$
|
||||
|
||||
DISTRIBUTION= krb
|
||||
|
||||
.if exists(${.CURDIR}/../../lib/libtelnet/obj)
|
||||
TELNETOBJDIR= ${.CURDIR}/../../lib/libtelnet/obj
|
||||
.else
|
||||
TELNETOBJDIR= ${.CURDIR}/../../lib/libtelnet
|
||||
.endif
|
||||
|
||||
.if exists(${.OBJDIR}/../../../secure/lib/libdes)
|
||||
DESOBJDIR= ${.OBJDIR}/../../../secure/lib/libdes
|
||||
.else
|
||||
|
@ -75,6 +75,10 @@ void auth_finished P((Authenticator *, int));
|
||||
int auth_wait P((char *));
|
||||
void auth_disable_name P((char *));
|
||||
void auth_gen_printsub P((unsigned char *, int, unsigned char *, int));
|
||||
void auth_name P((unsigned char *, int));
|
||||
void auth_printsub P((unsigned char *, int, unsigned char *, int));
|
||||
int auth_sendname P((unsigned char *, int));
|
||||
void auth_encrypt_user P((char *));
|
||||
|
||||
#ifdef KRB4
|
||||
int kerberos4_init P((Authenticator *, int));
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)auth.c 8.3 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)auth.c 8.3 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -64,6 +64,7 @@ static char sccsid[] = "@(#)auth.c 8.3 (Berkeley) 5/30/95";
|
||||
#include <arpa/telnet.h>
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef NO_STRING_H
|
||||
#include <strings.h>
|
||||
@ -106,6 +107,9 @@ static unsigned char _auth_send_data[256];
|
||||
static unsigned char *auth_send_data;
|
||||
static int auth_send_cnt = 0;
|
||||
|
||||
int auth_onoff(char *type, int on);
|
||||
void auth_encrypt_user(char *name);
|
||||
|
||||
/*
|
||||
* Authentication types supported. Plese note that these are stored
|
||||
* in priority order, i.e. try the first one first.
|
||||
@ -500,7 +504,7 @@ auth_is(data, cnt)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ap = findauthenticator(data[0], data[1])) {
|
||||
if ((ap = findauthenticator(data[0], data[1]))) {
|
||||
if (ap->is)
|
||||
(*ap->is)(ap, data+2, cnt-2);
|
||||
} else if (auth_debug_mode)
|
||||
@ -518,7 +522,7 @@ auth_reply(data, cnt)
|
||||
if (cnt < 2)
|
||||
return;
|
||||
|
||||
if (ap = findauthenticator(data[0], data[1])) {
|
||||
if ((ap = findauthenticator(data[0], data[1]))) {
|
||||
if (ap->reply)
|
||||
(*ap->reply)(ap, data+2, cnt-2);
|
||||
} else if (auth_debug_mode)
|
||||
@ -531,7 +535,6 @@ auth_name(data, cnt)
|
||||
unsigned char *data;
|
||||
int cnt;
|
||||
{
|
||||
Authenticator *ap;
|
||||
unsigned char savename[256];
|
||||
|
||||
if (cnt < 1) {
|
||||
|
@ -79,11 +79,17 @@ void encrypt_send_end P((void));
|
||||
void encrypt_wait P((void));
|
||||
void encrypt_send_support P((void));
|
||||
void encrypt_send_keyid P((int, unsigned char *, int, int));
|
||||
void encrypt_start P((unsigned char *, int));
|
||||
void encrypt_end P((void));
|
||||
void encrypt_support P((unsigned char *, int));
|
||||
void encrypt_request_start P((unsigned char *, int));
|
||||
void encrypt_request_end P((void));
|
||||
void encrypt_enc_keyid P((unsigned char *, int));
|
||||
void encrypt_dec_keyid P((unsigned char *, int));
|
||||
void encrypt_printsub P((unsigned char *, int, unsigned char *, int));
|
||||
int net_write P((unsigned char *, int));
|
||||
|
||||
#ifdef TELENTD
|
||||
void encrypt_wait P((void));
|
||||
#else
|
||||
#ifndef TELENTD
|
||||
int encrypt_cmd P((int, char **));
|
||||
void encrypt_display P((void));
|
||||
#endif
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)enc_des.c 8.3 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)enc_des.c 8.3 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifdef ENCRYPTION
|
||||
@ -44,6 +44,8 @@ static char sccsid[] = "@(#)enc_des.c 8.3 (Berkeley) 5/30/95";
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <des.h>
|
||||
#include <string.h>
|
||||
#include "encrypt.h"
|
||||
#include "key-proto.h"
|
||||
#include "misc-proto.h"
|
||||
@ -180,7 +182,6 @@ fb64_start(fbp, dir, server)
|
||||
int dir;
|
||||
int server;
|
||||
{
|
||||
Block b;
|
||||
int x;
|
||||
unsigned char *p;
|
||||
register int state;
|
||||
@ -215,8 +216,8 @@ fb64_start(fbp, dir, server)
|
||||
/*
|
||||
* Create a random feed and send it over.
|
||||
*/
|
||||
des_new_random_key(fbp->temp_feed);
|
||||
des_ecb_encrypt(fbp->temp_feed, fbp->temp_feed,
|
||||
des_new_random_key((Block *)fbp->temp_feed);
|
||||
des_ecb_encrypt((Block *)fbp->temp_feed, (Block *)fbp->temp_feed,
|
||||
fbp->krbdes_sched, 1);
|
||||
p = fbp->fb_feed + 3;
|
||||
*p++ = ENCRYPT_IS;
|
||||
@ -264,9 +265,7 @@ fb64_is(data, cnt, fbp)
|
||||
int cnt;
|
||||
struct fb *fbp;
|
||||
{
|
||||
int x;
|
||||
unsigned char *p;
|
||||
Block b;
|
||||
register int state = fbp->state[DIR_DECRYPT-1];
|
||||
|
||||
if (cnt-- < 1)
|
||||
@ -356,9 +355,6 @@ fb64_reply(data, cnt, fbp)
|
||||
int cnt;
|
||||
struct fb *fbp;
|
||||
{
|
||||
int x;
|
||||
unsigned char *p;
|
||||
Block b;
|
||||
register int state = fbp->state[DIR_ENCRYPT-1];
|
||||
|
||||
if (cnt-- < 1)
|
||||
@ -428,10 +424,10 @@ fb64_session(key, server, fbp)
|
||||
fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_DECRYPT-1]);
|
||||
|
||||
if (fbp->once == 0) {
|
||||
des_set_random_generator_seed(fbp->krbdes_key);
|
||||
des_set_random_generator_seed((Block *)fbp->krbdes_key);
|
||||
fbp->once = 1;
|
||||
}
|
||||
des_key_sched(fbp->krbdes_key, fbp->krbdes_sched);
|
||||
des_key_sched((Block *)fbp->krbdes_key, fbp->krbdes_sched);
|
||||
/*
|
||||
* Now look to see if krbdes_start() was was waiting for
|
||||
* the key to show up. If so, go ahead an call it now
|
||||
@ -552,7 +548,7 @@ fb64_stream_iv(seed, stp)
|
||||
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);
|
||||
des_key_sched((Block *)stp->str_ikey, stp->str_sched);
|
||||
|
||||
stp->str_index = sizeof(Block);
|
||||
}
|
||||
@ -563,7 +559,7 @@ fb64_stream_key(key, stp)
|
||||
register struct stinfo *stp;
|
||||
{
|
||||
memmove((void *)stp->str_ikey, (void *)key, sizeof(Block));
|
||||
des_key_sched(key, stp->str_sched);
|
||||
des_key_sched((Block *)key, stp->str_sched);
|
||||
|
||||
memmove((void *)stp->str_output, (void *)stp->str_iv, sizeof(Block));
|
||||
|
||||
@ -604,7 +600,7 @@ cfb64_encrypt(s, c)
|
||||
while (c-- > 0) {
|
||||
if (index == sizeof(Block)) {
|
||||
Block b;
|
||||
des_ecb_encrypt(stp->str_output, b, stp->str_sched, 1);
|
||||
des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
|
||||
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
|
||||
index = 0;
|
||||
}
|
||||
@ -638,7 +634,7 @@ cfb64_decrypt(data)
|
||||
index = stp->str_index++;
|
||||
if (index == sizeof(Block)) {
|
||||
Block b;
|
||||
des_ecb_encrypt(stp->str_output, b, stp->str_sched, 1);
|
||||
des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
|
||||
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
|
||||
stp->str_index = 1; /* Next time will be 1 */
|
||||
index = 0; /* But now use 0 */
|
||||
@ -680,7 +676,7 @@ ofb64_encrypt(s, c)
|
||||
while (c-- > 0) {
|
||||
if (index == sizeof(Block)) {
|
||||
Block b;
|
||||
des_ecb_encrypt(stp->str_feed, b, stp->str_sched, 1);
|
||||
des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
|
||||
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
|
||||
index = 0;
|
||||
}
|
||||
@ -711,7 +707,7 @@ ofb64_decrypt(data)
|
||||
index = stp->str_index++;
|
||||
if (index == sizeof(Block)) {
|
||||
Block b;
|
||||
des_ecb_encrypt(stp->str_feed, b, stp->str_sched, 1);
|
||||
des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
|
||||
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
|
||||
stp->str_index = 1; /* Next time will be 1 */
|
||||
index = 0; /* But now use 0 */
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)encrypt.c 8.2 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)encrypt.c 8.2 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -58,6 +58,7 @@ static char sccsid[] = "@(#)encrypt.c 8.2 (Berkeley) 5/30/95";
|
||||
#ifdef ENCRYPTION
|
||||
|
||||
#define ENCRYPT_NAMES
|
||||
#include <stdio.h>
|
||||
#include <arpa/telnet.h>
|
||||
|
||||
#include "encrypt.h"
|
||||
@ -79,6 +80,18 @@ static char sccsid[] = "@(#)encrypt.c 8.2 (Berkeley) 5/30/95";
|
||||
void (*encrypt_output) P((unsigned char *, int));
|
||||
int (*decrypt_input) P((int));
|
||||
|
||||
int EncryptType(char *type, char *mode);
|
||||
int EncryptStart(char *mode);
|
||||
int EncryptStop(char *mode);
|
||||
int EncryptStartInput(void);
|
||||
int EncryptStartOutput(void);
|
||||
int EncryptStopInput(void);
|
||||
int EncryptStopOutput(void);
|
||||
|
||||
int Ambiguous(char **s);
|
||||
int isprefix(char *s1, char *s2);
|
||||
char **genget(char *name, char **table, int stlen);
|
||||
|
||||
int encrypt_debug_mode = 0;
|
||||
static int decrypt_mode = 0;
|
||||
static int encrypt_mode = 0;
|
||||
@ -174,6 +187,8 @@ static struct key_info {
|
||||
{ { 0 }, 0, DIR_DECRYPT, &decrypt_mode, finddecryption },
|
||||
};
|
||||
|
||||
static void encrypt_keyid(struct key_info *kp, unsigned char *keyid, int len);
|
||||
|
||||
void
|
||||
encrypt_init(name, server)
|
||||
char *name;
|
||||
@ -248,10 +263,10 @@ EncryptDisable(type, mode)
|
||||
if (isprefix(type, "help") || isprefix(type, "?")) {
|
||||
printf("Usage: encrypt disable <type> [input|output]\n");
|
||||
encrypt_list_types();
|
||||
} else if ((ep = (Encryptions *)genget(type, encryptions,
|
||||
} else if ((ep = (Encryptions *)genget(type, (char **)encryptions,
|
||||
sizeof(Encryptions))) == 0) {
|
||||
printf("%s: invalid encryption type\n", type);
|
||||
} else if (Ambiguous(ep)) {
|
||||
} else if (Ambiguous((char **)ep)) {
|
||||
printf("Ambiguous type '%s'\n", type);
|
||||
} else {
|
||||
if ((mode == 0) || (isprefix(mode, "input") ? 1 : 0)) {
|
||||
@ -283,10 +298,10 @@ EncryptType(type, mode)
|
||||
if (isprefix(type, "help") || isprefix(type, "?")) {
|
||||
printf("Usage: encrypt type <type> [input|output]\n");
|
||||
encrypt_list_types();
|
||||
} else if ((ep = (Encryptions *)genget(type, encryptions,
|
||||
} else if ((ep = (Encryptions *)genget(type, (char **)encryptions,
|
||||
sizeof(Encryptions))) == 0) {
|
||||
printf("%s: invalid encryption type\n", type);
|
||||
} else if (Ambiguous(ep)) {
|
||||
} else if (Ambiguous((char **)ep)) {
|
||||
printf("Ambiguous type '%s'\n", type);
|
||||
} else {
|
||||
if ((mode == 0) || isprefix(mode, "input")) {
|
||||
@ -559,7 +574,7 @@ encrypt_is(data, cnt)
|
||||
} else {
|
||||
ret = (*ep->is)(data, cnt);
|
||||
if (encrypt_debug_mode)
|
||||
printf("(*ep->is)(%x, %d) returned %s(%d)\n", data, cnt,
|
||||
printf("(*ep->is)(%p, %d) returned %s(%d)\n", data, cnt,
|
||||
(ret < 0) ? "FAIL " :
|
||||
(ret == 0) ? "SUCCESS " : "MORE_TO_DO ", ret);
|
||||
}
|
||||
@ -603,7 +618,7 @@ encrypt_reply(data, cnt)
|
||||
} else {
|
||||
ret = (*ep->reply)(data, cnt);
|
||||
if (encrypt_debug_mode)
|
||||
printf("(*ep->reply)(%x, %d) returned %s(%d)\n",
|
||||
printf("(*ep->reply)(%p, %d) returned %s(%d)\n",
|
||||
data, cnt,
|
||||
(ret < 0) ? "FAIL " :
|
||||
(ret == 0) ? "SUCCESS " : "MORE_TO_DO ", ret);
|
||||
@ -641,7 +656,7 @@ encrypt_start(data, cnt)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ep = finddecryption(decrypt_mode)) {
|
||||
if ((ep = finddecryption(decrypt_mode))) {
|
||||
decrypt_input = ep->input;
|
||||
if (encrypt_verbose)
|
||||
printf("[ Input is now decrypted with type %s ]\r\n",
|
||||
@ -725,6 +740,7 @@ encrypt_request_start(data, cnt)
|
||||
|
||||
static unsigned char str_keyid[(MAXKEYLEN*2)+5] = { IAC, SB, TELOPT_ENCRYPT };
|
||||
|
||||
void
|
||||
encrypt_enc_keyid(keyid, len)
|
||||
unsigned char *keyid;
|
||||
int len;
|
||||
@ -732,6 +748,7 @@ encrypt_enc_keyid(keyid, len)
|
||||
encrypt_keyid(&ki[1], keyid, len);
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_dec_keyid(keyid, len)
|
||||
unsigned char *keyid;
|
||||
int len;
|
||||
@ -739,13 +756,13 @@ encrypt_dec_keyid(keyid, len)
|
||||
encrypt_keyid(&ki[0], keyid, len);
|
||||
}
|
||||
|
||||
void
|
||||
encrypt_keyid(kp, keyid, len)
|
||||
struct key_info *kp;
|
||||
unsigned char *keyid;
|
||||
int len;
|
||||
{
|
||||
Encryptions *ep;
|
||||
unsigned char *strp, *cp;
|
||||
int dir = kp->dir;
|
||||
register int ret = 0;
|
||||
|
||||
@ -942,7 +959,6 @@ encrypt_send_request_end()
|
||||
void
|
||||
encrypt_wait()
|
||||
{
|
||||
register int encrypt, decrypt;
|
||||
if (encrypt_debug_mode)
|
||||
printf(">>>%s: in encrypt_wait\r\n", Name);
|
||||
if (!havesessionkey || !(I_SUPPORT_ENCRYPT & remote_supports_decrypt))
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)genget.c 8.2 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)genget.c 8.2 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@ -49,7 +49,6 @@ static char sccsid[] = "@(#)genget.c 8.2 (Berkeley) 5/30/95";
|
||||
isprefix(s1, s2)
|
||||
register char *s1, *s2;
|
||||
{
|
||||
register int n = 0;
|
||||
char *os1;
|
||||
register char c1, c2;
|
||||
|
||||
@ -99,7 +98,7 @@ genget(name, table, stlen)
|
||||
*/
|
||||
int
|
||||
Ambiguous(s)
|
||||
char *s;
|
||||
char **s;
|
||||
{
|
||||
return((char **)s == &ambiguous);
|
||||
return(s == &ambiguous);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)kerberos.c 8.3 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)kerberos.c 8.3 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -81,8 +81,6 @@ extern auth_debug_mode;
|
||||
|
||||
static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0,
|
||||
AUTHTYPE_KERBEROS_V4, };
|
||||
static unsigned char str_name[1024] = { IAC, SB, TELOPT_AUTHENTICATION,
|
||||
TELQUAL_NAME, };
|
||||
|
||||
#define KRB_AUTH 0 /* Authentication data follows */
|
||||
#define KRB_REJECT 1 /* Rejected (reason might follow) */
|
||||
@ -162,9 +160,6 @@ kerberos4_send(ap)
|
||||
Authenticator *ap;
|
||||
{
|
||||
KTEXT_ST auth;
|
||||
#ifdef ENCRYPTION
|
||||
Block enckey;
|
||||
#endif /* ENCRYPTION */
|
||||
char instance[INST_SZ];
|
||||
char *realm;
|
||||
char *krb_realmofhost();
|
||||
@ -182,7 +177,7 @@ kerberos4_send(ap)
|
||||
|
||||
memset(instance, 0, sizeof(instance));
|
||||
|
||||
if (realm = krb_get_phost(RemoteHostName))
|
||||
if ((realm = krb_get_phost(RemoteHostName)))
|
||||
strncpy(instance, realm, sizeof(instance));
|
||||
|
||||
instance[sizeof(instance)-1] = '\0';
|
||||
@ -193,11 +188,11 @@ kerberos4_send(ap)
|
||||
printf("Kerberos V4: no realm for %s\r\n", RemoteHostName);
|
||||
return(0);
|
||||
}
|
||||
if (r = krb_mk_req(&auth, KRB_SERVICE_NAME, instance, realm, 0L)) {
|
||||
if ((r = krb_mk_req(&auth, KRB_SERVICE_NAME, instance, realm, 0L))) {
|
||||
printf("mk_req failed: %s\r\n", krb_err_txt[r]);
|
||||
return(0);
|
||||
}
|
||||
if (r = krb_get_cred(KRB_SERVICE_NAME, instance, realm, &cred)) {
|
||||
if ((r = krb_get_cred(KRB_SERVICE_NAME, instance, realm, &cred))) {
|
||||
printf("get_cred failed: %s\r\n", krb_err_txt[r]);
|
||||
return(0);
|
||||
}
|
||||
@ -283,8 +278,8 @@ kerberos4_is(ap, data, cnt)
|
||||
printf("\r\n");
|
||||
}
|
||||
instance[0] = '*'; instance[1] = 0;
|
||||
if (r = krb_rd_req(&auth, KRB_SERVICE_NAME,
|
||||
instance, 0, &adat, "")) {
|
||||
if ((r = krb_rd_req(&auth, KRB_SERVICE_NAME,
|
||||
instance, 0, &adat, ""))) {
|
||||
if (auth_debug_mode)
|
||||
printf("Kerberos failed him as %s\r\n", name);
|
||||
Data(ap, KRB_REJECT, (void *)krb_err_txt[r], -1);
|
||||
|
@ -32,10 +32,14 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/4/93";
|
||||
static const char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "misc.h"
|
||||
#include "auth.h"
|
||||
#include "encrypt.h"
|
||||
|
||||
char *RemoteHostName;
|
||||
char *LocalHostName;
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)authenc.c 8.2 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)authenc.c 8.2 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)global.c 8.1 (Berkeley) 6/4/93";
|
||||
static const char sccsid[] = "@(#)global.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)slc.c 8.2 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)slc.c 8.2 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "telnetd.h"
|
||||
@ -288,15 +288,15 @@ change_slc(func, flag, val)
|
||||
register int hislevel, mylevel;
|
||||
|
||||
hislevel = flag & SLC_LEVELBITS;
|
||||
mylevel = slctab[func].defset.flag & SLC_LEVELBITS;
|
||||
mylevel = slctab[(int)func].defset.flag & SLC_LEVELBITS;
|
||||
/*
|
||||
* If client is setting a function to NOSUPPORT
|
||||
* or DEFAULT, then we can easily and directly
|
||||
* accomodate the request.
|
||||
*/
|
||||
if (hislevel == SLC_NOSUPPORT) {
|
||||
slctab[func].current.flag = flag;
|
||||
slctab[func].current.val = (cc_t)_POSIX_VDISABLE;
|
||||
slctab[(int)func].current.flag = flag;
|
||||
slctab[(int)func].current.val = (cc_t)_POSIX_VDISABLE;
|
||||
flag |= SLC_ACK;
|
||||
add_slc(func, flag, val);
|
||||
return;
|
||||
@ -309,13 +309,13 @@ change_slc(func, flag, val)
|
||||
* default level of DEFAULT.
|
||||
*/
|
||||
if (mylevel == SLC_DEFAULT) {
|
||||
slctab[func].current.flag = SLC_NOSUPPORT;
|
||||
slctab[(int)func].current.flag = SLC_NOSUPPORT;
|
||||
} else {
|
||||
slctab[func].current.flag = slctab[func].defset.flag;
|
||||
slctab[(int)func].current.flag = slctab[(int)func].defset.flag;
|
||||
}
|
||||
slctab[func].current.val = slctab[func].defset.val;
|
||||
add_slc(func, slctab[func].current.flag,
|
||||
slctab[func].current.val);
|
||||
slctab[(int)func].current.val = slctab[(int)func].defset.val;
|
||||
add_slc(func, slctab[(int)func].current.flag,
|
||||
slctab[(int)func].current.val);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -329,13 +329,13 @@ change_slc(func, flag, val)
|
||||
* the place to put the new value, so change it,
|
||||
* otherwise, continue the negotiation.
|
||||
*/
|
||||
if (slctab[func].sptr) {
|
||||
if (slctab[(int)func].sptr) {
|
||||
/*
|
||||
* We can change this one.
|
||||
*/
|
||||
slctab[func].current.val = val;
|
||||
*(slctab[func].sptr) = val;
|
||||
slctab[func].current.flag = flag;
|
||||
slctab[(int)func].current.val = val;
|
||||
*(slctab[(int)func].sptr) = val;
|
||||
slctab[(int)func].current.flag = flag;
|
||||
flag |= SLC_ACK;
|
||||
slcchange = 1;
|
||||
add_slc(func, flag, val);
|
||||
@ -355,22 +355,22 @@ change_slc(func, flag, val)
|
||||
* our value as well.
|
||||
*/
|
||||
if (mylevel == SLC_DEFAULT) {
|
||||
slctab[func].current.flag = flag;
|
||||
slctab[func].current.val = val;
|
||||
slctab[(int)func].current.flag = flag;
|
||||
slctab[(int)func].current.val = val;
|
||||
flag |= SLC_ACK;
|
||||
} else if (hislevel == SLC_CANTCHANGE &&
|
||||
mylevel == SLC_CANTCHANGE) {
|
||||
flag &= ~SLC_LEVELBITS;
|
||||
flag |= SLC_NOSUPPORT;
|
||||
slctab[func].current.flag = flag;
|
||||
slctab[(int)func].current.flag = flag;
|
||||
} else {
|
||||
flag &= ~SLC_LEVELBITS;
|
||||
flag |= mylevel;
|
||||
slctab[func].current.flag = flag;
|
||||
slctab[(int)func].current.flag = flag;
|
||||
if (mylevel == SLC_CANTCHANGE) {
|
||||
slctab[func].current.val =
|
||||
slctab[func].defset.val;
|
||||
val = slctab[func].current.val;
|
||||
slctab[(int)func].current.val =
|
||||
slctab[(int)func].defset.val;
|
||||
val = slctab[(int)func].current.val;
|
||||
}
|
||||
}
|
||||
add_slc(func, flag, val);
|
||||
|
@ -32,13 +32,16 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)state.c 8.5 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)state.c 8.5 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "telnetd.h"
|
||||
#if defined(AUTHENTICATION)
|
||||
#include <libtelnet/auth.h>
|
||||
#endif
|
||||
#if defined(ENCRYPTION)
|
||||
#include <libtelnet/encrypt.h>
|
||||
#endif
|
||||
|
||||
unsigned char doopt[] = { IAC, DO, '%', 'c', 0 };
|
||||
unsigned char dont[] = { IAC, DONT, '%', 'c', 0 };
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "telnetd.h"
|
||||
@ -43,6 +43,8 @@ static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
|
||||
#endif
|
||||
|
||||
extern char *altlogin;
|
||||
int cleanopen(char *line);
|
||||
void scrub_env(void);
|
||||
|
||||
#if defined(CRAY) || defined(__hpux)
|
||||
# define PARENT_DOES_UTMP
|
||||
@ -75,6 +77,8 @@ char utmpf[] = "/etc/utmp";
|
||||
char wtmpf[] = "/etc/wtmp";
|
||||
# endif /* PARENT_DOES_UTMP */
|
||||
|
||||
#include <libutil.h>
|
||||
|
||||
# ifdef CRAY
|
||||
#include <tmpdir.h>
|
||||
#include <sys/wait.h>
|
||||
@ -1074,7 +1078,7 @@ extern void utmp_sig_notify P((int));
|
||||
* that is necessary. The return value is a file descriptor
|
||||
* for the slave side.
|
||||
*/
|
||||
int
|
||||
void
|
||||
getptyslave()
|
||||
{
|
||||
register int t = -1;
|
||||
@ -1397,7 +1401,6 @@ startslave(host, autologin, autoname)
|
||||
{
|
||||
register int i;
|
||||
long time();
|
||||
char name[256];
|
||||
#ifdef NEWINIT
|
||||
extern char *ptyip;
|
||||
struct init_request request;
|
||||
@ -1530,7 +1533,7 @@ init_env()
|
||||
char **envp;
|
||||
|
||||
envp = envinit;
|
||||
if (*envp = getenv("TZ"))
|
||||
if ((*envp = getenv("TZ")))
|
||||
*envp++ -= 3;
|
||||
#if defined(CRAY) || defined(__hpux)
|
||||
else
|
||||
@ -1555,7 +1558,6 @@ start_login(host, autologin, name)
|
||||
int autologin;
|
||||
char *name;
|
||||
{
|
||||
register char *cp;
|
||||
register char **argv;
|
||||
char **addarg(), *user;
|
||||
extern char *getenv();
|
||||
@ -1742,7 +1744,7 @@ start_login(host, autologin, name)
|
||||
# endif
|
||||
} else
|
||||
#endif
|
||||
if (user = getenv("USER")) {
|
||||
if ((user = getenv("USER"))) {
|
||||
if (strchr(user, '-')) {
|
||||
syslog(LOG_ERR, "tried to pass user \"%s\" to login",
|
||||
user);
|
||||
@ -1834,6 +1836,7 @@ addarg(argv, val)
|
||||
* Remove a few things from the environment that
|
||||
* don't need to be there.
|
||||
*/
|
||||
void
|
||||
scrub_env()
|
||||
{
|
||||
register char **cpp, **cpp2;
|
||||
|
@ -32,13 +32,13 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
static const char copyright[] =
|
||||
"@(#) Copyright (c) 1989, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "telnetd.h"
|
||||
@ -75,6 +75,10 @@ struct socket_security ss;
|
||||
#include <libtelnet/auth.h>
|
||||
int auth_level = 0;
|
||||
#endif
|
||||
#if defined(ENCRYPTION)
|
||||
#include <libtelnet/encrypt.h>
|
||||
#endif
|
||||
#include <libtelnet/misc.h>
|
||||
#if defined(SecurID)
|
||||
int require_SecurID = 0;
|
||||
#endif
|
||||
@ -101,8 +105,6 @@ char ptyibuf2[BUFSIZ];
|
||||
unsigned char ctlbuf[BUFSIZ];
|
||||
struct strbuf strbufc, strbufd;
|
||||
|
||||
int readstream();
|
||||
|
||||
#else /* ! STREAMPTY */
|
||||
|
||||
/*
|
||||
@ -112,6 +114,13 @@ int readstream();
|
||||
char ptyibuf[BUFSIZ], *ptyip = ptyibuf;
|
||||
char ptyibuf2[BUFSIZ];
|
||||
|
||||
# include <termcap.h>
|
||||
|
||||
int readstream(int p, char *ibuf, int bufsize);
|
||||
void doit(struct sockaddr_in *who);
|
||||
int terminaltypeok(char *s);
|
||||
void startslave(char *host, int autologin, char *autoname);
|
||||
|
||||
#endif /* ! STREAMPTY */
|
||||
|
||||
int hostinfo = 1; /* do we print login banner? */
|
||||
@ -390,7 +399,7 @@ main(argc, argv)
|
||||
usage();
|
||||
/* NOT REACHED */
|
||||
} else if (argc == 1) {
|
||||
if (sp = getservbyname(*argv, "tcp")) {
|
||||
if ((sp = getservbyname(*argv, "tcp"))) {
|
||||
sin.sin_port = sp->s_port;
|
||||
} else {
|
||||
sin.sin_port = atoi(*argv);
|
||||
@ -792,11 +801,11 @@ char user_name[256];
|
||||
/*
|
||||
* Get a pty, scan input lines.
|
||||
*/
|
||||
void
|
||||
doit(who)
|
||||
struct sockaddr_in *who;
|
||||
{
|
||||
char *host, *inet_ntoa();
|
||||
int t;
|
||||
struct hostent *hp;
|
||||
int ptynum;
|
||||
|
||||
|
@ -32,11 +32,15 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)termstat.c 8.2 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)termstat.c 8.2 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "telnetd.h"
|
||||
|
||||
#if defined(ENCRYPTION)
|
||||
#include <libtelnet/encrypt.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* local variables
|
||||
*/
|
||||
@ -488,7 +492,7 @@ clientstat(code, parm1, parm2)
|
||||
ack = (useeditmode & MODE_ACK);
|
||||
useeditmode &= ~MODE_ACK;
|
||||
|
||||
if (changed = (useeditmode ^ editmode)) {
|
||||
if ((changed = (useeditmode ^ editmode))) {
|
||||
/*
|
||||
* This check is for a timing problem. If the
|
||||
* state of the tty has changed (due to the user
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
@ -41,6 +41,13 @@ static char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
|
||||
#define PRINTOPTIONS
|
||||
#include "telnetd.h"
|
||||
|
||||
#if defined(AUTHENTICATION)
|
||||
#include <libtelnet/auth.h>
|
||||
#endif
|
||||
#if defined(ENCRYPTION)
|
||||
#include <libtelnet/encrypt.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* utility functions performing io related tasks
|
||||
*/
|
||||
@ -949,7 +956,6 @@ printsub(direction, pointer, length)
|
||||
break;
|
||||
|
||||
default:
|
||||
def_case:
|
||||
if (isprint(pointer[i]) && pointer[i] != '"') {
|
||||
if (noquote) {
|
||||
*nfrontp++ = '"';
|
||||
@ -1120,12 +1126,12 @@ printsub(direction, pointer, length)
|
||||
break;
|
||||
|
||||
case ENCRYPT_ENC_KEYID:
|
||||
sprintf(nfrontp, " ENC_KEYID", pointer[1]);
|
||||
sprintf(nfrontp, " ENC_KEYID");
|
||||
nfrontp += strlen(nfrontp);
|
||||
goto encommon;
|
||||
|
||||
case ENCRYPT_DEC_KEYID:
|
||||
sprintf(nfrontp, " DEC_KEYID", pointer[1]);
|
||||
sprintf(nfrontp, " DEC_KEYID");
|
||||
nfrontp += strlen(nfrontp);
|
||||
goto encommon;
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)authenc.c 8.1 (Berkeley) 6/6/93";
|
||||
static const char sccsid[] = "@(#)authenc.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||
@ -101,7 +101,7 @@ telnet_gets(prompt, result, length, echo)
|
||||
if (echo) {
|
||||
printf("%s", prompt);
|
||||
res = fgets(result, length, stdin);
|
||||
} else if (res = getpass(prompt)) {
|
||||
} else if ((res = getpass(prompt))) {
|
||||
strncpy(result, res, length);
|
||||
res = result;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#if defined(unix)
|
||||
@ -56,6 +56,8 @@ static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||
#include <pwd.h>
|
||||
#include <varargs.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <arpa/telnet.h>
|
||||
|
||||
@ -67,6 +69,13 @@ static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
|
||||
#if defined(AUTHENTICATION)
|
||||
#include <libtelnet/auth.h>
|
||||
#endif
|
||||
#if defined(ENCRYPTION)
|
||||
#include <libtelnet/encrypt.h>
|
||||
#endif
|
||||
|
||||
#if !defined(CRAY) && !defined(sysV88)
|
||||
#include <netinet/in_systm.h>
|
||||
# if (defined(vax) || defined(tahoe) || defined(hp300)) && !defined(ultrix)
|
||||
@ -93,7 +102,11 @@ extern int isprefix();
|
||||
extern char **genget();
|
||||
extern int Ambiguous();
|
||||
|
||||
static call();
|
||||
static int help(int argc, char *argv[]);
|
||||
static int call();
|
||||
static void cmdrc(char *m1, char *m2);
|
||||
|
||||
int quit(void);
|
||||
|
||||
typedef struct {
|
||||
char *name; /* command name */
|
||||
@ -121,7 +134,7 @@ makeargv()
|
||||
margc++;
|
||||
cp++;
|
||||
}
|
||||
while (c = *cp) {
|
||||
while ((c = *cp)) {
|
||||
register int inquote = 0;
|
||||
while (isspace(c))
|
||||
c = *++cp;
|
||||
@ -164,7 +177,7 @@ makeargv()
|
||||
* Todo: 1. Could take random integers (12, 0x12, 012, 0b1).
|
||||
*/
|
||||
|
||||
static
|
||||
static int
|
||||
special(s)
|
||||
register char *s;
|
||||
{
|
||||
@ -293,7 +306,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;
|
||||
@ -1082,7 +1094,7 @@ unsetcmd(argc, argv)
|
||||
#ifdef KLUDGELINEMODE
|
||||
extern int kludgelinemode;
|
||||
|
||||
static int
|
||||
static void
|
||||
dokludgemode()
|
||||
{
|
||||
kludgelinemode = 1;
|
||||
@ -1139,7 +1151,7 @@ dolmmode(bit, on)
|
||||
}
|
||||
|
||||
int
|
||||
setmode(bit)
|
||||
setmod(bit)
|
||||
{
|
||||
return dolmmode(bit, 1);
|
||||
}
|
||||
@ -1171,17 +1183,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
|
||||
@ -1435,7 +1447,7 @@ extern int shell();
|
||||
#endif /* !defined(TN3270) */
|
||||
|
||||
/*VARARGS*/
|
||||
static
|
||||
static int
|
||||
bye(argc, argv)
|
||||
int argc; /* Number of arguments */
|
||||
char *argv[]; /* arguments */
|
||||
@ -1465,6 +1477,7 @@ bye(argc, argv)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
int
|
||||
quit()
|
||||
{
|
||||
(void) call(bye, "bye", "fromquit", 0);
|
||||
@ -1530,7 +1543,7 @@ getslc(name)
|
||||
genget(name, (char **) SlcList, sizeof(struct slclist));
|
||||
}
|
||||
|
||||
static
|
||||
static int
|
||||
slccmd(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
@ -1627,6 +1640,7 @@ getenvcmd(name)
|
||||
genget(name, (char **) EnvList, sizeof(struct envlist));
|
||||
}
|
||||
|
||||
int
|
||||
env_cmd(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
@ -1693,7 +1707,7 @@ env_init()
|
||||
extern char *strchr();
|
||||
|
||||
for (epp = environ; *epp; epp++) {
|
||||
if (cp = strchr(*epp, '=')) {
|
||||
if ((cp = strchr(*epp, '='))) {
|
||||
*cp = '\0';
|
||||
ep = env_define((unsigned char *)*epp,
|
||||
(unsigned char *)cp+1);
|
||||
@ -1738,7 +1752,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)
|
||||
@ -1764,7 +1778,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;
|
||||
@ -1782,7 +1796,7 @@ env_export(var)
|
||||
{
|
||||
register struct env_lst *ep;
|
||||
|
||||
if (ep = env_find(var))
|
||||
if ((ep = env_find(var)))
|
||||
ep->export = 1;
|
||||
}
|
||||
|
||||
@ -1792,7 +1806,7 @@ env_unexport(var)
|
||||
{
|
||||
register struct env_lst *ep;
|
||||
|
||||
if (ep = env_find(var))
|
||||
if ((ep = env_find(var)))
|
||||
ep->export = 0;
|
||||
}
|
||||
|
||||
@ -1842,10 +1856,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);
|
||||
}
|
||||
@ -1859,7 +1873,7 @@ env_getvalue(var)
|
||||
{
|
||||
register struct env_lst *ep;
|
||||
|
||||
if (ep = env_find(var))
|
||||
if ((ep = env_find(var)))
|
||||
return(ep->value);
|
||||
return(NULL);
|
||||
}
|
||||
@ -1949,6 +1963,7 @@ auth_help()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
auth_cmd(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
@ -2055,6 +2070,7 @@ EncryptHelp()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
encrypt_cmd(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
@ -2142,7 +2158,7 @@ filestuff(fd)
|
||||
* Print status about the connection.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static
|
||||
static int
|
||||
status(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
@ -2215,6 +2231,7 @@ status(argc, argv)
|
||||
/*
|
||||
* Function that gets called when SIGINFO is received.
|
||||
*/
|
||||
void
|
||||
ayt_status()
|
||||
{
|
||||
(void) call(status, "status", "notmuch", 0);
|
||||
@ -2437,8 +2454,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;
|
||||
@ -2487,8 +2504,6 @@ static char
|
||||
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 },
|
||||
@ -2521,7 +2536,7 @@ static Command cmdtab[] = {
|
||||
#endif
|
||||
{ "environ", envhelp, env_cmd, 0 },
|
||||
{ "?", helphelp, help, 0 },
|
||||
0
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static char crmodhelp[] = "deprecated command -- use 'toggle crmod' instead";
|
||||
@ -2531,7 +2546,7 @@ static Command cmdtab2[] = {
|
||||
{ "help", 0, help, 0 },
|
||||
{ "escape", escapehelp, setescape, 0 },
|
||||
{ "crmod", crmodhelp, togcrmod, 0 },
|
||||
0
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@ -2540,7 +2555,7 @@ static Command cmdtab2[] = {
|
||||
*/
|
||||
|
||||
/*VARARGS1*/
|
||||
static
|
||||
static int
|
||||
call(va_alist)
|
||||
va_dcl
|
||||
{
|
||||
@ -2566,7 +2581,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));
|
||||
}
|
||||
@ -2655,7 +2670,7 @@ command(top, tbuf, cnt)
|
||||
/*
|
||||
* Help command.
|
||||
*/
|
||||
static
|
||||
static int
|
||||
help(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
@ -2669,9 +2684,8 @@ help(argc, argv)
|
||||
printf("%-*s\t%s\n", HELPINDENT, c->name,
|
||||
c->help);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
while (--argc > 0) {
|
||||
else while (--argc > 0) {
|
||||
register char *arg;
|
||||
arg = *++argv;
|
||||
c = getcmd(arg);
|
||||
@ -2682,12 +2696,13 @@ help(argc, argv)
|
||||
else
|
||||
printf("%s\n", c->help);
|
||||
}
|
||||
return 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static char *rcname = 0;
|
||||
static char rcbuf[128];
|
||||
|
||||
void
|
||||
cmdrc(m1, m2)
|
||||
char *m1, *m2;
|
||||
{
|
||||
@ -2881,7 +2896,7 @@ sourceroute(arg, cpp, lenp)
|
||||
for (c = 0;;) {
|
||||
if (c == ':')
|
||||
cp2 = 0;
|
||||
else for (cp2 = cp; c = *cp2; cp2++) {
|
||||
else for (cp2 = cp; (c = *cp2); cp2++) {
|
||||
if (c == ',') {
|
||||
*cp2++ = '\0';
|
||||
if (*cp2 == '@')
|
||||
@ -2899,7 +2914,7 @@ sourceroute(arg, cpp, lenp)
|
||||
|
||||
if ((tmp = inet_addr(cp)) != -1) {
|
||||
sin_addr.s_addr = tmp;
|
||||
} else if (host = gethostbyname(cp)) {
|
||||
} else if ((host = gethostbyname(cp))) {
|
||||
#if defined(h_addr)
|
||||
memmove((caddr_t)&sin_addr,
|
||||
host->h_addr_list[0], host->h_length);
|
||||
|
@ -245,6 +245,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)),
|
||||
@ -290,7 +291,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)),
|
||||
|
@ -32,21 +32,29 @@
|
||||
*/
|
||||
|
||||
#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.3 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ring.h"
|
||||
#include "externs.h"
|
||||
#include "defines.h"
|
||||
|
||||
#if defined(AUTHENTICATION)
|
||||
#include <libtelnet/auth.h>
|
||||
#endif
|
||||
#if defined(ENCRYPTION)
|
||||
#include <libtelnet/encrypt.h>
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
@ -56,6 +64,12 @@ static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95";
|
||||
#define FORWARD
|
||||
#endif
|
||||
|
||||
void init_terminal(void);
|
||||
void init_network(void);
|
||||
void init_telnet(void);
|
||||
void init_sys(void);
|
||||
void init_3270(void);
|
||||
|
||||
/*
|
||||
* Initialize variables.
|
||||
*/
|
||||
@ -109,7 +123,7 @@ usage()
|
||||
* main. Parse arguments, invoke the protocol or command parser.
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
@ -129,7 +143,7 @@ main(argc, argv)
|
||||
|
||||
TerminalSaveState();
|
||||
|
||||
if (prompt = strrchr(argv[0], '/'))
|
||||
if ((prompt = strrchr(argv[0], '/')))
|
||||
++prompt;
|
||||
else
|
||||
prompt = argv[0];
|
||||
@ -319,4 +333,5 @@ main(argc, argv)
|
||||
#endif
|
||||
command(1, 0, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)network.c 8.2 (Berkeley) 12/15/93";
|
||||
static const char sccsid[] = "@(#)network.c 8.2 (Berkeley) 12/15/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -42,6 +42,7 @@ static char sccsid[] = "@(#)network.c 8.2 (Berkeley) 12/15/93";
|
||||
#include <errno.h>
|
||||
|
||||
#include <arpa/telnet.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ring.h"
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)ring.c 8.2 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)ring.c 8.2 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -48,6 +48,7 @@ static char sccsid[] = "@(#)ring.c 8.2 (Berkeley) 5/30/95";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef size_t
|
||||
#undef size_t
|
||||
@ -99,6 +100,7 @@ static u_long ring_clock = 0;
|
||||
|
||||
/* Buffer state transition routines */
|
||||
|
||||
int
|
||||
ring_init(ring, buffer, count)
|
||||
Ring *ring;
|
||||
unsigned char *buffer;
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)sys_bsd.c 8.4 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)sys_bsd.c 8.4 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -48,6 +48,7 @@ static char sccsid[] = "@(#)sys_bsd.c 8.4 (Berkeley) 5/30/95";
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <arpa/telnet.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ring.h"
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -49,6 +49,10 @@ static char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95";
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <termcap.h>
|
||||
|
||||
#include "ring.h"
|
||||
|
||||
#include "defines.h"
|
||||
@ -56,6 +60,13 @@ static char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95";
|
||||
#include "types.h"
|
||||
#include "general.h"
|
||||
|
||||
#if defined(AUTHENTICATION)
|
||||
#include <libtelnet/auth.h>
|
||||
#endif
|
||||
#if defined(ENCRYPTION)
|
||||
#include <libtelnet/encrypt.h>
|
||||
#endif
|
||||
#include <libtelnet/misc.h>
|
||||
|
||||
#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x))
|
||||
|
||||
@ -856,7 +867,7 @@ suboption()
|
||||
|
||||
TerminalSpeeds(&ispeed, &ospeed);
|
||||
|
||||
sprintf((char *)temp, "%c%c%c%c%d,%d%c%c", IAC, SB, TELOPT_TSPEED,
|
||||
sprintf((char *)temp, "%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED,
|
||||
TELQUAL_IS, ospeed, ispeed, IAC, SE);
|
||||
len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */
|
||||
|
||||
@ -1212,7 +1223,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 { \
|
||||
@ -1620,12 +1631,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;
|
||||
}
|
||||
@ -1655,7 +1666,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;
|
||||
@ -1669,7 +1680,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;
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)terminal.c 8.2 (Berkeley) 2/16/95";
|
||||
static const char sccsid[] = "@(#)terminal.c 8.2 (Berkeley) 2/16/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <arpa/telnet.h>
|
||||
@ -43,6 +43,10 @@ static char sccsid[] = "@(#)terminal.c 8.2 (Berkeley) 2/16/95";
|
||||
#include "externs.h"
|
||||
#include "types.h"
|
||||
|
||||
#if defined(ENCRYPTION)
|
||||
#include <libtelnet/encrypt.h>
|
||||
#endif
|
||||
|
||||
Ring ttyoring, ttyiring;
|
||||
unsigned char ttyobuf[2*BUFSIZ], ttyibuf[BUFSIZ];
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)tn3270.c 8.2 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)tn3270.c 8.2 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95";
|
||||
static const char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#define TELOPTS
|
||||
@ -40,7 +40,9 @@ static char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95";
|
||||
#define SLC_NAMES
|
||||
#include <arpa/telnet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
@ -54,6 +56,13 @@ static char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95";
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
#if defined(AUTHENTICATION)
|
||||
#include <libtelnet/auth.h>
|
||||
#endif
|
||||
#if defined(ENCRYPTION)
|
||||
#include <libtelnet/encrypt.h>
|
||||
#endif
|
||||
|
||||
FILE *NetTrace = 0; /* Not in bss, since needs to stay */
|
||||
int prettydump;
|
||||
|
||||
@ -134,7 +143,6 @@ Dump(direction, buffer, length)
|
||||
# define min(x,y) ((x<y)? x:y)
|
||||
unsigned char *pThis;
|
||||
int offset;
|
||||
extern pettydump;
|
||||
|
||||
offset = 0;
|
||||
|
||||
@ -819,7 +827,6 @@ printsub(direction, pointer, length)
|
||||
break;
|
||||
|
||||
default:
|
||||
def_case:
|
||||
if (isprint(pointer[i]) && pointer[i] != '"') {
|
||||
if (noquote) {
|
||||
putc('"', NetTrace);
|
||||
|
Loading…
Reference in New Issue
Block a user