mirror of
https://github.com/sheumann/telnetd.git
synced 2024-06-10 17:29:26 +00:00
Code merge and diff reduce with "base" telnet. This is the "later"
telnet, so it was treated as the reference code, except where later commits were made to "base" telnet. git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@81965 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
This commit is contained in:
parent
65d4fa535a
commit
0fd2377dcc
|
@ -31,6 +31,7 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)auth.h 8.1 (Berkeley) 6/4/93
|
* @(#)auth.h 8.1 (Berkeley) 6/4/93
|
||||||
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -83,5 +84,5 @@ typedef struct XauthP {
|
||||||
|
|
||||||
#include "auth-proto.h"
|
#include "auth-proto.h"
|
||||||
|
|
||||||
extern auth_debug_mode;
|
extern int auth_debug_mode;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,7 +52,8 @@ static const char sccsid[] = "@(#)enc_des.c 8.3 (Berkeley) 5/30/95";
|
||||||
#include "key-proto.h"
|
#include "key-proto.h"
|
||||||
#include "misc-proto.h"
|
#include "misc-proto.h"
|
||||||
|
|
||||||
extern encrypt_debug_mode;
|
extern int encrypt_debug_mode;
|
||||||
|
void des_set_random_generator_seed(des_cblock *); /* XXX */
|
||||||
|
|
||||||
#define CFB 0
|
#define CFB 0
|
||||||
#define OFB 1
|
#define OFB 1
|
||||||
|
|
|
@ -50,12 +50,11 @@ static const char rcsid[] =
|
||||||
* the length is returned. If *s1 is a prefix of *s2,
|
* the length is returned. If *s1 is a prefix of *s2,
|
||||||
* the length of *s1 is returned.
|
* the length of *s1 is returned.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
isprefix(s1, s2)
|
isprefix(char *s1, char *s2)
|
||||||
register char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
char *os1;
|
char *os1;
|
||||||
register char c1, c2;
|
char c1, c2;
|
||||||
|
|
||||||
if (*s1 == '\0')
|
if (*s1 == '\0')
|
||||||
return(-1);
|
return(-1);
|
||||||
|
@ -73,14 +72,11 @@ isprefix(s1, s2)
|
||||||
|
|
||||||
static char *ambiguous; /* special return value for command routines */
|
static char *ambiguous; /* special return value for command routines */
|
||||||
|
|
||||||
char **
|
char **
|
||||||
genget(name, table, stlen)
|
genget(char *name, char **table, int stlen)
|
||||||
char *name; /* name to match */
|
|
||||||
char **table; /* name entry in table */
|
|
||||||
int stlen;
|
|
||||||
{
|
{
|
||||||
register char **c, **found;
|
char **c, **found;
|
||||||
register int n;
|
int n;
|
||||||
|
|
||||||
if (name == 0)
|
if (name == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -101,9 +97,8 @@ genget(name, table, stlen)
|
||||||
/*
|
/*
|
||||||
* Function call version of Ambiguous()
|
* Function call version of Ambiguous()
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
Ambiguous(s)
|
Ambiguous(char *s)
|
||||||
char **s;
|
|
||||||
{
|
{
|
||||||
return(s == &ambiguous);
|
return((char **)s == &ambiguous);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,11 +40,15 @@ static const char rcsid[] =
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
#ifdef HAS_CGETENT
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static char *area;
|
static char *area;
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
getent(cp, name)
|
int
|
||||||
char *cp, *name;
|
getent(char *cp, char *name)
|
||||||
{
|
{
|
||||||
#ifdef HAS_CGETENT
|
#ifdef HAS_CGETENT
|
||||||
char *dba[2];
|
char *dba[2];
|
||||||
|
@ -60,8 +64,7 @@ char *cp, *name;
|
||||||
#ifndef SOLARIS
|
#ifndef SOLARIS
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
char *
|
char *
|
||||||
Getstr(id, cpp)
|
Getstr(char *id, char **cpp)
|
||||||
char *id, **cpp;
|
|
||||||
{
|
{
|
||||||
# ifdef HAS_CGETENT
|
# ifdef HAS_CGETENT
|
||||||
char *answer;
|
char *answer;
|
||||||
|
|
|
@ -9,7 +9,7 @@ static
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
const
|
const
|
||||||
#endif
|
#endif
|
||||||
char rcsid_kerberos5_c[] = "$Id: kerberos5.c,v 1.1 1997/09/04 06:11:15 markm Exp $";
|
char rcsid_kerberos5_c[] = "$FreeBSD$";
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -46,7 +46,7 @@ char rcsid_kerberos5_c[] = "$Id: kerberos5.c,v 1.1 1997/09/04 06:11:15 markm Exp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)kerberos5.c 8.3 (Berkeley) 5/30/95";
|
static const char sccsid[] = "@(#)kerberos5.c 8.3 (Berkeley) 5/30/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -72,15 +72,14 @@ static char sccsid[] = "@(#)kerberos5.c 8.3 (Berkeley) 5/30/95";
|
||||||
|
|
||||||
#ifdef KRB5
|
#ifdef KRB5
|
||||||
#include <arpa/telnet.h>
|
#include <arpa/telnet.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <krb5/krb5.h>
|
|
||||||
#include <krb5/asn1.h>
|
|
||||||
#include <krb5/crc-32.h>
|
|
||||||
#include <krb5/los-proto.h>
|
|
||||||
#include <krb5/ext-proto.h>
|
|
||||||
#include <com_err.h>
|
#include <com_err.h>
|
||||||
#include <netdb.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <krb5.h>
|
||||||
|
#include <krb5_asn1.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/* kerberos 5 include files (ext-proto.h) will get an appropriate stdlib.h
|
/* kerberos 5 include files (ext-proto.h) will get an appropriate stdlib.h
|
||||||
and string.h/strings.h */
|
and string.h/strings.h */
|
||||||
|
@ -89,7 +88,7 @@ static char sccsid[] = "@(#)kerberos5.c 8.3 (Berkeley) 5/30/95";
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
extern auth_debug_mode;
|
extern int auth_debug_mode;
|
||||||
|
|
||||||
#ifdef FORWARD
|
#ifdef FORWARD
|
||||||
int forward_flags = 0; /* Flags get set in telnet/main.c on -f and -F */
|
int forward_flags = 0; /* Flags get set in telnet/main.c on -f and -F */
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)misc-proto.h 8.1 (Berkeley) 6/4/93
|
* @(#)misc-proto.h 8.1 (Berkeley) 6/4/93
|
||||||
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -76,4 +77,5 @@ void net_encrypt P((void));
|
||||||
int telnet_spin P((void));
|
int telnet_spin P((void));
|
||||||
char *telnet_getenv P((char *));
|
char *telnet_getenv P((char *));
|
||||||
char *telnet_gets P((char *, char *, int, int));
|
char *telnet_gets P((char *, char *, int, int));
|
||||||
|
void printsub P((int, unsigned char *, int));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,8 +43,12 @@ static const char rcsid[] =
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#if defined(AUTHENTICATION)
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
|
#endif
|
||||||
|
#ifdef ENCRYPTION
|
||||||
#include "encrypt.h"
|
#include "encrypt.h"
|
||||||
|
#endif /* ENCRYPTION */
|
||||||
|
|
||||||
char *RemoteHostName;
|
char *RemoteHostName;
|
||||||
char *LocalHostName;
|
char *LocalHostName;
|
||||||
|
|
|
@ -10,24 +10,24 @@
|
||||||
char secret[HEXKEYBYTES + 1];
|
char secret[HEXKEYBYTES + 1];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <string.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <openssl/des.h>
|
#include <openssl/des.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include "mp.h"
|
#include "mp.h"
|
||||||
#include "pk.h"
|
#include "pk.h"
|
||||||
#if defined(SOLARIS2) || defined(LINUX)
|
#if defined(SOLARIS2) || defined(LINUX) || defined(__FreeBSD__)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void adjust(char keyout[HEXKEYBYTES+1], char *keyin);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Choose top 128 bits of the common key to use as our idea key.
|
* Choose top 128 bits of the common key to use as our idea key.
|
||||||
*/
|
*/
|
||||||
static
|
static void
|
||||||
extractideakey(ck, ideakey)
|
extractideakey(MINT *ck, IdeaData *ideakey)
|
||||||
MINT *ck;
|
|
||||||
IdeaData *ideakey;
|
|
||||||
{
|
{
|
||||||
MINT *a;
|
MINT *a;
|
||||||
MINT *z;
|
MINT *z;
|
||||||
|
@ -55,10 +55,8 @@ extractideakey(ck, ideakey)
|
||||||
* Choose middle 64 bits of the common key to use as our des key, possibly
|
* Choose middle 64 bits of the common key to use as our des key, possibly
|
||||||
* overwriting the lower order bits by setting parity.
|
* overwriting the lower order bits by setting parity.
|
||||||
*/
|
*/
|
||||||
static
|
static void
|
||||||
extractdeskey(ck, deskey)
|
extractdeskey(MINT *ck, DesData *deskey)
|
||||||
MINT *ck;
|
|
||||||
DesData *deskey;
|
|
||||||
{
|
{
|
||||||
MINT *a;
|
MINT *a;
|
||||||
MINT *z;
|
MINT *z;
|
||||||
|
@ -85,7 +83,8 @@ extractdeskey(ck, deskey)
|
||||||
/*
|
/*
|
||||||
* get common key from my secret key and his public key
|
* get common key from my secret key and his public key
|
||||||
*/
|
*/
|
||||||
void common_key(char *xsecret, char *xpublic, IdeaData *ideakey, DesData *deskey)
|
void
|
||||||
|
common_key(char *xsecret, char *xpublic, IdeaData *ideakey, DesData *deskey)
|
||||||
{
|
{
|
||||||
MINT *public;
|
MINT *public;
|
||||||
MINT *secret;
|
MINT *secret;
|
||||||
|
@ -109,55 +108,25 @@ void common_key(char *xsecret, char *xpublic, IdeaData *ideakey, DesData *deskey
|
||||||
mfree(modulus);
|
mfree(modulus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate a seed
|
* Generate a seed
|
||||||
*/
|
*/
|
||||||
void getseed(seed, seedsize)
|
void
|
||||||
char *seed;
|
getseed(char *seed, int seedsize)
|
||||||
int seedsize;
|
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
int i,f;
|
|
||||||
int rseed;
|
|
||||||
struct timeval tv;
|
|
||||||
long devrand;
|
|
||||||
|
|
||||||
(void)gettimeofday(&tv, (struct timezone *)NULL);
|
|
||||||
rseed = tv.tv_sec + tv.tv_usec;
|
|
||||||
/* XXX What the hell is this?! */
|
|
||||||
for (i = 0; i < 8; i++) {
|
|
||||||
rseed ^= (rseed << 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
f=open("/dev/random",O_NONBLOCK|O_RDONLY);
|
|
||||||
if (f>=0)
|
|
||||||
{
|
|
||||||
read(f,&devrand,sizeof(devrand));
|
|
||||||
close(f);
|
|
||||||
}
|
|
||||||
srand48((long)rseed^devrand);
|
|
||||||
|
|
||||||
for (i = 0; i < seedsize; i++) {
|
|
||||||
seed[i] = (lrand48() & 0xff);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
srandomdev();
|
srandomdev();
|
||||||
for (i = 0; i < seedsize; i++) {
|
for (i = 0; i < seedsize; i++) {
|
||||||
seed[i] = random() & 0xff;
|
seed[i] = random() & 0xff;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate a random public/secret key pair
|
* Generate a random public/secret key pair
|
||||||
*/
|
*/
|
||||||
void genkeys(public, secret)
|
void
|
||||||
char *public;
|
genkeys(char *public, char *secret)
|
||||||
char *secret;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -200,9 +169,8 @@ void genkeys(public, secret)
|
||||||
/*
|
/*
|
||||||
* Adjust the input key so that it is 0-filled on the left
|
* Adjust the input key so that it is 0-filled on the left
|
||||||
*/
|
*/
|
||||||
adjust(keyout, keyin)
|
static void
|
||||||
char keyout[HEXKEYBYTES+1];
|
adjust(char keyout[HEXKEYBYTES+1], char *keyin)
|
||||||
char *keyin;
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -220,9 +188,8 @@ adjust(keyout, keyin)
|
||||||
static char hextab[17] = "0123456789ABCDEF";
|
static char hextab[17] = "0123456789ABCDEF";
|
||||||
|
|
||||||
/* given a DES key, cbc encrypt and translate input to terminated hex */
|
/* given a DES key, cbc encrypt and translate input to terminated hex */
|
||||||
void pk_encode(in, out, key)
|
void
|
||||||
char *in,*out;
|
pk_encode(char *in, char *out, DesData *key)
|
||||||
DesData *key;
|
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
DesData i;
|
DesData i;
|
||||||
|
@ -242,9 +209,8 @@ DesData *key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* given a DES key, translate input from hex and decrypt */
|
/* given a DES key, translate input from hex and decrypt */
|
||||||
void pk_decode(in, out, key)
|
void
|
||||||
char *in,*out;
|
pk_decode(char *in, char *out, DesData *key)
|
||||||
DesData *key;
|
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
DesData i;
|
DesData i;
|
||||||
|
|
|
@ -15,8 +15,12 @@
|
||||||
|
|
||||||
#if !defined(NOPAM)
|
#if !defined(NOPAM)
|
||||||
#include <security/pam_appl.h>
|
#include <security/pam_appl.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <pwd.h>
|
||||||
|
#include <syslog.h>
|
||||||
#include <ttyent.h>
|
#include <ttyent.h>
|
||||||
|
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
|
@ -32,8 +36,8 @@ IdeaData ik;
|
||||||
extern int auth_debug_mode;
|
extern int auth_debug_mode;
|
||||||
extern char *line;
|
extern char *line;
|
||||||
|
|
||||||
static sra_valid = 0;
|
static int sra_valid = 0;
|
||||||
static passwd_sent = 0;
|
static int passwd_sent = 0;
|
||||||
|
|
||||||
static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0,
|
static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0,
|
||||||
AUTHTYPE_SRA, };
|
AUTHTYPE_SRA, };
|
||||||
|
@ -45,12 +49,11 @@ static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0,
|
||||||
#define SRA_ACCEPT 4
|
#define SRA_ACCEPT 4
|
||||||
#define SRA_REJECT 5
|
#define SRA_REJECT 5
|
||||||
|
|
||||||
|
static int check_user(const char *, const char *);
|
||||||
|
|
||||||
/* support routine to send out authentication message */
|
/* support routine to send out authentication message */
|
||||||
static int Data(ap, type, d, c)
|
static int
|
||||||
Authenticator *ap;
|
Data(Authenticator *ap, int type, void *d, int c)
|
||||||
int type;
|
|
||||||
void *d;
|
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
unsigned char *p = str_data + 4;
|
unsigned char *p = str_data + 4;
|
||||||
unsigned char *cd = (unsigned char *)d;
|
unsigned char *cd = (unsigned char *)d;
|
||||||
|
@ -80,9 +83,8 @@ int c;
|
||||||
return(net_write(str_data, p - str_data));
|
return(net_write(str_data, p - str_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
int sra_init(ap, server)
|
int
|
||||||
Authenticator *ap;
|
sra_init(Authenticator *ap, int server)
|
||||||
int server;
|
|
||||||
{
|
{
|
||||||
if (server)
|
if (server)
|
||||||
str_data[3] = TELQUAL_REPLY;
|
str_data[3] = TELQUAL_REPLY;
|
||||||
|
@ -105,8 +107,8 @@ int server;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* client received a go-ahead for sra */
|
/* client received a go-ahead for sra */
|
||||||
int sra_send(ap)
|
int
|
||||||
Authenticator *ap;
|
sra_send(Authenticator *ap)
|
||||||
{
|
{
|
||||||
/* send PKA */
|
/* send PKA */
|
||||||
|
|
||||||
|
@ -123,10 +125,8 @@ Authenticator *ap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* server received an IS -- could be SRA KEY, USER, or PASS */
|
/* server received an IS -- could be SRA KEY, USER, or PASS */
|
||||||
void sra_is(ap, data, cnt)
|
void
|
||||||
Authenticator *ap;
|
sra_is(Authenticator *ap, unsigned char *data, int cnt)
|
||||||
unsigned char *data;
|
|
||||||
int cnt;
|
|
||||||
{
|
{
|
||||||
int valid;
|
int valid;
|
||||||
Session_Key skey;
|
Session_Key skey;
|
||||||
|
@ -217,13 +217,9 @@ bad:
|
||||||
auth_finished(ap, AUTH_REJECT);
|
auth_finished(ap, AUTH_REJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern char *getpass();
|
|
||||||
|
|
||||||
/* client received REPLY -- could be SRA KEY, CONTINUE, ACCEPT, or REJECT */
|
/* client received REPLY -- could be SRA KEY, CONTINUE, ACCEPT, or REJECT */
|
||||||
void sra_reply(ap, data, cnt)
|
void
|
||||||
Authenticator *ap;
|
sra_reply(Authenticator *ap, unsigned char *data, int cnt)
|
||||||
unsigned char *data;
|
|
||||||
int cnt;
|
|
||||||
{
|
{
|
||||||
extern char *telnet_gets();
|
extern char *telnet_gets();
|
||||||
char uprompt[256],tuser[256];
|
char uprompt[256],tuser[256];
|
||||||
|
@ -322,10 +318,8 @@ int cnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int sra_status(ap, name, level)
|
int
|
||||||
Authenticator *ap;
|
sra_status(Authenticator *ap, char *name, int level)
|
||||||
char *name;
|
|
||||||
int level;
|
|
||||||
{
|
{
|
||||||
if (level < AUTH_USER)
|
if (level < AUTH_USER)
|
||||||
return(level);
|
return(level);
|
||||||
|
@ -339,9 +333,8 @@ int level;
|
||||||
#define BUMP(buf, len) while (*(buf)) {++(buf), --(len);}
|
#define BUMP(buf, len) while (*(buf)) {++(buf), --(len);}
|
||||||
#define ADDC(buf, len, c) if ((len) > 0) {*(buf)++ = (c); --(len);}
|
#define ADDC(buf, len, c) if ((len) > 0) {*(buf)++ = (c); --(len);}
|
||||||
|
|
||||||
void sra_printsub(data, cnt, buf, buflen)
|
void
|
||||||
unsigned char *data, *buf;
|
sra_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
||||||
int cnt, buflen;
|
|
||||||
{
|
{
|
||||||
char lbuf[32];
|
char lbuf[32];
|
||||||
register int i;
|
register int i;
|
||||||
|
@ -405,8 +398,7 @@ struct passwd *pw;
|
||||||
* Helper function for sgetpwnam().
|
* Helper function for sgetpwnam().
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
sgetsave(s)
|
sgetsave(char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
char *new = malloc((unsigned) strlen(s) + 1);
|
char *new = malloc((unsigned) strlen(s) + 1);
|
||||||
|
|
||||||
|
@ -417,16 +409,8 @@ sgetsave(s)
|
||||||
return (new);
|
return (new);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <pwd.h>
|
|
||||||
#include <syslog.h>
|
|
||||||
#ifdef USE_SHADOW
|
|
||||||
#include <shadow.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
struct passwd *
|
struct passwd *
|
||||||
sgetpwnam(name)
|
sgetpwnam(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
static struct passwd save;
|
static struct passwd save;
|
||||||
register struct passwd *p;
|
register struct passwd *p;
|
||||||
|
@ -465,8 +449,7 @@ syslog(LOG_WARNING,"%s\n",save.pw_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
isroot(user)
|
isroot(const char *user)
|
||||||
char *user;
|
|
||||||
{
|
{
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
|
@ -476,8 +459,7 @@ char *user;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rootterm(ttyn)
|
rootterm(char *ttyn)
|
||||||
char *ttyn;
|
|
||||||
{
|
{
|
||||||
struct ttyent *t;
|
struct ttyent *t;
|
||||||
|
|
||||||
|
@ -485,11 +467,8 @@ char *ttyn;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NOPAM
|
#ifdef NOPAM
|
||||||
char *crypt();
|
static int
|
||||||
|
check_user(const char *name, const char *pass)
|
||||||
int check_user(name, pass)
|
|
||||||
char *name;
|
|
||||||
char *pass;
|
|
||||||
{
|
{
|
||||||
register char *cp;
|
register char *cp;
|
||||||
char *xpasswd, *salt;
|
char *xpasswd, *salt;
|
||||||
|
@ -535,6 +514,7 @@ struct cred_t {
|
||||||
};
|
};
|
||||||
typedef struct cred_t cred_t;
|
typedef struct cred_t cred_t;
|
||||||
|
|
||||||
|
int
|
||||||
auth_conv(int num_msg, const struct pam_message **msg,
|
auth_conv(int num_msg, const struct pam_message **msg,
|
||||||
struct pam_response **resp, void *appdata)
|
struct pam_response **resp, void *appdata)
|
||||||
{
|
{
|
||||||
|
@ -576,10 +556,10 @@ auth_conv(int num_msg, const struct pam_message **msg,
|
||||||
/*
|
/*
|
||||||
* The PAM version as a side effect may put a new username in *name.
|
* The PAM version as a side effect may put a new username in *name.
|
||||||
*/
|
*/
|
||||||
int check_user(const char *name, const char *pass)
|
static int
|
||||||
|
check_user(const char *name, const char *pass)
|
||||||
{
|
{
|
||||||
pam_handle_t *pamh = NULL;
|
pam_handle_t *pamh = NULL;
|
||||||
const char *tmpl_user;
|
|
||||||
const void *item;
|
const void *item;
|
||||||
int rval;
|
int rval;
|
||||||
int e;
|
int e;
|
||||||
|
@ -623,7 +603,7 @@ int check_user(const char *name, const char *pass)
|
||||||
*/
|
*/
|
||||||
if ((e = pam_get_item(pamh, PAM_USER, &item)) ==
|
if ((e = pam_get_item(pamh, PAM_USER, &item)) ==
|
||||||
PAM_SUCCESS) {
|
PAM_SUCCESS) {
|
||||||
strcpy(name, (const char *) item);
|
strcpy((char *) name, (const char *) item);
|
||||||
} else
|
} else
|
||||||
syslog(LOG_ERR, "Couldn't get PAM_USER: %s",
|
syslog(LOG_ERR, "Couldn't get PAM_USER: %s",
|
||||||
pam_strerror(pamh, e));
|
pam_strerror(pamh, e));
|
||||||
|
|
|
@ -53,6 +53,7 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif /* CRAY */
|
#endif /* CRAY */
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -63,6 +64,7 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <arpa/telnet.h>
|
#include <arpa/telnet.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
||||||
|
@ -88,10 +90,9 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
#include <netinet/ip6.h>
|
#include <netinet/ip6.h>
|
||||||
|
|
||||||
|
#ifndef MAXHOSTNAMELEN
|
||||||
#ifndef MAXHOSTNAMELEN
|
#define MAXHOSTNAMELEN 256
|
||||||
#define MAXHOSTNAMELEN 256
|
#endif MAXHOSTNAMELEN
|
||||||
#endif MAXHOSTNAMELEN
|
|
||||||
|
|
||||||
#if defined(IPPROTO_IP) && defined(IP_TOS)
|
#if defined(IPPROTO_IP) && defined(IP_TOS)
|
||||||
int tos = -1;
|
int tos = -1;
|
||||||
|
@ -110,7 +111,6 @@ static int help(int argc, char *argv[]);
|
||||||
static int call();
|
static int call();
|
||||||
static void cmdrc(char *m1, char *m2);
|
static void cmdrc(char *m1, char *m2);
|
||||||
static int switch_af(struct addrinfo **aip);
|
static int switch_af(struct addrinfo **aip);
|
||||||
|
|
||||||
int quit(void);
|
int quit(void);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -125,11 +125,11 @@ static char saveline[256];
|
||||||
static int margc;
|
static int margc;
|
||||||
static char *margv[20];
|
static char *margv[20];
|
||||||
|
|
||||||
#if defined(SKEY)
|
#if defined(OPIE)
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#define PATH_SKEY "/usr/bin/key"
|
#define PATH_OPIEKEY "/usr/bin/opiekey"
|
||||||
int
|
int
|
||||||
skey_calc(argc, argv)
|
opie_calc(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,7 @@ skey_calc(argc, argv)
|
||||||
|
|
||||||
switch(fork()) {
|
switch(fork()) {
|
||||||
case 0:
|
case 0:
|
||||||
execv(PATH_SKEY, argv);
|
execv(PATH_OPIEKEY, argv);
|
||||||
exit (1);
|
exit (1);
|
||||||
case -1:
|
case -1:
|
||||||
perror("fork");
|
perror("fork");
|
||||||
|
@ -1452,7 +1452,6 @@ shell(argc, argv)
|
||||||
* Fire up the shell in the child.
|
* Fire up the shell in the child.
|
||||||
*/
|
*/
|
||||||
register char *shellp, *shellname;
|
register char *shellp, *shellname;
|
||||||
extern char *strrchr();
|
|
||||||
|
|
||||||
shellp = getenv("SHELL");
|
shellp = getenv("SHELL");
|
||||||
if (shellp == NULL)
|
if (shellp == NULL)
|
||||||
|
@ -1462,9 +1461,9 @@ shell(argc, argv)
|
||||||
else
|
else
|
||||||
shellname++;
|
shellname++;
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
execl(shellp, shellname, "-c", &saveline[1], 0);
|
execl(shellp, shellname, "-c", &saveline[1], (char *)0);
|
||||||
else
|
else
|
||||||
execl(shellp, shellname, 0);
|
execl(shellp, shellname, (char *)0);
|
||||||
perror("Execl");
|
perror("Execl");
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
@ -1741,7 +1740,6 @@ env_init()
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
register char **epp, *cp;
|
register char **epp, *cp;
|
||||||
register struct env_lst *ep;
|
register struct env_lst *ep;
|
||||||
extern char *strchr();
|
|
||||||
|
|
||||||
for (epp = environ; *epp; epp++) {
|
for (epp = environ; *epp; epp++) {
|
||||||
if ((cp = strchr(*epp, '='))) {
|
if ((cp = strchr(*epp, '='))) {
|
||||||
|
@ -2362,7 +2360,7 @@ tn(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
{
|
{
|
||||||
char *srp = 0, *strrchr();
|
char *srp = 0;
|
||||||
int proto, opt;
|
int proto, opt;
|
||||||
int sourceroute(), srlen;
|
int sourceroute(), srlen;
|
||||||
int srcroute = 0, result;
|
int srcroute = 0, result;
|
||||||
|
@ -2582,7 +2580,7 @@ tn(argc, argv)
|
||||||
tos = tp->t_tos;
|
tos = tp->t_tos;
|
||||||
# endif
|
# endif
|
||||||
if (tos < 0)
|
if (tos < 0)
|
||||||
tos = 020; /* Low Delay bit */
|
tos = IPTOS_LOWDELAY;
|
||||||
if (tos
|
if (tos
|
||||||
&& (setsockopt(net, IPPROTO_IP, IP_TOS,
|
&& (setsockopt(net, IPPROTO_IP, IP_TOS,
|
||||||
(char *)&tos, sizeof(int)) < 0)
|
(char *)&tos, sizeof(int)) < 0)
|
||||||
|
@ -2711,8 +2709,8 @@ static char
|
||||||
#if defined(unix)
|
#if defined(unix)
|
||||||
zhelp[] = "suspend telnet",
|
zhelp[] = "suspend telnet",
|
||||||
#endif /* defined(unix) */
|
#endif /* defined(unix) */
|
||||||
#if defined(SKEY)
|
#if defined(OPIE)
|
||||||
skeyhelp[] = "compute response to s/key challenge",
|
opiehelp[] = "compute response to OPIE challenge",
|
||||||
#endif
|
#endif
|
||||||
shellhelp[] = "invoke a subshell",
|
shellhelp[] = "invoke a subshell",
|
||||||
envhelp[] = "change environment variables ('environ ?' for more)",
|
envhelp[] = "change environment variables ('environ ?' for more)",
|
||||||
|
@ -2723,6 +2721,7 @@ static Command cmdtab[] = {
|
||||||
{ "logout", logouthelp, logout, 1 },
|
{ "logout", logouthelp, logout, 1 },
|
||||||
{ "display", displayhelp, display, 0 },
|
{ "display", displayhelp, display, 0 },
|
||||||
{ "mode", modestring, modecmd, 0 },
|
{ "mode", modestring, modecmd, 0 },
|
||||||
|
{ "telnet", openhelp, tn, 0 },
|
||||||
{ "open", openhelp, tn, 0 },
|
{ "open", openhelp, tn, 0 },
|
||||||
{ "quit", quithelp, quit, 0 },
|
{ "quit", quithelp, quit, 0 },
|
||||||
{ "send", sendhelp, sendcmd, 0 },
|
{ "send", sendhelp, sendcmd, 0 },
|
||||||
|
@ -2750,8 +2749,8 @@ static Command cmdtab[] = {
|
||||||
#endif
|
#endif
|
||||||
{ "environ", envhelp, env_cmd, 0 },
|
{ "environ", envhelp, env_cmd, 0 },
|
||||||
{ "?", helphelp, help, 0 },
|
{ "?", helphelp, help, 0 },
|
||||||
#if defined(SKEY)
|
#if defined(OPIE)
|
||||||
{ "skey", skeyhelp, skey_calc, 0 },
|
{ "opie", opiehelp, opie_calc, 0 },
|
||||||
#endif
|
#endif
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
@ -2901,6 +2900,7 @@ help(argc, argv)
|
||||||
printf("%-*s\t%s\n", HELPINDENT, c->name,
|
printf("%-*s\t%s\n", HELPINDENT, c->name,
|
||||||
c->help);
|
c->help);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else while (--argc > 0) {
|
else while (--argc > 0) {
|
||||||
register char *arg;
|
register char *arg;
|
||||||
|
@ -2913,7 +2913,7 @@ help(argc, argv)
|
||||||
else
|
else
|
||||||
printf("%s\n", c->help);
|
printf("%s\n", c->help);
|
||||||
}
|
}
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *rcname = 0;
|
static char *rcname = 0;
|
||||||
|
@ -3186,7 +3186,7 @@ sourceroute(ai, arg, cpp, lenp, protop, optp)
|
||||||
cp2 = 0;
|
cp2 = 0;
|
||||||
|
|
||||||
hints.ai_flags = AI_NUMERICHOST;
|
hints.ai_flags = AI_NUMERICHOST;
|
||||||
error = getaddrinfo(cp, NULL, &hints, &res);
|
error = getaddrinfo(cp, NULL, &hints, &res);
|
||||||
if (error == EAI_NODATA) {
|
if (error == EAI_NODATA) {
|
||||||
hints.ai_flags = 0;
|
hints.ai_flags = 0;
|
||||||
error = getaddrinfo(cp, NULL, &hints, &res);
|
error = getaddrinfo(cp, NULL, &hints, &res);
|
||||||
|
@ -3260,6 +3260,3 @@ sourceroute(ai, arg, cpp, lenp, protop, optp)
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,8 @@ static const char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95";
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "ring.h"
|
#include "ring.h"
|
||||||
#include "externs.h"
|
#include "externs.h"
|
||||||
|
@ -112,13 +114,8 @@ usage()
|
||||||
"\n\t[-e char] [-l user] [-n tracefile] ",
|
"\n\t[-e char] [-l user] [-n tracefile] ",
|
||||||
#endif
|
#endif
|
||||||
#if defined(TN3270) && defined(unix)
|
#if defined(TN3270) && defined(unix)
|
||||||
# ifdef AUTHENTICATION
|
|
||||||
"[-noasynch] [-noasynctty]\n\t"
|
|
||||||
"[-noasyncnet] [-r] [-s src_addr] [-t transcom] ",
|
|
||||||
# else
|
|
||||||
"[-noasynch] [-noasynctty] [-noasyncnet] [-r]\n\t"
|
"[-noasynch] [-noasynctty] [-noasyncnet] [-r]\n\t"
|
||||||
"[-s src_addr] [-t transcom] ",
|
"[-s src_addr] [-t transcom] ",
|
||||||
# endif
|
|
||||||
#else
|
#else
|
||||||
"[-r] [-s src_addr] [-u] ",
|
"[-r] [-s src_addr] [-u] ",
|
||||||
#endif
|
#endif
|
||||||
|
@ -143,10 +140,8 @@ main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
{
|
{
|
||||||
extern char *optarg;
|
|
||||||
extern int optind;
|
|
||||||
int ch;
|
int ch;
|
||||||
char *user, *strrchr();
|
char *user;
|
||||||
char *src_addr = NULL;
|
char *src_addr = NULL;
|
||||||
#ifdef FORWARD
|
#ifdef FORWARD
|
||||||
extern int forward_flags;
|
extern int forward_flags;
|
||||||
|
@ -167,7 +162,11 @@ main(argc, argv)
|
||||||
user = NULL;
|
user = NULL;
|
||||||
|
|
||||||
rlogin = (strncmp(prompt, "rlog", 4) == 0) ? '~' : _POSIX_VDISABLE;
|
rlogin = (strncmp(prompt, "rlog", 4) == 0) ? '~' : _POSIX_VDISABLE;
|
||||||
|
#ifdef AUTHENTICATION
|
||||||
autologin = 1;
|
autologin = 1;
|
||||||
|
#else
|
||||||
|
autologin = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(ENCRYPTION)
|
#if defined(ENCRYPTION)
|
||||||
encrypt_auto(1);
|
encrypt_auto(1);
|
||||||
|
@ -232,7 +231,11 @@ main(argc, argv)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
|
#ifdef AUTHENTICATION
|
||||||
/* It's the default now, so ignore */
|
/* It's the default now, so ignore */
|
||||||
|
#else
|
||||||
|
autologin = 1;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
skiprc = 1;
|
skiprc = 1;
|
||||||
|
@ -288,6 +291,11 @@ main(argc, argv)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
|
#ifdef AUTHENTICATION
|
||||||
|
/* This is the default now, so ignore it */
|
||||||
|
#else
|
||||||
|
autologin = 1;
|
||||||
|
#endif
|
||||||
user = optarg;
|
user = optarg;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
|
@ -326,12 +334,22 @@ main(argc, argv)
|
||||||
family = AF_UNIX;
|
family = AF_UNIX;
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
|
#ifdef ENCRYPTION
|
||||||
/* This is the default now, so ignore it */
|
/* This is the default now, so ignore it */
|
||||||
|
#else
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: Warning: -x ignored, no ENCRYPT support.\n",
|
||||||
|
prompt);
|
||||||
|
#endif /* ENCRYPTION */
|
||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
#ifdef ENCRYPTION
|
#ifdef ENCRYPTION
|
||||||
encrypt_auto(0);
|
encrypt_auto(0);
|
||||||
decrypt_auto(0);
|
decrypt_auto(0);
|
||||||
|
#else
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: Warning: -y ignored, no ENCRYPT support.\n",
|
||||||
|
prompt);
|
||||||
#endif /* ENCRYPTION */
|
#endif /* ENCRYPTION */
|
||||||
break;
|
break;
|
||||||
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
|
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
|
||||||
|
@ -350,6 +368,8 @@ main(argc, argv)
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (autologin == -1)
|
||||||
|
autologin = (rlogin == _POSIX_VDISABLE) ? 0 : 1;
|
||||||
|
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
|
@ -51,8 +51,8 @@ static const char rcsid[] =
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef size_t
|
#ifdef size_t
|
||||||
|
@ -105,9 +105,9 @@ static u_long ring_clock = 0;
|
||||||
|
|
||||||
/* Buffer state transition routines */
|
/* Buffer state transition routines */
|
||||||
|
|
||||||
int
|
int
|
||||||
ring_init(ring, buffer, count)
|
ring_init(ring, buffer, count)
|
||||||
Ring *ring;
|
Ring *ring;
|
||||||
unsigned char *buffer;
|
unsigned char *buffer;
|
||||||
int count;
|
int count;
|
||||||
{
|
{
|
||||||
|
@ -302,7 +302,7 @@ ring_supply_data(ring, buffer, count)
|
||||||
|
|
||||||
while (count) {
|
while (count) {
|
||||||
i = MIN(count, ring_empty_consecutive(ring));
|
i = MIN(count, ring_empty_consecutive(ring));
|
||||||
memmove(ring->supply, buffer, i);
|
memcpy(ring->supply, buffer, i);
|
||||||
ring_supplied(ring, i);
|
ring_supplied(ring, i);
|
||||||
count -= i;
|
count -= i;
|
||||||
buffer += i;
|
buffer += i;
|
||||||
|
@ -324,7 +324,7 @@ ring_consume_data(ring, buffer, count)
|
||||||
|
|
||||||
while (count) {
|
while (count) {
|
||||||
i = MIN(count, ring_full_consecutive(ring));
|
i = MIN(count, ring_full_consecutive(ring));
|
||||||
memmove(buffer, ring->consume, i);
|
memcpy(buffer, ring->consume, i);
|
||||||
ring_consumed(ring, i);
|
ring_consumed(ring, i);
|
||||||
count -= i;
|
count -= i;
|
||||||
buffer += i;
|
buffer += i;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)ring.h 8.1 (Berkeley) 6/6/93
|
* @(#)ring.h 8.1 (Berkeley) 6/6/93
|
||||||
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(P)
|
#if defined(P)
|
||||||
|
@ -101,5 +102,5 @@ extern void
|
||||||
#endif /* ENCRYPTION */
|
#endif /* ENCRYPTION */
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
ring_clear_mark(),
|
ring_clear_mark P((Ring *)),
|
||||||
ring_mark();
|
ring_mark P((Ring *));
|
||||||
|
|
|
@ -334,7 +334,7 @@ TerminalDefaultChars()
|
||||||
nttyb.sg_kill = ottyb.sg_kill;
|
nttyb.sg_kill = ottyb.sg_kill;
|
||||||
nttyb.sg_erase = ottyb.sg_erase;
|
nttyb.sg_erase = ottyb.sg_erase;
|
||||||
#else /* USE_TERMIO */
|
#else /* USE_TERMIO */
|
||||||
memmove(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
|
memcpy(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
|
||||||
# ifndef VDISCARD
|
# ifndef VDISCARD
|
||||||
termFlushChar = CONTROL('O');
|
termFlushChar = CONTROL('O');
|
||||||
# endif
|
# endif
|
||||||
|
@ -633,7 +633,7 @@ TerminalNewMode(f)
|
||||||
(void) signal(SIGINT, intr);
|
(void) signal(SIGINT, intr);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGQUIT
|
#ifdef SIGQUIT
|
||||||
(void) signal(SIGQUIT, intr2);
|
(void) signal(SIGQUIT, intr2);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
(void) signal(SIGTSTP, susp);
|
(void) signal(SIGTSTP, susp);
|
||||||
|
@ -1160,7 +1160,7 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll)
|
||||||
int i;
|
int i;
|
||||||
i = recv(net, netiring.supply + c, canread - c, MSG_OOB);
|
i = recv(net, netiring.supply + c, canread - c, MSG_OOB);
|
||||||
if (i == c &&
|
if (i == c &&
|
||||||
memcmp(netiring.supply, netiring.supply + c, i) == 0) {
|
memcmp(netiring.supply, netiring.supply + c, i) == 0) {
|
||||||
bogus_oob = 1;
|
bogus_oob = 1;
|
||||||
first = 0;
|
first = 0;
|
||||||
} else if (i < 0) {
|
} else if (i < 0) {
|
||||||
|
|
101
telnet/telnet.1
101
telnet/telnet.1
|
@ -37,12 +37,12 @@
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm telnet
|
.Nm telnet
|
||||||
.Nd user interface to the
|
.Nd user interface to the
|
||||||
.Tn TELNET
|
.Tn TELNET
|
||||||
protocol
|
protocol
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl 468EFKLNcdfruy
|
.Op Fl 468EFKLNacdfruxy
|
||||||
.Op Fl S Ar tos
|
.Op Fl S Ar tos
|
||||||
.Op Fl X Ar authtype
|
.Op Fl X Ar authtype
|
||||||
.Op Fl e Ar escapechar
|
.Op Fl e Ar escapechar
|
||||||
|
@ -58,7 +58,7 @@ protocol
|
||||||
The
|
The
|
||||||
.Nm
|
.Nm
|
||||||
command
|
command
|
||||||
is used to communicate with another host using the
|
is used to communicate with another host using the
|
||||||
.Tn TELNET
|
.Tn TELNET
|
||||||
protocol.
|
protocol.
|
||||||
If
|
If
|
||||||
|
@ -114,7 +114,7 @@ or, on systems that support it, a symbolic
|
||||||
TOS name found in the
|
TOS name found in the
|
||||||
.Pa /etc/iptos
|
.Pa /etc/iptos
|
||||||
file.
|
file.
|
||||||
.It Fl X Ar atype
|
.It Fl X Ar atype
|
||||||
Disables the
|
Disables the
|
||||||
.Ar atype
|
.Ar atype
|
||||||
type of authentication.
|
type of authentication.
|
||||||
|
@ -142,7 +142,7 @@ Sets the initial value of the
|
||||||
.Ic debug
|
.Ic debug
|
||||||
toggle to
|
toggle to
|
||||||
.Dv TRUE .
|
.Dv TRUE .
|
||||||
.It Fl e Ar escapechar
|
.It Fl e Ar escapechar
|
||||||
Sets the initial
|
Sets the initial
|
||||||
.Nm
|
.Nm
|
||||||
escape character to
|
escape character to
|
||||||
|
@ -165,7 +165,7 @@ realm
|
||||||
.Ar realm
|
.Ar realm
|
||||||
instead of the remote host's realm, as determined by
|
instead of the remote host's realm, as determined by
|
||||||
.Xr krb_realmofhost 3 .
|
.Xr krb_realmofhost 3 .
|
||||||
.It Fl l Ar user
|
.It Fl l Ar user
|
||||||
When connecting to the remote system, if the remote system
|
When connecting to the remote system, if the remote system
|
||||||
understands the
|
understands the
|
||||||
.Ev ENVIRON
|
.Ev ENVIRON
|
||||||
|
@ -179,7 +179,7 @@ option.
|
||||||
This option may also be used with the
|
This option may also be used with the
|
||||||
.Ic open
|
.Ic open
|
||||||
command.
|
command.
|
||||||
.It Fl n Ar tracefile
|
.It Fl n Ar tracefile
|
||||||
Opens
|
Opens
|
||||||
.Ar tracefile
|
.Ar tracefile
|
||||||
for recording trace information.
|
for recording trace information.
|
||||||
|
@ -252,7 +252,7 @@ either \*(Lqcharacter at a time\*(Rq
|
||||||
or \*(Lqold line by line\*(Rq
|
or \*(Lqold line by line\*(Rq
|
||||||
depending on what the remote system supports.
|
depending on what the remote system supports.
|
||||||
.Pp
|
.Pp
|
||||||
When
|
When
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
is enabled, character processing is done on the
|
is enabled, character processing is done on the
|
||||||
local system, under the control of the remote system. When input
|
local system, under the control of the remote system. When input
|
||||||
|
@ -271,7 +271,7 @@ to turn off and on the local echo
|
||||||
(this would mostly be used to enter passwords
|
(this would mostly be used to enter passwords
|
||||||
without the password being echoed).
|
without the password being echoed).
|
||||||
.Pp
|
.Pp
|
||||||
If the
|
If the
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
option is enabled, or if the
|
option is enabled, or if the
|
||||||
.Ic localchars
|
.Ic localchars
|
||||||
|
@ -286,7 +286,7 @@ and
|
||||||
characters are trapped locally, and sent as
|
characters are trapped locally, and sent as
|
||||||
.Tn TELNET
|
.Tn TELNET
|
||||||
protocol sequences to the remote side.
|
protocol sequences to the remote side.
|
||||||
If
|
If
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
has ever been enabled, then the user's
|
has ever been enabled, then the user's
|
||||||
.Ic susp
|
.Ic susp
|
||||||
|
@ -297,9 +297,9 @@ are also sent as
|
||||||
protocol sequences,
|
protocol sequences,
|
||||||
and
|
and
|
||||||
.Ic quit
|
.Ic quit
|
||||||
is sent as a
|
is sent as a
|
||||||
.Dv TELNET ABORT
|
.Dv TELNET ABORT
|
||||||
instead of
|
instead of
|
||||||
.Dv BREAK .
|
.Dv BREAK .
|
||||||
There are options (see
|
There are options (see
|
||||||
.Ic toggle
|
.Ic toggle
|
||||||
|
@ -340,7 +340,7 @@ and
|
||||||
commands).
|
commands).
|
||||||
.Pp
|
.Pp
|
||||||
.Bl -tag -width "mode type"
|
.Bl -tag -width "mode type"
|
||||||
.It Ic auth Ar argument ...
|
.It Ic auth Ar argument ...
|
||||||
The auth command manipulates the information sent through the
|
The auth command manipulates the information sent through the
|
||||||
.Dv TELNET AUTHENTICATE
|
.Dv TELNET AUTHENTICATE
|
||||||
option. Valid arguments for the
|
option. Valid arguments for the
|
||||||
|
@ -365,7 +365,7 @@ authentication.
|
||||||
Close a
|
Close a
|
||||||
.Tn TELNET
|
.Tn TELNET
|
||||||
session and return to command mode.
|
session and return to command mode.
|
||||||
.It Ic display Ar argument ...
|
.It Ic display Ar argument ...
|
||||||
Displays all, or some, of the
|
Displays all, or some, of the
|
||||||
.Ic set
|
.Ic set
|
||||||
and
|
and
|
||||||
|
@ -460,7 +460,7 @@ Valid arguments for the
|
||||||
.Ic environ
|
.Ic environ
|
||||||
command are:
|
command are:
|
||||||
.Bl -tag -width Fl
|
.Bl -tag -width Fl
|
||||||
.It Ic define Ar variable value
|
.It Ic define Ar variable value
|
||||||
Define the variable
|
Define the variable
|
||||||
.Ar variable
|
.Ar variable
|
||||||
to have a value of
|
to have a value of
|
||||||
|
@ -470,15 +470,15 @@ The
|
||||||
.Ar value
|
.Ar value
|
||||||
may be enclosed in single or double quotes so
|
may be enclosed in single or double quotes so
|
||||||
that tabs and spaces may be included.
|
that tabs and spaces may be included.
|
||||||
.It Ic undefine Ar variable
|
.It Ic undefine Ar variable
|
||||||
Remove
|
Remove
|
||||||
.Ar variable
|
.Ar variable
|
||||||
from the list of environment variables.
|
from the list of environment variables.
|
||||||
.It Ic export Ar variable
|
.It Ic export Ar variable
|
||||||
Mark the variable
|
Mark the variable
|
||||||
.Ar variable
|
.Ar variable
|
||||||
to be exported to the remote side.
|
to be exported to the remote side.
|
||||||
.It Ic unexport Ar variable
|
.It Ic unexport Ar variable
|
||||||
Mark the variable
|
Mark the variable
|
||||||
.Ar variable
|
.Ar variable
|
||||||
to not be exported unless
|
to not be exported unless
|
||||||
|
@ -512,7 +512,7 @@ If the remote side also supports the concept of
|
||||||
suspending a user's session for later reattachment,
|
suspending a user's session for later reattachment,
|
||||||
the logout argument indicates that you
|
the logout argument indicates that you
|
||||||
should terminate the session immediately.
|
should terminate the session immediately.
|
||||||
.It Ic mode Ar type
|
.It Ic mode Ar type
|
||||||
.Ar Type
|
.Ar Type
|
||||||
is one of several options, depending on the state of the
|
is one of several options, depending on the state of the
|
||||||
.Tn TELNET
|
.Tn TELNET
|
||||||
|
@ -533,40 +533,40 @@ Enable the
|
||||||
option, or, if the remote side does not understand the
|
option, or, if the remote side does not understand the
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
option, then attempt to enter \*(Lqold-line-by-line\*(Rq mode.
|
option, then attempt to enter \*(Lqold-line-by-line\*(Rq mode.
|
||||||
.It Ic isig Pq Ic \-isig
|
.It Ic isig Pq Ic \-isig
|
||||||
Attempt to enable (disable) the
|
Attempt to enable (disable) the
|
||||||
.Dv TRAPSIG
|
.Dv TRAPSIG
|
||||||
mode of the
|
mode of the
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
option.
|
option.
|
||||||
This requires that the
|
This requires that the
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
option be enabled.
|
option be enabled.
|
||||||
.It Ic edit Pq Ic \-edit
|
.It Ic edit Pq Ic \-edit
|
||||||
Attempt to enable (disable) the
|
Attempt to enable (disable) the
|
||||||
.Dv EDIT
|
.Dv EDIT
|
||||||
mode of the
|
mode of the
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
option.
|
option.
|
||||||
This requires that the
|
This requires that the
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
option be enabled.
|
option be enabled.
|
||||||
.It Ic softtabs Pq Ic \-softtabs
|
.It Ic softtabs Pq Ic \-softtabs
|
||||||
Attempt to enable (disable) the
|
Attempt to enable (disable) the
|
||||||
.Dv SOFT_TAB
|
.Dv SOFT_TAB
|
||||||
mode of the
|
mode of the
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
option.
|
option.
|
||||||
This requires that the
|
This requires that the
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
option be enabled.
|
option be enabled.
|
||||||
.It Ic litecho Pq Ic \-litecho
|
.It Ic litecho Pq Ic \-litecho
|
||||||
Attempt to enable (disable) the
|
Attempt to enable (disable) the
|
||||||
.Dv LIT_ECHO
|
.Dv LIT_ECHO
|
||||||
mode of the
|
mode of the
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
option.
|
option.
|
||||||
This requires that the
|
This requires that the
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
option be enabled.
|
option be enabled.
|
||||||
.It Ic ?\&
|
.It Ic ?\&
|
||||||
|
@ -623,7 +623,7 @@ Close any open
|
||||||
session and exit
|
session and exit
|
||||||
.Nm .
|
.Nm .
|
||||||
An end of file (in command mode) will also close a session and exit.
|
An end of file (in command mode) will also close a session and exit.
|
||||||
.It Ic send Ar arguments
|
.It Ic send Ar arguments
|
||||||
Sends one or more special character sequences to the remote host.
|
Sends one or more special character sequences to the remote host.
|
||||||
The following are the arguments which may be specified
|
The following are the arguments which may be specified
|
||||||
(more than one argument may be specified at a time):
|
(more than one argument may be specified at a time):
|
||||||
|
@ -745,8 +745,8 @@ Prints out help information for the
|
||||||
.Ic send
|
.Ic send
|
||||||
command.
|
command.
|
||||||
.El
|
.El
|
||||||
.It Ic set Ar argument value
|
.It Ic set Ar argument value
|
||||||
.It Ic unset Ar argument value
|
.It Ic unset Ar argument value
|
||||||
The
|
The
|
||||||
.Ic set
|
.Ic set
|
||||||
command will set any one of a number of
|
command will set any one of a number of
|
||||||
|
@ -1050,20 +1050,20 @@ Displays the legal
|
||||||
.Pq Ic unset
|
.Pq Ic unset
|
||||||
commands.
|
commands.
|
||||||
.El
|
.El
|
||||||
.It Ic skey Ar sequence challenge
|
.It Ic opie Ar sequence challenge
|
||||||
The
|
The
|
||||||
.Ic skey
|
.Ic opie
|
||||||
command computes a response to the S/Key challenge.
|
command computes a response to the OPIE challenge.
|
||||||
.It Ic slc Ar state
|
.It Ic slc Ar state
|
||||||
The
|
The
|
||||||
.Ic slc
|
.Ic slc
|
||||||
command (Set Local Characters) is used to set
|
command (Set Local Characters) is used to set
|
||||||
or change the state of the special
|
or change the state of the special
|
||||||
characters when the
|
characters when the
|
||||||
.Dv TELNET LINEMODE
|
.Dv TELNET LINEMODE
|
||||||
option has
|
option has
|
||||||
been enabled. Special characters are characters that get
|
been enabled. Special characters are characters that get
|
||||||
mapped to
|
mapped to
|
||||||
.Tn TELNET
|
.Tn TELNET
|
||||||
commands sequences (like
|
commands sequences (like
|
||||||
.Ic ip
|
.Ic ip
|
||||||
|
@ -1089,7 +1089,7 @@ was started.
|
||||||
.It Ic import
|
.It Ic import
|
||||||
Switch to the remote defaults for the special characters.
|
Switch to the remote defaults for the special characters.
|
||||||
The remote default characters are those of the remote system
|
The remote default characters are those of the remote system
|
||||||
at the time when the
|
at the time when the
|
||||||
.Tn TELNET
|
.Tn TELNET
|
||||||
connection was established.
|
connection was established.
|
||||||
.It Ic ?\&
|
.It Ic ?\&
|
||||||
|
@ -1102,7 +1102,7 @@ Show the current status of
|
||||||
.Nm .
|
.Nm .
|
||||||
This includes the peer one is connected to, as well
|
This includes the peer one is connected to, as well
|
||||||
as the current mode.
|
as the current mode.
|
||||||
.It Ic toggle Ar arguments ...
|
.It Ic toggle Ar arguments ...
|
||||||
Toggle (between
|
Toggle (between
|
||||||
.Dv TRUE
|
.Dv TRUE
|
||||||
and
|
and
|
||||||
|
@ -1365,17 +1365,17 @@ Suspend
|
||||||
.Nm .
|
.Nm .
|
||||||
This command only works when the user is using the
|
This command only works when the user is using the
|
||||||
.Xr csh 1 .
|
.Xr csh 1 .
|
||||||
.It Ic \&! Op Ar command
|
.It Ic \&! Op Ar command
|
||||||
Execute a single command in a subshell on the local
|
Execute a single command in a subshell on the local
|
||||||
system. If
|
system. If
|
||||||
.Ar command
|
.Ar command
|
||||||
is omitted, then an interactive
|
is omitted, then an interactive
|
||||||
subshell is invoked.
|
subshell is invoked.
|
||||||
.It Ic ?\& Op Ar command
|
.It Ic ?\& Op Ar command
|
||||||
Get help. With no arguments,
|
Get help. With no arguments,
|
||||||
.Nm
|
.Nm
|
||||||
prints a help summary.
|
prints a help summary.
|
||||||
If
|
If
|
||||||
.Ar command
|
.Ar command
|
||||||
is specified,
|
is specified,
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -1413,11 +1413,10 @@ command appeared in
|
||||||
.Pp
|
.Pp
|
||||||
IPv6 support was added by WIDE/KAME project.
|
IPv6 support was added by WIDE/KAME project.
|
||||||
.Sh NOTES
|
.Sh NOTES
|
||||||
.Pp
|
|
||||||
On some remote systems, echo has to be turned off manually when in
|
On some remote systems, echo has to be turned off manually when in
|
||||||
\*(Lqold line by line\*(Rq mode.
|
\*(Lqold line by line\*(Rq mode.
|
||||||
.Pp
|
.Pp
|
||||||
In \*(Lqold line by line\*(Rq mode or
|
In \*(Lqold line by line\*(Rq mode or
|
||||||
.Dv LINEMODE
|
.Dv LINEMODE
|
||||||
the terminal's
|
the terminal's
|
||||||
.Ic eof
|
.Ic eof
|
||||||
|
|
|
@ -53,9 +53,7 @@ static const char rcsid[] =
|
||||||
#endif /* defined(unix) */
|
#endif /* defined(unix) */
|
||||||
|
|
||||||
#include <arpa/telnet.h>
|
#include <arpa/telnet.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
@ -126,7 +124,9 @@ int
|
||||||
clienteof = 0;
|
clienteof = 0;
|
||||||
|
|
||||||
char *prompt = 0;
|
char *prompt = 0;
|
||||||
|
#ifdef ENCRYPTION
|
||||||
char *line; /* hack around breakage in sra.c :-( !! */
|
char *line; /* hack around breakage in sra.c :-( !! */
|
||||||
|
#endif
|
||||||
|
|
||||||
cc_t escape;
|
cc_t escape;
|
||||||
cc_t rlogin;
|
cc_t rlogin;
|
||||||
|
@ -643,7 +643,7 @@ mklist(buf, name)
|
||||||
register char c, *cp, **argvp, *cp2, **argv, **avt;
|
register char c, *cp, **argvp, *cp2, **argv, **avt;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
if ((int)strlen(name) > 40) {
|
if (strlen(name) > 40) {
|
||||||
name = 0;
|
name = 0;
|
||||||
unknown[0] = name_unknown;
|
unknown[0] = name_unknown;
|
||||||
} else {
|
} else {
|
||||||
|
@ -802,7 +802,7 @@ gettermname()
|
||||||
(setupterm(tname, 1, &err) == 0)) {
|
(setupterm(tname, 1, &err) == 0)) {
|
||||||
tnamep = mklist(termbuf, tname);
|
tnamep = mklist(termbuf, tname);
|
||||||
} else {
|
} else {
|
||||||
if (tname && ((int)strlen(tname) <= 40)) {
|
if (tname && (strlen(tname) <= 40)) {
|
||||||
unknown[0] = tname;
|
unknown[0] = tname;
|
||||||
upcase(tname);
|
upcase(tname);
|
||||||
} else
|
} else
|
||||||
|
@ -2452,7 +2452,7 @@ netclear()
|
||||||
next = nextitem(next);
|
next = nextitem(next);
|
||||||
} while (wewant(next) && (nfrontp > next));
|
} while (wewant(next) && (nfrontp > next));
|
||||||
length = next-thisitem;
|
length = next-thisitem;
|
||||||
memmove(good, thisitem, length);
|
memcpy(good, thisitem, length);
|
||||||
good += length;
|
good += length;
|
||||||
thisitem = next;
|
thisitem = next;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -47,9 +47,8 @@ static const char rcsid[] =
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ extern char *unptyip; /* pointer to remaining characters in buffer */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int pty, net;
|
extern int pty, net;
|
||||||
extern char *line;
|
extern char line[16];
|
||||||
extern int SYNCHing; /* we are in TELNET SYNCH mode */
|
extern int SYNCHing; /* we are in TELNET SYNCH mode */
|
||||||
|
|
||||||
#ifndef P
|
#ifndef P
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# define _PATH_TTY "/dev/tty"
|
# define _PATH_TTY "/dev/tty"
|
||||||
# ifndef _PATH_LOGIN
|
# ifndef _PATH_LOGIN
|
||||||
# define _PATH_LOGIN "/bin/login"
|
# define _PATH_LOGIN "/bin/login"
|
||||||
|
|
|
@ -721,6 +721,7 @@ wontoption(option)
|
||||||
*/
|
*/
|
||||||
if (lmodetype != REAL_LINEMODE)
|
if (lmodetype != REAL_LINEMODE)
|
||||||
break;
|
break;
|
||||||
|
lmodetype = KLUDGE_LINEMODE;
|
||||||
# endif /* KLUDGELINEMODE */
|
# endif /* KLUDGELINEMODE */
|
||||||
clientstat(TELOPT_LINEMODE, WONT, 0);
|
clientstat(TELOPT_LINEMODE, WONT, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -1551,10 +1552,14 @@ send_status()
|
||||||
if (my_want_state_is_will(i)) {
|
if (my_want_state_is_will(i)) {
|
||||||
ADD(WILL);
|
ADD(WILL);
|
||||||
ADD_DATA(i);
|
ADD_DATA(i);
|
||||||
|
if (i == IAC)
|
||||||
|
ADD(IAC);
|
||||||
}
|
}
|
||||||
if (his_want_state_is_will(i)) {
|
if (his_want_state_is_will(i)) {
|
||||||
ADD(DO);
|
ADD(DO);
|
||||||
ADD_DATA(i);
|
ADD_DATA(i);
|
||||||
|
if (i == IAC)
|
||||||
|
ADD(IAC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -481,14 +481,10 @@ getnpty()
|
||||||
*
|
*
|
||||||
* Returns the file descriptor of the opened pty.
|
* Returns the file descriptor of the opened pty.
|
||||||
*/
|
*/
|
||||||
#ifndef __GNUC__
|
|
||||||
char *line = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
|
||||||
#else
|
|
||||||
static char Xline[] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
|
||||||
char *line = Xline;
|
|
||||||
#endif
|
|
||||||
#ifdef CRAY
|
#ifdef CRAY
|
||||||
char *myline = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
char myline[16];
|
||||||
|
#else
|
||||||
|
char line[16];
|
||||||
#endif /* CRAY */
|
#endif /* CRAY */
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -517,7 +513,8 @@ int *ptynum;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __hpux
|
#ifndef __hpux
|
||||||
(void) strcpy(line, "/dev/ptyXX");
|
(void) strcpy(line, _PATH_DEV);
|
||||||
|
(void) strcat(line, "ptyXX");
|
||||||
p1 = &line[8];
|
p1 = &line[8];
|
||||||
p2 = &line[9];
|
p2 = &line[9];
|
||||||
#else
|
#else
|
||||||
|
@ -568,11 +565,11 @@ int *ptynum;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
for (*ptynum = lowpty; *ptynum <= highpty; (*ptynum)++) {
|
for (*ptynum = lowpty; *ptynum <= highpty; (*ptynum)++) {
|
||||||
(void) sprintf(myline, "/dev/pty/%03d", *ptynum);
|
(void) sprintf(myline, "%spty/%03d", _PATH_DEV, *ptynum);
|
||||||
p = open(myline, 2);
|
p = open(myline, 2);
|
||||||
if (p < 0)
|
if (p < 0)
|
||||||
continue;
|
continue;
|
||||||
(void) sprintf(line, "/dev/ttyp%03d", *ptynum);
|
(void) sprintf(line, "%sp%03d", _PATH_TTY, *ptynum);
|
||||||
/*
|
/*
|
||||||
* Here are some shenanigans to make sure that there
|
* Here are some shenanigans to make sure that there
|
||||||
* are no listeners lurking on the line.
|
* are no listeners lurking on the line.
|
||||||
|
@ -1300,6 +1297,7 @@ cleanopen(line)
|
||||||
(void) signal(SIGHUP, SIG_IGN);
|
(void) signal(SIGHUP, SIG_IGN);
|
||||||
(void) ioctl(t, TCVHUP, (char *)0);
|
(void) ioctl(t, TCVHUP, (char *)0);
|
||||||
(void) signal(SIGHUP, SIG_DFL);
|
(void) signal(SIGHUP, SIG_DFL);
|
||||||
|
setpgrp();
|
||||||
|
|
||||||
#ifdef UNICOS7x
|
#ifdef UNICOS7x
|
||||||
if (secflag) {
|
if (secflag) {
|
||||||
|
@ -1359,7 +1357,7 @@ login_tty(t)
|
||||||
* the indirect /dev/tty interface.
|
* the indirect /dev/tty interface.
|
||||||
*/
|
*/
|
||||||
close(t);
|
close(t);
|
||||||
if ((t = open("/dev/tty", O_RDWR)) < 0)
|
if ((t = open(_PATH_TTY, O_RDWR)) < 0)
|
||||||
fatalperror(net, "open(/dev/tty)");
|
fatalperror(net, "open(/dev/tty)");
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
|
@ -1452,7 +1450,7 @@ startslave(host, autologin, autoname)
|
||||||
wtmp.ut_pid = pid;
|
wtmp.ut_pid = pid;
|
||||||
SCPYN(wtmp.ut_user, "LOGIN");
|
SCPYN(wtmp.ut_user, "LOGIN");
|
||||||
SCPYN(wtmp.ut_host, host);
|
SCPYN(wtmp.ut_host, host);
|
||||||
SCPYN(wtmp.ut_line, line + sizeof("/dev/") - 1);
|
SCPYN(wtmp.ut_line, line + sizeof(_PATH_DEV) - 1);
|
||||||
#ifndef __hpux
|
#ifndef __hpux
|
||||||
SCPYN(wtmp.ut_id, wtmp.ut_line+3);
|
SCPYN(wtmp.ut_id, wtmp.ut_line+3);
|
||||||
#else
|
#else
|
||||||
|
@ -1584,7 +1582,7 @@ start_login(host, autologin, name)
|
||||||
|
|
||||||
memset(&utmpx, 0, sizeof(utmpx));
|
memset(&utmpx, 0, sizeof(utmpx));
|
||||||
SCPYN(utmpx.ut_user, ".telnet");
|
SCPYN(utmpx.ut_user, ".telnet");
|
||||||
SCPYN(utmpx.ut_line, line + sizeof("/dev/") - 1);
|
SCPYN(utmpx.ut_line, line + sizeof(_PATH_DEV) - 1);
|
||||||
utmpx.ut_pid = pid;
|
utmpx.ut_pid = pid;
|
||||||
utmpx.ut_id[0] = 't';
|
utmpx.ut_id[0] = 't';
|
||||||
utmpx.ut_id[1] = 'n';
|
utmpx.ut_id[1] = 'n';
|
||||||
|
@ -1898,7 +1896,7 @@ cleanup(sig)
|
||||||
# if (BSD > 43) || defined(convex)
|
# if (BSD > 43) || defined(convex)
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
p = line + sizeof("/dev/") - 1;
|
p = line + sizeof(_PATH_DEV) - 1;
|
||||||
if (logout(p))
|
if (logout(p))
|
||||||
logwtmp(p, "", "");
|
logwtmp(p, "", "");
|
||||||
(void)chmod(line, 0666);
|
(void)chmod(line, 0666);
|
||||||
|
@ -2209,7 +2207,7 @@ cleantmpdir(jid, tpath, user)
|
||||||
tpath);
|
tpath);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
execl(CLEANTMPCMD, CLEANTMPCMD, user, tpath, 0);
|
execl(CLEANTMPCMD, CLEANTMPCMD, user, tpath, (char *)0);
|
||||||
syslog(LOG_ERR, "TMPDIR cleanup(%s): execl(%s) failed: %m",
|
syslog(LOG_ERR, "TMPDIR cleanup(%s): execl(%s) failed: %m",
|
||||||
tpath, CLEANTMPCMD);
|
tpath, CLEANTMPCMD);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -2247,7 +2245,7 @@ rmut()
|
||||||
* This updates the utmpx and utmp entries and make a wtmp/x entry
|
* This updates the utmpx and utmp entries and make a wtmp/x entry
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SCPYN(utmpx.ut_line, line + sizeof("/dev/") - 1);
|
SCPYN(utmpx.ut_line, line + sizeof(_PATH_DEV) - 1);
|
||||||
utxp = getutxline(&utmpx);
|
utxp = getutxline(&utmpx);
|
||||||
if (utxp) {
|
if (utxp) {
|
||||||
utxp->ut_type = DEAD_PROCESS;
|
utxp->ut_type = DEAD_PROCESS;
|
||||||
|
@ -2308,7 +2306,7 @@ rmut()
|
||||||
}
|
}
|
||||||
(void) chmod(line, 0666);
|
(void) chmod(line, 0666);
|
||||||
(void) chown(line, 0, 0);
|
(void) chown(line, 0, 0);
|
||||||
line[strlen("/dev/")] = 'p';
|
line[strlen(_PATH_DEV)] = 'p';
|
||||||
(void) chmod(line, 0666);
|
(void) chmod(line, 0666);
|
||||||
(void) chown(line, 0, 0);
|
(void) chown(line, 0, 0);
|
||||||
} /* end of rmut */
|
} /* end of rmut */
|
||||||
|
|
|
@ -76,7 +76,7 @@ option may be used to start up
|
||||||
.Nm
|
.Nm
|
||||||
manually, instead of through
|
manually, instead of through
|
||||||
.Xr inetd 8 .
|
.Xr inetd 8 .
|
||||||
If started up this way,
|
If started up this way,
|
||||||
.Ar port
|
.Ar port
|
||||||
may be specified to run
|
may be specified to run
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -156,7 +156,7 @@ to print out debugging information
|
||||||
to the connection, allowing the user to see what
|
to the connection, allowing the user to see what
|
||||||
.Nm
|
.Nm
|
||||||
is doing.
|
is doing.
|
||||||
There are several possible values for
|
There are several possible values for
|
||||||
.Ar debugmode :
|
.Ar debugmode :
|
||||||
.Bl -tag -width exercise
|
.Bl -tag -width exercise
|
||||||
.It Cm options
|
.It Cm options
|
||||||
|
@ -164,7 +164,7 @@ Print information about the negotiation of
|
||||||
.Tn TELNET
|
.Tn TELNET
|
||||||
options.
|
options.
|
||||||
.It Cm report
|
.It Cm report
|
||||||
Print the
|
Print the
|
||||||
.Cm options
|
.Cm options
|
||||||
information, plus some additional information
|
information, plus some additional information
|
||||||
about what processing is going on.
|
about what processing is going on.
|
||||||
|
@ -339,7 +339,7 @@ a specific authentication type without having to recompile
|
||||||
operates by allocating a pseudo-terminal device (see
|
operates by allocating a pseudo-terminal device (see
|
||||||
.Xr pty 4 )
|
.Xr pty 4 )
|
||||||
for a client, then creating a login process which has
|
for a client, then creating a login process which has
|
||||||
the slave side of the pseudo-terminal as
|
the slave side of the pseudo-terminal as
|
||||||
.Dv stdin ,
|
.Dv stdin ,
|
||||||
.Dv stdout
|
.Dv stdout
|
||||||
and
|
and
|
||||||
|
@ -353,7 +353,7 @@ between the remote client and the login process.
|
||||||
.Pp
|
.Pp
|
||||||
When a
|
When a
|
||||||
.Tn TELNET
|
.Tn TELNET
|
||||||
session is started up,
|
session is started up,
|
||||||
.Nm
|
.Nm
|
||||||
sends
|
sends
|
||||||
.Tn TELNET
|
.Tn TELNET
|
||||||
|
@ -432,7 +432,7 @@ Whenever a
|
||||||
.Dv DO TIMING-MARK
|
.Dv DO TIMING-MARK
|
||||||
command is received, it is always responded
|
command is received, it is always responded
|
||||||
to with a
|
to with a
|
||||||
.Dv WILL TIMING-MARK
|
.Dv WILL TIMING-MARK .
|
||||||
.It "WILL LOGOUT"
|
.It "WILL LOGOUT"
|
||||||
When a
|
When a
|
||||||
.Dv DO LOGOUT
|
.Dv DO LOGOUT
|
||||||
|
@ -528,9 +528,34 @@ is compiled with support for data encryption, and
|
||||||
indicates a willingness to decrypt
|
indicates a willingness to decrypt
|
||||||
the data stream.
|
the data stream.
|
||||||
.El
|
.El
|
||||||
|
.Sh NOTES
|
||||||
|
By default
|
||||||
|
.Nm
|
||||||
|
will read the
|
||||||
|
.Em \&he ,
|
||||||
|
.Em \&hn ,
|
||||||
|
and
|
||||||
|
.Em \&im
|
||||||
|
capabilities from
|
||||||
|
.Pa /etc/gettytab
|
||||||
|
and use that information (if present) to determine
|
||||||
|
what to display before the login: prompt. You can
|
||||||
|
also use a System V style
|
||||||
|
.Pa /etc/issue
|
||||||
|
file by using the
|
||||||
|
.Em \&if
|
||||||
|
capability, which will override
|
||||||
|
.Em \&im .
|
||||||
|
The information specified in either
|
||||||
|
.Em \&im
|
||||||
|
or
|
||||||
|
.Em \&if
|
||||||
|
will be displayed to both console and remote logins.
|
||||||
|
.\" .Sh ENVIRONMENT
|
||||||
.Sh FILES
|
.Sh FILES
|
||||||
.Bl -tag -width /usr/ucb/bftp -compact
|
.Bl -tag -width /usr/ucb/bftp -compact
|
||||||
.It Pa /etc/services
|
.It Pa /etc/services
|
||||||
|
.It Pa /etc/gettytab
|
||||||
.It Pa /etc/inittab
|
.It Pa /etc/inittab
|
||||||
(UNICOS systems only)
|
(UNICOS systems only)
|
||||||
.It Pa /etc/iptos
|
.It Pa /etc/iptos
|
||||||
|
@ -541,6 +566,7 @@ the data stream.
|
||||||
.Sh "SEE ALSO"
|
.Sh "SEE ALSO"
|
||||||
.Xr bftp 1 ,
|
.Xr bftp 1 ,
|
||||||
.Xr login 1 ,
|
.Xr login 1 ,
|
||||||
|
.Xr gettytab 5 ,
|
||||||
.Xr telnet 1
|
.Xr telnet 1
|
||||||
(if supported)
|
(if supported)
|
||||||
.Sh STANDARDS
|
.Sh STANDARDS
|
||||||
|
|
|
@ -60,7 +60,9 @@ static const char rcsid[] =
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
#include <sys/mman.h>
|
||||||
#include <libutil.h>
|
#include <libutil.h>
|
||||||
|
#include <paths.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
|
|
||||||
#if defined(_SC_CRAY_SECURE_SYS)
|
#if defined(_SC_CRAY_SECURE_SYS)
|
||||||
|
@ -847,7 +849,6 @@ doit(who)
|
||||||
#else
|
#else
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char *lp;
|
char *lp;
|
||||||
extern char *line, *getpty();
|
|
||||||
|
|
||||||
if ((lp = getpty()) == NULL)
|
if ((lp = getpty()) == NULL)
|
||||||
fatal(net, "Out of ptys");
|
fatal(net, "Out of ptys");
|
||||||
|
@ -867,10 +868,10 @@ doit(who)
|
||||||
if (secflag) {
|
if (secflag) {
|
||||||
char slave_dev[16];
|
char slave_dev[16];
|
||||||
|
|
||||||
sprintf(tty_dev, "/dev/pty/%03d", ptynum);
|
sprintf(tty_dev, "%spty/%03d", _PATH_DEV, ptynum);
|
||||||
if (setdevs(tty_dev, &dv) < 0)
|
if (setdevs(tty_dev, &dv) < 0)
|
||||||
fatal(net, "cannot set pty security");
|
fatal(net, "cannot set pty security");
|
||||||
sprintf(slave_dev, "/dev/ttyp%03d", ptynum);
|
sprintf(slave_dev, "%sp%03d", _PATH_TTY, ptynum);
|
||||||
if (setdevs(slave_dev, &dv) < 0)
|
if (setdevs(slave_dev, &dv) < 0)
|
||||||
fatal(net, "cannot set tty security");
|
fatal(net, "cannot set tty security");
|
||||||
}
|
}
|
||||||
|
@ -880,7 +881,7 @@ doit(who)
|
||||||
if (realhostname_sa(remote_hostname, sizeof(remote_hostname) - 1,
|
if (realhostname_sa(remote_hostname, sizeof(remote_hostname) - 1,
|
||||||
who, who->sa_len) == HOSTNAME_INVALIDADDR && registerd_host_only)
|
who, who->sa_len) == HOSTNAME_INVALIDADDR && registerd_host_only)
|
||||||
fatal(net, "Couldn't resolve your address into a host name.\r\n\
|
fatal(net, "Couldn't resolve your address into a host name.\r\n\
|
||||||
Please contact your net administrator");
|
Please contact your net administrator");
|
||||||
remote_hostname[sizeof(remote_hostname) - 1] = '\0';
|
remote_hostname[sizeof(remote_hostname) - 1] = '\0';
|
||||||
|
|
||||||
trimdomain(remote_hostname, UT_HOSTSIZE);
|
trimdomain(remote_hostname, UT_HOSTSIZE);
|
||||||
|
|
|
@ -171,30 +171,30 @@ localstat()
|
||||||
|
|
||||||
if (uselinemode) {
|
if (uselinemode) {
|
||||||
/*
|
/*
|
||||||
* Check for state of BINARY options.
|
* Check for state of BINARY options.
|
||||||
*
|
*
|
||||||
* We only need to do the binary dance if we are actually going
|
* We only need to do the binary dance if we are actually going
|
||||||
* to use linemode. As this confuses some telnet clients
|
* to use linemode. As this confuses some telnet clients
|
||||||
* that don't support linemode, and doesn't gain us
|
* that don't support linemode, and doesn't gain us
|
||||||
* anything, we don't do it unless we're doing linemode.
|
* anything, we don't do it unless we're doing linemode.
|
||||||
* -Crh (henrich@msu.edu)
|
* -Crh (henrich@msu.edu)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (tty_isbinaryin()) {
|
if (tty_isbinaryin()) {
|
||||||
if (his_want_state_is_wont(TELOPT_BINARY))
|
if (his_want_state_is_wont(TELOPT_BINARY))
|
||||||
send_do(TELOPT_BINARY, 1);
|
send_do(TELOPT_BINARY, 1);
|
||||||
} else {
|
} else {
|
||||||
if (his_want_state_is_will(TELOPT_BINARY))
|
if (his_want_state_is_will(TELOPT_BINARY))
|
||||||
send_dont(TELOPT_BINARY, 1);
|
send_dont(TELOPT_BINARY, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tty_isbinaryout()) {
|
if (tty_isbinaryout()) {
|
||||||
if (my_want_state_is_wont(TELOPT_BINARY))
|
if (my_want_state_is_wont(TELOPT_BINARY))
|
||||||
send_will(TELOPT_BINARY, 1);
|
send_will(TELOPT_BINARY, 1);
|
||||||
} else {
|
} else {
|
||||||
if (my_want_state_is_will(TELOPT_BINARY))
|
if (my_want_state_is_will(TELOPT_BINARY))
|
||||||
send_wont(TELOPT_BINARY, 1);
|
send_wont(TELOPT_BINARY, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENCRYPTION
|
#ifdef ENCRYPTION
|
||||||
|
|
|
@ -43,6 +43,7 @@ static const char rcsid[] =
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <string.h>
|
||||||
#define PRINTOPTIONS
|
#define PRINTOPTIONS
|
||||||
#include "telnetd.h"
|
#include "telnetd.h"
|
||||||
|
|
||||||
|
@ -438,11 +439,6 @@ putf(cp, where)
|
||||||
char *slash;
|
char *slash;
|
||||||
time_t t;
|
time_t t;
|
||||||
char db[100];
|
char db[100];
|
||||||
#ifdef STREAMSPTY
|
|
||||||
extern char *strchr();
|
|
||||||
#else
|
|
||||||
extern char *strrchr();
|
|
||||||
#endif
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
static struct utsname kerninfo;
|
static struct utsname kerninfo;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user