clean up
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1653 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -31,25 +31,11 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "telnet_locl.h"
|
||||||
#ifdef SOCKS
|
|
||||||
#include <socks.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||||
#include <sys/types.h>
|
|
||||||
#include <arpa/telnet.h>
|
|
||||||
#include <libtelnet/encrypt.h>
|
|
||||||
#include <libtelnet/misc.h>
|
|
||||||
|
|
||||||
#include "general.h"
|
|
||||||
#include "ring.h"
|
|
||||||
#include "externs.h"
|
|
||||||
#include "defines.h"
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
net_write(unsigned char *str, int len)
|
net_write(unsigned char *str, int len)
|
||||||
{
|
{
|
||||||
@@ -63,7 +49,7 @@ net_write(unsigned char *str, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
net_encrypt()
|
net_encrypt(void)
|
||||||
{
|
{
|
||||||
#if defined(ENCRYPTION)
|
#if defined(ENCRYPTION)
|
||||||
if (encrypt_output)
|
if (encrypt_output)
|
||||||
@@ -74,7 +60,7 @@ net_encrypt()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
telnet_spin()
|
telnet_spin(void)
|
||||||
{
|
{
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@@ -97,7 +83,7 @@ telnet_gets(char *prompt, char *result, int length, int echo)
|
|||||||
if (echo) {
|
if (echo) {
|
||||||
printf("%s", prompt);
|
printf("%s", prompt);
|
||||||
res = fgets(result, length, stdin);
|
res = fgets(result, length, stdin);
|
||||||
} else if (res = getpass(prompt)) {
|
} else if ((res = getpass(prompt))) {
|
||||||
strncpy(result, res, length);
|
strncpy(result, res, length);
|
||||||
res = result;
|
res = result;
|
||||||
}
|
}
|
||||||
|
@@ -31,68 +31,10 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "telnet_locl.h"
|
||||||
#ifdef SOCKS
|
|
||||||
#include <socks.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
|
||||||
#include <fcntl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_NETDB_H
|
|
||||||
#include <netdb.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_PWD_H
|
|
||||||
#include <pwd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_PARAM_H
|
|
||||||
#include <sys/param.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_FILE_H
|
|
||||||
#include <sys/file.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETINET_IN_H
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETINET_IN_SYSTM_H
|
|
||||||
#include <netinet/in_systm.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETINET_IP_H
|
|
||||||
#include <netinet/ip.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ARPA_TELNET_H
|
|
||||||
#include <arpa/telnet.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "general.h"
|
|
||||||
#include "ring.h"
|
|
||||||
|
|
||||||
#include "externs.h"
|
|
||||||
#include "defines.h"
|
|
||||||
#include "types.h"
|
|
||||||
#include "libtelnet/misc-proto.h"
|
|
||||||
|
|
||||||
#include "roken.h"
|
|
||||||
|
|
||||||
#if defined(IPPROTO_IP) && defined(IP_TOS)
|
#if defined(IPPROTO_IP) && defined(IP_TOS)
|
||||||
int tos = -1;
|
int tos = -1;
|
||||||
#endif /* defined(IPPROTO_IP) && defined(IP_TOS) */
|
#endif /* defined(IPPROTO_IP) && defined(IP_TOS) */
|
||||||
@@ -129,7 +71,7 @@ makeargv()
|
|||||||
margc++;
|
margc++;
|
||||||
cp++;
|
cp++;
|
||||||
}
|
}
|
||||||
while (c = *cp) {
|
while ((c = *cp)) {
|
||||||
int inquote = 0;
|
int inquote = 0;
|
||||||
while (isspace(c))
|
while (isspace(c))
|
||||||
c = *++cp;
|
c = *++cp;
|
||||||
@@ -373,6 +315,9 @@ sendcmd(int argc, char **argv)
|
|||||||
return (count == success);
|
return (count == success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
send_tncmd(void (*func)(), char *cmd, char *name);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
send_esc()
|
send_esc()
|
||||||
{
|
{
|
||||||
@@ -404,7 +349,7 @@ send_wontcmd(char *name)
|
|||||||
return(send_tncmd(send_wont, "wont", name));
|
return(send_tncmd(send_wont, "wont", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
send_tncmd(void (*func)(), char *cmd, char *name)
|
send_tncmd(void (*func)(), char *cmd, char *name)
|
||||||
{
|
{
|
||||||
char **cpp;
|
char **cpp;
|
||||||
@@ -845,55 +790,26 @@ static struct setlist Setlist[] = {
|
|||||||
{ "tracefile", "file to write trace information to", SetNetTrace, (cc_t *)NetTraceFile},
|
{ "tracefile", "file to write trace information to", SetNetTrace, (cc_t *)NetTraceFile},
|
||||||
{ " ", "" },
|
{ " ", "" },
|
||||||
{ " ", "The following need 'localchars' to be toggled true", 0, 0 },
|
{ " ", "The following need 'localchars' to be toggled true", 0, 0 },
|
||||||
{ "flushoutput", "character to cause an Abort Output", 0, termFlushCharp },
|
{ "flushoutput", "character to cause an Abort Output", 0, &termFlushChar },
|
||||||
{ "interrupt", "character to cause an Interrupt Process", 0, termIntCharp },
|
{ "interrupt", "character to cause an Interrupt Process", 0, &termIntChar },
|
||||||
{ "quit", "character to cause an Abort process", 0, termQuitCharp },
|
{ "quit", "character to cause an Abort process", 0, &termQuitChar },
|
||||||
{ "eof", "character to cause an EOF ", 0, termEofCharp },
|
{ "eof", "character to cause an EOF ", 0, &termEofChar },
|
||||||
{ " ", "" },
|
{ " ", "" },
|
||||||
{ " ", "The following are for local editing in linemode", 0, 0 },
|
{ " ", "The following are for local editing in linemode", 0, 0 },
|
||||||
{ "erase", "character to use to erase a character", 0, termEraseCharp },
|
{ "erase", "character to use to erase a character", 0, &termEraseChar },
|
||||||
{ "kill", "character to use to erase a line", 0, termKillCharp },
|
{ "kill", "character to use to erase a line", 0, &termKillChar },
|
||||||
{ "lnext", "character to use for literal next", 0, termLiteralNextCharp },
|
{ "lnext", "character to use for literal next", 0, &termLiteralNextChar },
|
||||||
{ "susp", "character to cause a Suspend Process", 0, termSuspCharp },
|
{ "susp", "character to cause a Suspend Process", 0, &termSuspChar },
|
||||||
{ "reprint", "character to use for line reprint", 0, termRprntCharp },
|
{ "reprint", "character to use for line reprint", 0, &termRprntChar },
|
||||||
{ "worderase", "character to use to erase a word", 0, termWerasCharp },
|
{ "worderase", "character to use to erase a word", 0, &termWerasChar },
|
||||||
{ "start", "character to use for XON", 0, termStartCharp },
|
{ "start", "character to use for XON", 0, &termStartChar },
|
||||||
{ "stop", "character to use for XOFF", 0, termStopCharp },
|
{ "stop", "character to use for XOFF", 0, &termStopChar },
|
||||||
{ "forw1", "alternate end of line character", 0, termForw1Charp },
|
{ "forw1", "alternate end of line character", 0, &termForw1Char },
|
||||||
{ "forw2", "alternate end of line character", 0, termForw2Charp },
|
{ "forw2", "alternate end of line character", 0, &termForw2Char },
|
||||||
{ "ayt", "alternate AYT character", 0, termAytCharp },
|
{ "ayt", "alternate AYT character", 0, &termAytChar },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CRAY) && !defined(__STDC__)
|
|
||||||
/* Work around compiler bug in pcc 4.1.5 */
|
|
||||||
void
|
|
||||||
_setlist_init()
|
|
||||||
{
|
|
||||||
#ifndef KLUDGELINEMODE
|
|
||||||
#define N 5
|
|
||||||
#else
|
|
||||||
#define N 6
|
|
||||||
#endif
|
|
||||||
Setlist[N+0].charp = &termFlushChar;
|
|
||||||
Setlist[N+1].charp = &termIntChar;
|
|
||||||
Setlist[N+2].charp = &termQuitChar;
|
|
||||||
Setlist[N+3].charp = &termEofChar;
|
|
||||||
Setlist[N+6].charp = &termEraseChar;
|
|
||||||
Setlist[N+7].charp = &termKillChar;
|
|
||||||
Setlist[N+8].charp = &termLiteralNextChar;
|
|
||||||
Setlist[N+9].charp = &termSuspChar;
|
|
||||||
Setlist[N+10].charp = &termRprntChar;
|
|
||||||
Setlist[N+11].charp = &termWerasChar;
|
|
||||||
Setlist[N+12].charp = &termStartChar;
|
|
||||||
Setlist[N+13].charp = &termStopChar;
|
|
||||||
Setlist[N+14].charp = &termForw1Char;
|
|
||||||
Setlist[N+15].charp = &termForw2Char;
|
|
||||||
Setlist[N+16].charp = &termAytChar;
|
|
||||||
#undef N
|
|
||||||
}
|
|
||||||
#endif /* defined(CRAY) && !defined(__STDC__) */
|
|
||||||
|
|
||||||
static struct setlist *
|
static struct setlist *
|
||||||
getset(char *name)
|
getset(char *name)
|
||||||
{
|
{
|
||||||
@@ -1129,7 +1045,7 @@ struct modelist {
|
|||||||
int arg1;
|
int arg1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int modehelp();
|
static int modehelp(void);
|
||||||
|
|
||||||
static struct modelist ModeList[] = {
|
static struct modelist ModeList[] = {
|
||||||
{ "character", "Disable LINEMODE option", docharmode, 1 },
|
{ "character", "Disable LINEMODE option", docharmode, 1 },
|
||||||
@@ -1165,7 +1081,7 @@ static struct modelist ModeList[] = {
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
modehelp()
|
modehelp(void)
|
||||||
{
|
{
|
||||||
struct modelist *mt;
|
struct modelist *mt;
|
||||||
|
|
||||||
@@ -1438,7 +1354,7 @@ struct slclist {
|
|||||||
int arg;
|
int arg;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void slc_help();
|
static void slc_help(void);
|
||||||
|
|
||||||
struct slclist SlcList[] = {
|
struct slclist SlcList[] = {
|
||||||
{ "export", "Use local special character definitions",
|
{ "export", "Use local special character definitions",
|
||||||
@@ -1453,7 +1369,7 @@ struct slclist SlcList[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
slc_help()
|
slc_help(void)
|
||||||
{
|
{
|
||||||
struct slclist *c;
|
struct slclist *c;
|
||||||
|
|
||||||
@@ -1511,16 +1427,7 @@ struct envlist {
|
|||||||
int narg;
|
int narg;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct env_lst *
|
static void env_help (void);
|
||||||
env_define (unsigned char *, unsigned char *);
|
|
||||||
extern void
|
|
||||||
env_undefine (unsigned char *),
|
|
||||||
env_export (unsigned char *),
|
|
||||||
env_unexport (unsigned char *),
|
|
||||||
env_send (unsigned char *),
|
|
||||||
env_list (void);
|
|
||||||
static void
|
|
||||||
env_help (void);
|
|
||||||
|
|
||||||
struct envlist EnvList[] = {
|
struct envlist EnvList[] = {
|
||||||
{ "define", "Define an environment variable",
|
{ "define", "Define an environment variable",
|
||||||
@@ -1621,14 +1528,14 @@ env_find(unsigned char *var)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
env_init()
|
env_init(void)
|
||||||
{
|
{
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
char **epp, *cp;
|
char **epp, *cp;
|
||||||
struct env_lst *ep;
|
struct env_lst *ep;
|
||||||
|
|
||||||
for (epp = environ; *epp; epp++) {
|
for (epp = environ; *epp; epp++) {
|
||||||
if (cp = strchr(*epp, '=')) {
|
if ((cp = strchr(*epp, '='))) {
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
ep = env_define((unsigned char *)*epp,
|
ep = env_define((unsigned char *)*epp,
|
||||||
(unsigned char *)cp+1);
|
(unsigned char *)cp+1);
|
||||||
@@ -1642,8 +1549,8 @@ env_init()
|
|||||||
* hostname.
|
* hostname.
|
||||||
*/
|
*/
|
||||||
if ((ep = env_find("DISPLAY"))
|
if ((ep = env_find("DISPLAY"))
|
||||||
&& ((*ep->value == ':')
|
&& (*ep->value == ':'
|
||||||
|| (strncmp((char *)ep->value, "unix:", 5) == 0))) {
|
|| strncmp((char *)ep->value, "unix:", 5) == 0)) {
|
||||||
char hbuf[256+1];
|
char hbuf[256+1];
|
||||||
char *cp2 = strchr((char *)ep->value, ':');
|
char *cp2 = strchr((char *)ep->value, ':');
|
||||||
|
|
||||||
@@ -1681,7 +1588,7 @@ env_define(unsigned char *var, unsigned char *value)
|
|||||||
{
|
{
|
||||||
struct env_lst *ep;
|
struct env_lst *ep;
|
||||||
|
|
||||||
if (ep = env_find(var)) {
|
if ((ep = env_find(var))) {
|
||||||
if (ep->var)
|
if (ep->var)
|
||||||
free(ep->var);
|
free(ep->var);
|
||||||
if (ep->value)
|
if (ep->value)
|
||||||
@@ -1706,7 +1613,7 @@ env_undefine(unsigned char *var)
|
|||||||
{
|
{
|
||||||
struct env_lst *ep;
|
struct env_lst *ep;
|
||||||
|
|
||||||
if (ep = env_find(var)) {
|
if ((ep = env_find(var))) {
|
||||||
ep->prev->next = ep->next;
|
ep->prev->next = ep->next;
|
||||||
if (ep->next)
|
if (ep->next)
|
||||||
ep->next->prev = ep->prev;
|
ep->next->prev = ep->prev;
|
||||||
@@ -1723,7 +1630,7 @@ env_export(unsigned char *var)
|
|||||||
{
|
{
|
||||||
struct env_lst *ep;
|
struct env_lst *ep;
|
||||||
|
|
||||||
if (ep = env_find(var))
|
if ((ep = env_find(var)))
|
||||||
ep->export = 1;
|
ep->export = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1732,7 +1639,7 @@ env_unexport(unsigned char *var)
|
|||||||
{
|
{
|
||||||
struct env_lst *ep;
|
struct env_lst *ep;
|
||||||
|
|
||||||
if (ep = env_find(var))
|
if ((ep = env_find(var)))
|
||||||
ep->export = 0;
|
ep->export = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1763,7 +1670,7 @@ env_send(unsigned char *var)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
env_list()
|
env_list(void)
|
||||||
{
|
{
|
||||||
struct env_lst *ep;
|
struct env_lst *ep;
|
||||||
|
|
||||||
@@ -1783,7 +1690,7 @@ env_default(int init, int welldefined)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (nep) {
|
if (nep) {
|
||||||
while (nep = nep->next) {
|
while ((nep = nep->next)) {
|
||||||
if (nep->export && (nep->welldefined == welldefined))
|
if (nep->export && (nep->welldefined == welldefined))
|
||||||
return(nep->var);
|
return(nep->var);
|
||||||
}
|
}
|
||||||
@@ -1796,7 +1703,7 @@ env_getvalue(unsigned char *var)
|
|||||||
{
|
{
|
||||||
struct env_lst *ep;
|
struct env_lst *ep;
|
||||||
|
|
||||||
if (ep = env_find(var))
|
if ((ep = env_find(var)))
|
||||||
return(ep->value);
|
return(ep->value);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
@@ -1814,10 +1721,6 @@ struct authlist {
|
|||||||
int narg;
|
int narg;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int
|
|
||||||
auth_enable (char *),
|
|
||||||
auth_disable (char *),
|
|
||||||
auth_status (void);
|
|
||||||
static int
|
static int
|
||||||
auth_help (void);
|
auth_help (void);
|
||||||
|
|
||||||
@@ -1898,17 +1801,6 @@ struct encryptlist {
|
|||||||
int maxarg;
|
int maxarg;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int
|
|
||||||
EncryptEnable (char *, char *),
|
|
||||||
EncryptDisable (char *, char *),
|
|
||||||
EncryptType (char *, char *),
|
|
||||||
EncryptStart (char *),
|
|
||||||
EncryptStartInput (void),
|
|
||||||
EncryptStartOutput (void),
|
|
||||||
EncryptStop (char *),
|
|
||||||
EncryptStopInput (void),
|
|
||||||
EncryptStopOutput (void),
|
|
||||||
EncryptStatus (void);
|
|
||||||
static int
|
static int
|
||||||
EncryptHelp (void);
|
EncryptHelp (void);
|
||||||
|
|
||||||
@@ -2045,14 +1937,13 @@ status(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* Function that gets called when SIGINFO is received.
|
* Function that gets called when SIGINFO is received.
|
||||||
*/
|
*/
|
||||||
ayt_status()
|
void
|
||||||
|
ayt_status(void)
|
||||||
{
|
{
|
||||||
call(status, "status", "notmuch", 0);
|
call(status, "status", "notmuch", 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned long inet_addr();
|
|
||||||
|
|
||||||
static char *rcname = 0;
|
static char *rcname = 0;
|
||||||
static char rcbuf[128];
|
static char rcbuf[128];
|
||||||
|
|
||||||
@@ -2148,7 +2039,7 @@ tn(int argc, char **argv)
|
|||||||
extern char *inet_ntoa();
|
extern char *inet_ntoa();
|
||||||
#if defined(IP_OPTIONS) && defined(IPPROTO_IP)
|
#if defined(IP_OPTIONS) && defined(IPPROTO_IP)
|
||||||
char *srp = 0;
|
char *srp = 0;
|
||||||
unsigned long sourceroute(), srlen;
|
int srlen;
|
||||||
#endif
|
#endif
|
||||||
char *cmd, *hostp = 0, *portp = 0, *user = 0;
|
char *cmd, *hostp = 0, *portp = 0, *user = 0;
|
||||||
|
|
||||||
@@ -2360,7 +2251,7 @@ tn(int argc, char **argv)
|
|||||||
user = getenv("USER");
|
user = getenv("USER");
|
||||||
if (user == NULL ||
|
if (user == NULL ||
|
||||||
((pw = k_getpwnam(user)) && pw->pw_uid != getuid())) {
|
((pw = k_getpwnam(user)) && pw->pw_uid != getuid())) {
|
||||||
if (pw = k_getpwuid(getuid()))
|
if ((pw = k_getpwuid(getuid())))
|
||||||
user = pw->pw_name;
|
user = pw->pw_name;
|
||||||
else
|
else
|
||||||
user = NULL;
|
user = NULL;
|
||||||
@@ -2376,6 +2267,7 @@ tn(int argc, char **argv)
|
|||||||
NetClose(net);
|
NetClose(net);
|
||||||
ExitString("Connection closed by foreign host.\r\n",1);
|
ExitString("Connection closed by foreign host.\r\n",1);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HELPINDENT (sizeof ("connect"))
|
#define HELPINDENT (sizeof ("connect"))
|
||||||
@@ -2404,7 +2296,7 @@ static char
|
|||||||
envhelp[] = "change environment variables ('environ ?' for more)",
|
envhelp[] = "change environment variables ('environ ?' for more)",
|
||||||
modestring[] = "try to enter line or character mode ('mode ?' for more)";
|
modestring[] = "try to enter line or character mode ('mode ?' for more)";
|
||||||
|
|
||||||
static int help();
|
static int help(int argc, char **argv);
|
||||||
|
|
||||||
static Command cmdtab[] = {
|
static Command cmdtab[] = {
|
||||||
{ "close", closehelp, bye, 1 },
|
{ "close", closehelp, bye, 1 },
|
||||||
@@ -2466,7 +2358,7 @@ static Command
|
|||||||
{
|
{
|
||||||
Command *cm;
|
Command *cm;
|
||||||
|
|
||||||
if (cm = (Command *) genget(name, (char **) cmdtab, sizeof(Command)))
|
if ((cm = (Command *) genget(name, (char **) cmdtab, sizeof(Command))))
|
||||||
return cm;
|
return cm;
|
||||||
return (Command *) genget(name, (char **) cmdtab2, sizeof(Command));
|
return (Command *) genget(name, (char **) cmdtab2, sizeof(Command));
|
||||||
}
|
}
|
||||||
@@ -2618,9 +2510,6 @@ unsigned long
|
|||||||
sourceroute(char *arg, char **cpp, int *lenp)
|
sourceroute(char *arg, char **cpp, int *lenp)
|
||||||
{
|
{
|
||||||
static char lsr[44];
|
static char lsr[44];
|
||||||
#ifdef sysV88
|
|
||||||
static IOPTN ipopt;
|
|
||||||
#endif
|
|
||||||
char *cp, *cp2, *lsrp, *lsrep;
|
char *cp, *cp2, *lsrp, *lsrep;
|
||||||
int tmp;
|
int tmp;
|
||||||
struct in_addr sin_addr;
|
struct in_addr sin_addr;
|
||||||
@@ -2654,27 +2543,17 @@ sourceroute(char *arg, char **cpp, int *lenp)
|
|||||||
* route or a strict source route, and fill in
|
* route or a strict source route, and fill in
|
||||||
* the begining of the option.
|
* the begining of the option.
|
||||||
*/
|
*/
|
||||||
#ifndef sysV88
|
|
||||||
if (*cp == '!') {
|
if (*cp == '!') {
|
||||||
cp++;
|
cp++;
|
||||||
*lsrp++ = IPOPT_SSRR;
|
*lsrp++ = IPOPT_SSRR;
|
||||||
} else
|
} else
|
||||||
*lsrp++ = IPOPT_LSRR;
|
*lsrp++ = IPOPT_LSRR;
|
||||||
#else
|
|
||||||
if (*cp == '!') {
|
|
||||||
cp++;
|
|
||||||
ipopt.io_type = IPOPT_SSRR;
|
|
||||||
} else
|
|
||||||
ipopt.io_type = IPOPT_LSRR;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (*cp != '@')
|
if (*cp != '@')
|
||||||
return((unsigned long)-1);
|
return((unsigned long)-1);
|
||||||
|
|
||||||
#ifndef sysV88
|
|
||||||
lsrp++; /* skip over length, we'll fill it in later */
|
lsrp++; /* skip over length, we'll fill it in later */
|
||||||
*lsrp++ = 4;
|
*lsrp++ = 4;
|
||||||
#endif
|
|
||||||
|
|
||||||
cp++;
|
cp++;
|
||||||
|
|
||||||
@@ -2683,7 +2562,7 @@ sourceroute(char *arg, char **cpp, int *lenp)
|
|||||||
for (c = 0;;) {
|
for (c = 0;;) {
|
||||||
if (c == ':')
|
if (c == ':')
|
||||||
cp2 = 0;
|
cp2 = 0;
|
||||||
else for (cp2 = cp; c = *cp2; cp2++) {
|
else for (cp2 = cp; (c = *cp2); cp2++) {
|
||||||
if (c == ',') {
|
if (c == ',') {
|
||||||
*cp2++ = '\0';
|
*cp2++ = '\0';
|
||||||
if (*cp2 == '@')
|
if (*cp2 == '@')
|
||||||
@@ -2701,7 +2580,7 @@ sourceroute(char *arg, char **cpp, int *lenp)
|
|||||||
|
|
||||||
if ((tmp = inet_addr(cp)) != -1) {
|
if ((tmp = inet_addr(cp)) != -1) {
|
||||||
sin_addr.s_addr = tmp;
|
sin_addr.s_addr = tmp;
|
||||||
} else if (host = gethostbyname(cp)) {
|
} else if ((host = gethostbyname(cp))) {
|
||||||
#if defined(h_addr)
|
#if defined(h_addr)
|
||||||
memmove(&sin_addr,
|
memmove(&sin_addr,
|
||||||
host->h_addr_list[0],
|
host->h_addr_list[0],
|
||||||
@@ -2726,7 +2605,6 @@ sourceroute(char *arg, char **cpp, int *lenp)
|
|||||||
if (lsrp + 4 > lsrep)
|
if (lsrp + 4 > lsrep)
|
||||||
return((unsigned long)-1);
|
return((unsigned long)-1);
|
||||||
}
|
}
|
||||||
#ifndef sysV88
|
|
||||||
if ((*(*cpp+IPOPT_OLEN) = lsrp - *cpp) <= 7) {
|
if ((*(*cpp+IPOPT_OLEN) = lsrp - *cpp) <= 7) {
|
||||||
*cpp = 0;
|
*cpp = 0;
|
||||||
*lenp = 0;
|
*lenp = 0;
|
||||||
@@ -2734,16 +2612,6 @@ sourceroute(char *arg, char **cpp, int *lenp)
|
|||||||
}
|
}
|
||||||
*lsrp++ = IPOPT_NOP; /* 32 bit word align it */
|
*lsrp++ = IPOPT_NOP; /* 32 bit word align it */
|
||||||
*lenp = lsrp - *cpp;
|
*lenp = lsrp - *cpp;
|
||||||
#else
|
|
||||||
ipopt.io_len = lsrp - *cpp;
|
|
||||||
if (ipopt.io_len <= 5) { /* Is 3 better ? */
|
|
||||||
*cpp = 0;
|
|
||||||
*lenp = 0;
|
|
||||||
return((unsigned long)-1);
|
|
||||||
}
|
|
||||||
*lenp = sizeof(ipopt);
|
|
||||||
*cpp = (char *) &ipopt;
|
|
||||||
#endif
|
|
||||||
return(sin_addr.s_addr);
|
return(sin_addr.s_addr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -35,27 +35,10 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <setjmp.h>
|
|
||||||
#if defined(CRAY) && !defined(NO_BSD_SETJMP)
|
|
||||||
#include <bsdsetjmp.h>
|
|
||||||
#endif
|
|
||||||
/* not with SunOS 4 */
|
|
||||||
#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_FILIO_H
|
|
||||||
#include <sys/filio.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#ifndef BSD
|
#ifndef BSD
|
||||||
# define BSD 43
|
# define BSD 43
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <termios.h>
|
|
||||||
|
|
||||||
#ifndef _POSIX_VDISABLE
|
#ifndef _POSIX_VDISABLE
|
||||||
# ifdef sun
|
# ifdef sun
|
||||||
# include <sys/param.h> /* pick up VDISABLE definition, mayby */
|
# include <sys/param.h> /* pick up VDISABLE definition, mayby */
|
||||||
@@ -192,74 +175,182 @@ extern jmp_buf
|
|||||||
peerdied,
|
peerdied,
|
||||||
toplevel; /* For error conditions. */
|
toplevel; /* For error conditions. */
|
||||||
|
|
||||||
extern void
|
/* authenc.c */
|
||||||
command (int, char *, int),
|
|
||||||
Dump (char, unsigned char *, int),
|
|
||||||
printoption (char *, int, int),
|
|
||||||
printsub (char, unsigned char *, int),
|
|
||||||
sendnaws (void),
|
|
||||||
setconnmode (int),
|
|
||||||
setcommandmode (void),
|
|
||||||
setneturg (void),
|
|
||||||
sys_telnet_init (void),
|
|
||||||
telnet (char *),
|
|
||||||
tel_enter_binary (int),
|
|
||||||
TerminalFlushOutput (void),
|
|
||||||
TerminalNewMode (int),
|
|
||||||
TerminalRestoreState (void),
|
|
||||||
TerminalSaveState (void),
|
|
||||||
tninit (void),
|
|
||||||
willoption (int),
|
|
||||||
wontoption (int);
|
|
||||||
|
|
||||||
extern void
|
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||||
send_do (int, int),
|
int net_write(unsigned char *str, int len);
|
||||||
send_dont (int, int),
|
void net_encrypt(void);
|
||||||
send_will (int, int),
|
int telnet_spin(void);
|
||||||
send_wont (int, int);
|
char *telnet_getenv(char *val);
|
||||||
|
char *telnet_gets(char *prompt, char *result, int length, int echo);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern void
|
/* commands.c */
|
||||||
lm_will (unsigned char *, int),
|
|
||||||
lm_wont (unsigned char *, int),
|
|
||||||
lm_do (unsigned char *, int),
|
|
||||||
lm_dont (unsigned char *, int),
|
|
||||||
lm_mode (unsigned char *, int, int);
|
|
||||||
|
|
||||||
extern void
|
struct env_lst *env_define (unsigned char *, unsigned char *);
|
||||||
slc_init (void),
|
struct env_lst *env_find(unsigned char *var);
|
||||||
slcstate (void),
|
void env_init (void);
|
||||||
slc_mode_export (void),
|
void env_undefine (unsigned char *);
|
||||||
slc_mode_import (int),
|
void env_export (unsigned char *);
|
||||||
slc_import (int),
|
void env_unexport (unsigned char *);
|
||||||
slc_export (void),
|
void env_send (unsigned char *);
|
||||||
slc (unsigned char *, int),
|
void env_list (void);
|
||||||
slc_check (void),
|
unsigned char * env_default(int init, int welldefined);
|
||||||
slc_start_reply (void),
|
unsigned char * env_getvalue(unsigned char *var);
|
||||||
slc_add_reply (unsigned char, unsigned char, cc_t),
|
|
||||||
slc_end_reply (void);
|
|
||||||
extern int
|
|
||||||
slc_update (void);
|
|
||||||
|
|
||||||
extern void
|
void set_escape_char(char *s);
|
||||||
env_opt (unsigned char *, int),
|
unsigned long sourceroute(char *arg, char **cpp, int *lenp);
|
||||||
env_opt_start (void),
|
|
||||||
env_opt_start_info (void),
|
|
||||||
env_opt_add (unsigned char *),
|
|
||||||
env_opt_end (int);
|
|
||||||
|
|
||||||
extern unsigned char
|
#if defined(AUTHENTICATION)
|
||||||
*env_default (int, int),
|
int auth_enable (char *);
|
||||||
*env_getvalue (unsigned char *);
|
int auth_disable (char *);
|
||||||
|
int auth_status (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int
|
#if defined(ENCRYPTION)
|
||||||
get_status (void),
|
int EncryptEnable (char *, char *);
|
||||||
dosynch (void);
|
int EncryptDisable (char *, char *);
|
||||||
|
int EncryptType (char *, char *);
|
||||||
|
int EncryptStart (char *);
|
||||||
|
int EncryptStartInput (void);
|
||||||
|
int EncryptStartOutput (void);
|
||||||
|
int EncryptStop (char *);
|
||||||
|
int EncryptStopInput (void);
|
||||||
|
int EncryptStopOutput (void);
|
||||||
|
int EncryptStatus (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern cc_t
|
#ifdef SIGINFO
|
||||||
*tcval (int);
|
void ayt_status(void);
|
||||||
|
#endif
|
||||||
|
int tn(int argc, char **argv);
|
||||||
|
void command(int top, char *tbuf, int cnt);
|
||||||
|
|
||||||
extern int quit (void);
|
/* main.c */
|
||||||
|
|
||||||
|
void tninit(void);
|
||||||
|
void usage(void);
|
||||||
|
|
||||||
|
/* network.c */
|
||||||
|
|
||||||
|
void init_network(void);
|
||||||
|
int stilloob(void);
|
||||||
|
void setneturg(void);
|
||||||
|
int netflush(void);
|
||||||
|
|
||||||
|
/* sys_bsd.c */
|
||||||
|
|
||||||
|
void init_sys(void);
|
||||||
|
int TerminalWrite(char *buf, int n);
|
||||||
|
int TerminalRead(unsigned char *buf, int n);
|
||||||
|
int TerminalAutoFlush(void);
|
||||||
|
int TerminalSpecialChars(int c);
|
||||||
|
void TerminalFlushOutput(void);
|
||||||
|
void TerminalSaveState(void);
|
||||||
|
void TerminalDefaultChars(void);
|
||||||
|
void TerminalNewMode(int f);
|
||||||
|
cc_t *tcval(int func);
|
||||||
|
void TerminalSpeeds(long *ispeed, long *ospeed);
|
||||||
|
int TerminalWindowSize(long *rows, long *cols);
|
||||||
|
int NetClose(int fd);
|
||||||
|
void NetNonblockingIO(int fd, int onoff);
|
||||||
|
int process_rings(int netin, int netout, int netex, int ttyin, int ttyout,
|
||||||
|
int poll);
|
||||||
|
|
||||||
|
/* telnet.c */
|
||||||
|
|
||||||
|
void init_telnet(void);
|
||||||
|
|
||||||
|
void tel_leave_binary(int rw);
|
||||||
|
void tel_enter_binary(int rw);
|
||||||
|
int opt_welldefined(char *ep);
|
||||||
|
int telrcv(void);
|
||||||
|
int rlogin_susp(void);
|
||||||
|
void intp(void);
|
||||||
|
void sendbrk(void);
|
||||||
|
void sendabort(void);
|
||||||
|
void sendsusp(void);
|
||||||
|
void sendeof(void);
|
||||||
|
void sendayt(void);
|
||||||
|
|
||||||
|
void xmitAO(void);
|
||||||
|
void xmitEL(void);
|
||||||
|
void xmitEC(void);
|
||||||
|
|
||||||
|
|
||||||
|
void Dump (char, unsigned char *, int);
|
||||||
|
void printoption (char *, int, int);
|
||||||
|
void printsub (char, unsigned char *, int);
|
||||||
|
void sendnaws (void);
|
||||||
|
void setconnmode (int);
|
||||||
|
void setcommandmode (void);
|
||||||
|
void setneturg (void);
|
||||||
|
void sys_telnet_init (void);
|
||||||
|
void telnet (char *);
|
||||||
|
void tel_enter_binary (int);
|
||||||
|
void TerminalFlushOutput (void);
|
||||||
|
void TerminalNewMode (int);
|
||||||
|
void TerminalRestoreState (void);
|
||||||
|
void TerminalSaveState (void);
|
||||||
|
void tninit (void);
|
||||||
|
void willoption (int);
|
||||||
|
void wontoption (int);
|
||||||
|
|
||||||
|
|
||||||
|
void send_do (int, int);
|
||||||
|
void send_dont (int, int);
|
||||||
|
void send_will (int, int);
|
||||||
|
void send_wont (int, int);
|
||||||
|
|
||||||
|
void lm_will (unsigned char *, int);
|
||||||
|
void lm_wont (unsigned char *, int);
|
||||||
|
void lm_do (unsigned char *, int);
|
||||||
|
void lm_dont (unsigned char *, int);
|
||||||
|
void lm_mode (unsigned char *, int, int);
|
||||||
|
|
||||||
|
void slc_init (void);
|
||||||
|
void slcstate (void);
|
||||||
|
void slc_mode_export (void);
|
||||||
|
void slc_mode_import (int);
|
||||||
|
void slc_import (int);
|
||||||
|
void slc_export (void);
|
||||||
|
void slc (unsigned char *, int);
|
||||||
|
void slc_check (void);
|
||||||
|
void slc_start_reply (void);
|
||||||
|
void slc_add_reply (unsigned char, unsigned char, cc_t);
|
||||||
|
void slc_end_reply (void);
|
||||||
|
int slc_update (void);
|
||||||
|
|
||||||
|
void env_opt (unsigned char *, int);
|
||||||
|
void env_opt_start (void);
|
||||||
|
void env_opt_start_info (void);
|
||||||
|
void env_opt_add (unsigned char *);
|
||||||
|
void env_opt_end (int);
|
||||||
|
|
||||||
|
unsigned char *env_default (int, int);
|
||||||
|
unsigned char *env_getvalue (unsigned char *);
|
||||||
|
|
||||||
|
int get_status (void);
|
||||||
|
int dosynch (void);
|
||||||
|
|
||||||
|
cc_t *tcval (int);
|
||||||
|
|
||||||
|
int quit (void);
|
||||||
|
|
||||||
|
/* terminal.c */
|
||||||
|
|
||||||
|
void init_terminal(void);
|
||||||
|
int ttyflush(int drop);
|
||||||
|
int getconnmode(void);
|
||||||
|
|
||||||
|
/* utilities.c */
|
||||||
|
|
||||||
|
int SetSockOpt(int fd, int level, int option, int yesno);
|
||||||
|
void optionstatus(void);
|
||||||
|
void EmptyTerminal(void);
|
||||||
|
void SetForExit(void);
|
||||||
|
void Exit(int returnCode);
|
||||||
|
void ExitString(char *string, int returnCode);
|
||||||
|
|
||||||
extern struct termios new_tc;
|
extern struct termios new_tc;
|
||||||
|
|
||||||
@@ -323,23 +414,6 @@ extern cc_t termAytChar;
|
|||||||
# define termAytChar new_tc.c_cc[VSTATUS]
|
# define termAytChar new_tc.c_cc[VSTATUS]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# define termEofCharp &termEofChar
|
|
||||||
# define termEraseCharp &termEraseChar
|
|
||||||
# define termIntCharp &termIntChar
|
|
||||||
# define termKillCharp &termKillChar
|
|
||||||
# define termQuitCharp &termQuitChar
|
|
||||||
# define termSuspCharp &termSuspChar
|
|
||||||
# define termFlushCharp &termFlushChar
|
|
||||||
# define termWerasCharp &termWerasChar
|
|
||||||
# define termRprntCharp &termRprntChar
|
|
||||||
# define termLiteralNextCharp &termLiteralNextChar
|
|
||||||
# define termStartCharp &termStartChar
|
|
||||||
# define termStopCharp &termStopChar
|
|
||||||
# define termForw1Charp &termForw1Char
|
|
||||||
# define termForw2Charp &termForw2Char
|
|
||||||
# define termAytCharp &termAytChar
|
|
||||||
|
|
||||||
|
|
||||||
/* Ring buffer structures which are shared */
|
/* Ring buffer structures which are shared */
|
||||||
|
|
||||||
extern Ring
|
extern Ring
|
||||||
|
@@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 1988, 1993
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* @(#)fdset.h 8.1 (Berkeley) 6/6/93
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following is defined just in case someone should want to run
|
|
||||||
* this telnet on a 4.2 system.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef FD_SETSIZE
|
|
||||||
|
|
||||||
#define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n)))
|
|
||||||
#define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n)))
|
|
||||||
#define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n)))
|
|
||||||
#define FD_ZERO(p) ((p)->fds_bits[0] = 0)
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 1988, 1993
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* @(#)general.h 8.1 (Berkeley) 6/6/93
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Some general definitions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#define numberof(x) (sizeof x/sizeof x[0])
|
|
||||||
#define highestof(x) (numberof(x)-1)
|
|
||||||
|
|
||||||
#define ClearElement(x) memset((char *)&x, 0, sizeof x)
|
|
||||||
#define ClearArray(x) memset((char *)x, 0, sizeof x)
|
|
@@ -37,21 +37,10 @@ static char copyright[] =
|
|||||||
The Regents of the University of California. All rights reserved.\n";
|
The Regents of the University of California. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <config.h>
|
#include "telnet_locl.h"
|
||||||
#ifdef SOCKS
|
|
||||||
#include <socks.h>
|
|
||||||
#endif
|
|
||||||
#include "roken.h"
|
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "ring.h"
|
|
||||||
#include "externs.h"
|
|
||||||
#include "defines.h"
|
|
||||||
|
|
||||||
/* These values need to be the same as defined in libtelnet/kerberos5.c */
|
/* 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. */
|
/* Either define them in both places, or put in some common header file. */
|
||||||
#define OPTS_FORWARD_CREDS 0x00000002
|
#define OPTS_FORWARD_CREDS 0x00000002
|
||||||
@@ -65,7 +54,7 @@ RCSID("$Id$");
|
|||||||
* Initialize variables.
|
* Initialize variables.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
tninit()
|
tninit(void)
|
||||||
{
|
{
|
||||||
init_terminal();
|
init_terminal();
|
||||||
|
|
||||||
@@ -76,7 +65,8 @@ tninit()
|
|||||||
init_sys();
|
init_sys();
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage(void)
|
void
|
||||||
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: %s %s%s%s%s\n", prompt,
|
fprintf(stderr, "Usage: %s %s%s%s%s\n", prompt,
|
||||||
#ifdef AUTHENTICATION
|
#ifdef AUTHENTICATION
|
||||||
@@ -101,7 +91,8 @@ void usage(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
char *user;
|
char *user;
|
||||||
@@ -116,7 +107,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
TerminalSaveState();
|
TerminalSaveState();
|
||||||
|
|
||||||
if (prompt = strrchr(argv[0], '/'))
|
if ((prompt = strrchr(argv[0], '/')))
|
||||||
++prompt;
|
++prompt;
|
||||||
else
|
else
|
||||||
prompt = argv[0];
|
prompt = argv[0];
|
||||||
|
@@ -31,37 +31,10 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "telnet_locl.h"
|
||||||
#ifdef SOCKS
|
|
||||||
#include <socks.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#ifdef HAVE_SYS_SELECT_H
|
|
||||||
#include <sys/select.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#ifdef TIME_WITH_SYS_TIME
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <time.h>
|
|
||||||
#elif defined(HAVE_SYS_TIME_H)
|
|
||||||
#include <sys/time.h>
|
|
||||||
#else
|
|
||||||
#include <time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include <arpa/telnet.h>
|
|
||||||
|
|
||||||
#include "ring.h"
|
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include "externs.h"
|
|
||||||
#include "fdset.h"
|
|
||||||
|
|
||||||
Ring netoring, netiring;
|
Ring netoring, netiring;
|
||||||
unsigned char netobuf[2*BUFSIZ], netibuf[BUFSIZ];
|
unsigned char netobuf[2*BUFSIZ], netibuf[BUFSIZ];
|
||||||
|
|
||||||
@@ -69,8 +42,8 @@ unsigned char netobuf[2*BUFSIZ], netibuf[BUFSIZ];
|
|||||||
* Initialize internal network data structures.
|
* Initialize internal network data structures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
init_network()
|
init_network(void)
|
||||||
{
|
{
|
||||||
if (ring_init(&netoring, netobuf, sizeof netobuf) != 1) {
|
if (ring_init(&netoring, netobuf, sizeof netobuf) != 1) {
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -87,8 +60,8 @@ init_network()
|
|||||||
* Telnet "synch" processing).
|
* Telnet "synch" processing).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
stilloob()
|
stilloob(void)
|
||||||
{
|
{
|
||||||
static struct timeval timeout = { 0 };
|
static struct timeval timeout = { 0 };
|
||||||
fd_set excepts;
|
fd_set excepts;
|
||||||
@@ -119,8 +92,8 @@ stilloob()
|
|||||||
* Sets "neturg" to the current location.
|
* Sets "neturg" to the current location.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
setneturg()
|
setneturg(void)
|
||||||
{
|
{
|
||||||
ring_mark(&netoring);
|
ring_mark(&netoring);
|
||||||
}
|
}
|
||||||
@@ -136,8 +109,8 @@ setneturg()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
netflush()
|
netflush(void)
|
||||||
{
|
{
|
||||||
int n, n1;
|
int n, n1;
|
||||||
|
|
||||||
|
@@ -31,10 +31,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "telnet_locl.h"
|
||||||
#ifdef SOCKS
|
|
||||||
#include <socks.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
@@ -49,24 +46,6 @@ RCSID("$Id$");
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ring.h"
|
|
||||||
#include "general.h"
|
|
||||||
|
|
||||||
#include <roken.h>
|
|
||||||
|
|
||||||
/* Internal macros */
|
/* Internal macros */
|
||||||
|
|
||||||
#define ring_subtract(d,a,b) (((a)-(b) >= 0)? \
|
#define ring_subtract(d,a,b) (((a)-(b) >= 0)? \
|
||||||
|
@@ -92,6 +92,8 @@ extern void
|
|||||||
ring_clearto (Ring *ring);
|
ring_clearto (Ring *ring);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern int ring_at_mark(Ring *ring);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
ring_clear_mark(),
|
ring_clear_mark(Ring *ring),
|
||||||
ring_mark();
|
ring_mark(Ring *ring);
|
||||||
|
@@ -31,10 +31,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "telnet_locl.h"
|
||||||
#ifdef SOCKS
|
|
||||||
#include <socks.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
@@ -43,56 +40,6 @@ RCSID("$Id$");
|
|||||||
* (at least between 4.x and dos) which is used in telnet.c.
|
* (at least between 4.x and dos) which is used in telnet.c.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
|
||||||
#include <fcntl.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_SELECT_H
|
|
||||||
#include <sys/select.h>
|
|
||||||
#endif
|
|
||||||
#ifdef TIME_WITH_SYS_TIME
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <time.h>
|
|
||||||
#elif defined(HAVE_SYS_TIME_H)
|
|
||||||
#include <sys/time.h>
|
|
||||||
#else
|
|
||||||
#include <time.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#include <signal.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#ifdef HAVE_ARPA_TELNET_H
|
|
||||||
#include <arpa/telnet.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_TERMIOS_H
|
|
||||||
#include <termios.h>
|
|
||||||
#else
|
|
||||||
#ifdef HAVE_TERMIO_H
|
|
||||||
#include <termio.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <roken.h>
|
|
||||||
|
|
||||||
#include "ring.h"
|
|
||||||
|
|
||||||
#include "fdset.h"
|
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include "externs.h"
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SIGINFO
|
|
||||||
extern RETSIGTYPE ayt_status();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
tout, /* Output file descriptor */
|
tout, /* Output file descriptor */
|
||||||
tin, /* Input file descriptor */
|
tin, /* Input file descriptor */
|
||||||
@@ -125,15 +72,12 @@ extern struct termios new_tc;
|
|||||||
# define cfgetispeed(ptr) cfgetospeed(ptr)
|
# define cfgetispeed(ptr) cfgetospeed(ptr)
|
||||||
# endif
|
# endif
|
||||||
# endif /* TCSANOW */
|
# endif /* TCSANOW */
|
||||||
# ifdef sysV88
|
|
||||||
# define TIOCFLUSH TC_PX_DRAIN
|
|
||||||
# endif
|
|
||||||
|
|
||||||
static fd_set ibits, obits, xbits;
|
static fd_set ibits, obits, xbits;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
init_sys()
|
init_sys(void)
|
||||||
{
|
{
|
||||||
tout = fileno(stdout);
|
tout = fileno(stdout);
|
||||||
tin = fileno(stdin);
|
tin = fileno(stdin);
|
||||||
@@ -154,7 +98,7 @@ TerminalWrite(char *buf, int n)
|
|||||||
int
|
int
|
||||||
TerminalRead(unsigned char *buf, int n)
|
TerminalRead(unsigned char *buf, int n)
|
||||||
{
|
{
|
||||||
return read(tin, (char*)buf, n);
|
return read(tin, buf, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -162,7 +106,7 @@ TerminalRead(unsigned char *buf, int n)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
TerminalAutoFlush()
|
TerminalAutoFlush(void)
|
||||||
{
|
{
|
||||||
#if defined(LNOFLSH)
|
#if defined(LNOFLSH)
|
||||||
int flush;
|
int flush;
|
||||||
@@ -189,8 +133,6 @@ extern int kludgelinemode;
|
|||||||
* 1 Do add this character
|
* 1 Do add this character
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern void xmitAO(), xmitEL(), xmitEC(), intp(), sendbrk();
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TerminalSpecialChars(int c)
|
TerminalSpecialChars(int c)
|
||||||
{
|
{
|
||||||
@@ -235,7 +177,7 @@ TerminalSpecialChars(int c)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
TerminalFlushOutput()
|
TerminalFlushOutput(void)
|
||||||
{
|
{
|
||||||
#ifdef TIOCFLUSH
|
#ifdef TIOCFLUSH
|
||||||
ioctl(fileno(stdout), TIOCFLUSH, (char *) 0);
|
ioctl(fileno(stdout), TIOCFLUSH, (char *) 0);
|
||||||
@@ -245,7 +187,7 @@ TerminalFlushOutput()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TerminalSaveState()
|
TerminalSaveState(void)
|
||||||
{
|
{
|
||||||
tcgetattr(0, &old_tc);
|
tcgetattr(0, &old_tc);
|
||||||
|
|
||||||
@@ -315,7 +257,7 @@ tcval(int func)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TerminalDefaultChars()
|
TerminalDefaultChars(void)
|
||||||
{
|
{
|
||||||
memmove(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
|
memmove(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
|
||||||
# ifndef VDISCARD
|
# ifndef VDISCARD
|
||||||
@@ -371,6 +313,13 @@ TerminalRestoreState()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef SIGTSTP
|
||||||
|
static RETSIGTYPE susp();
|
||||||
|
#endif /* SIGTSTP */
|
||||||
|
#ifdef SIGINFO
|
||||||
|
static RETSIGTYPE ayt();
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
TerminalNewMode(int f)
|
TerminalNewMode(int f)
|
||||||
{
|
{
|
||||||
@@ -504,12 +453,6 @@ TerminalNewMode(int f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (f != -1) {
|
if (f != -1) {
|
||||||
#ifdef SIGTSTP
|
|
||||||
RETSIGTYPE susp();
|
|
||||||
#endif /* SIGTSTP */
|
|
||||||
#ifdef SIGINFO
|
|
||||||
RETSIGTYPE ayt();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
signal(SIGTSTP, susp);
|
signal(SIGTSTP, susp);
|
||||||
@@ -634,10 +577,8 @@ struct termspeeds {
|
|||||||
};
|
};
|
||||||
#endif /* DECODE_BAUD */
|
#endif /* DECODE_BAUD */
|
||||||
|
|
||||||
void
|
void
|
||||||
TerminalSpeeds(ispeed, ospeed)
|
TerminalSpeeds(long *ispeed, long *ospeed)
|
||||||
long *ispeed;
|
|
||||||
long *ospeed;
|
|
||||||
{
|
{
|
||||||
#ifdef DECODE_BAUD
|
#ifdef DECODE_BAUD
|
||||||
struct termspeeds *tp;
|
struct termspeeds *tp;
|
||||||
@@ -665,9 +606,8 @@ TerminalSpeeds(ispeed, ospeed)
|
|||||||
#endif /* DECODE_BAUD */
|
#endif /* DECODE_BAUD */
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
TerminalWindowSize(rows, cols)
|
TerminalWindowSize(long *rows, long *cols)
|
||||||
long *rows, *cols;
|
|
||||||
{
|
{
|
||||||
struct winsize ws;
|
struct winsize ws;
|
||||||
|
|
||||||
@@ -679,18 +619,15 @@ TerminalWindowSize(rows, cols)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
NetClose(fd)
|
NetClose(int fd)
|
||||||
int fd;
|
|
||||||
{
|
{
|
||||||
return close(fd);
|
return close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NetNonblockingIO(fd, onoff)
|
NetNonblockingIO(int fd, int onoff)
|
||||||
int fd;
|
|
||||||
int onoff;
|
|
||||||
{
|
{
|
||||||
ioctl(fd, FIONBIO, (char *)&onoff);
|
ioctl(fd, FIONBIO, (char *)&onoff);
|
||||||
}
|
}
|
||||||
@@ -700,19 +637,24 @@ NetNonblockingIO(fd, onoff)
|
|||||||
* Various signal handling routines.
|
* Various signal handling routines.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static RETSIGTYPE deadpeer(int),
|
||||||
|
intr(int), intr2(int), susp(int), sendwin(int);
|
||||||
|
#ifdef SIGINFO
|
||||||
|
static RETSIGTYPE ayt(int);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
RETSIGTYPE
|
static RETSIGTYPE
|
||||||
deadpeer(sig)
|
deadpeer(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
setcommandmode();
|
setcommandmode();
|
||||||
longjmp(peerdied, -1);
|
longjmp(peerdied, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
RETSIGTYPE
|
static RETSIGTYPE
|
||||||
intr(sig)
|
intr(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
if (localchars) {
|
if (localchars) {
|
||||||
intp();
|
intp();
|
||||||
@@ -723,9 +665,8 @@ intr(sig)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
RETSIGTYPE
|
static RETSIGTYPE
|
||||||
intr2(sig)
|
intr2(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
if (localchars) {
|
if (localchars) {
|
||||||
#ifdef KLUDGELINEMODE
|
#ifdef KLUDGELINEMODE
|
||||||
@@ -740,9 +681,8 @@ intr2(sig)
|
|||||||
|
|
||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
RETSIGTYPE
|
static RETSIGTYPE
|
||||||
susp(sig)
|
susp(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
if ((rlogin != _POSIX_VDISABLE) && rlogin_susp())
|
if ((rlogin != _POSIX_VDISABLE) && rlogin_susp())
|
||||||
return;
|
return;
|
||||||
@@ -753,9 +693,8 @@ susp(sig)
|
|||||||
|
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
RETSIGTYPE
|
static RETSIGTYPE
|
||||||
sendwin(sig)
|
sendwin(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
if (connected) {
|
if (connected) {
|
||||||
sendnaws();
|
sendnaws();
|
||||||
@@ -765,9 +704,8 @@ sendwin(sig)
|
|||||||
|
|
||||||
#ifdef SIGINFO
|
#ifdef SIGINFO
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
RETSIGTYPE
|
static RETSIGTYPE
|
||||||
ayt(sig)
|
ayt(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
if (connected)
|
if (connected)
|
||||||
sendayt();
|
sendayt();
|
||||||
@@ -777,8 +715,8 @@ ayt(sig)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sys_telnet_init()
|
sys_telnet_init(void)
|
||||||
{
|
{
|
||||||
signal(SIGINT, intr);
|
signal(SIGINT, intr);
|
||||||
signal(SIGQUIT, intr2);
|
signal(SIGQUIT, intr2);
|
||||||
@@ -816,9 +754,13 @@ sys_telnet_init()
|
|||||||
* The return value is 1 if something happened, 0 if not.
|
* The return value is 1 if something happened, 0 if not.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
process_rings(netin, netout, netex, ttyin, ttyout, poll)
|
process_rings(int netin,
|
||||||
int poll; /* If 0, then block until something to do */
|
int netout,
|
||||||
|
int netex,
|
||||||
|
int ttyin,
|
||||||
|
int ttyout,
|
||||||
|
int poll) /* If 0, then block until something to do */
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
/* One wants to be a bit careful about setting returnValue
|
/* One wants to be a bit careful about setting returnValue
|
||||||
|
@@ -31,34 +31,10 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "telnet_locl.h"
|
||||||
#ifdef SOCKS
|
|
||||||
#include <socks.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
/* By the way, we need to include curses.h before telnet.h since,
|
|
||||||
* among other things, telnet.h #defines 'DO', which is a variable
|
|
||||||
* declared in curses.h.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <arpa/telnet.h>
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#include "ring.h"
|
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include "externs.h"
|
|
||||||
#include "types.h"
|
|
||||||
#include "general.h"
|
|
||||||
#include <roken.h>
|
|
||||||
|
|
||||||
#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x))
|
#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x))
|
||||||
|
|
||||||
static unsigned char subbuffer[SUBBUFSIZE],
|
static unsigned char subbuffer[SUBBUFSIZE],
|
||||||
@@ -147,17 +123,20 @@ int kludgelinemode = 1;
|
|||||||
|
|
||||||
Clocks clocks;
|
Clocks clocks;
|
||||||
|
|
||||||
|
static int is_unique(char *name, char **as, char **ae);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize telnet environment.
|
* Initialize telnet environment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
init_telnet()
|
init_telnet(void)
|
||||||
{
|
{
|
||||||
env_init();
|
env_init();
|
||||||
|
|
||||||
SB_CLEAR();
|
SB_CLEAR();
|
||||||
ClearArray(options);
|
memset(options, 0, sizeof options);
|
||||||
|
|
||||||
connected = ISend = localflow = donebinarytoggle = 0;
|
connected = ISend = localflow = donebinarytoggle = 0;
|
||||||
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||||
@@ -525,7 +504,7 @@ dontoption(int option)
|
|||||||
static char *name_unknown = "UNKNOWN";
|
static char *name_unknown = "UNKNOWN";
|
||||||
static char *unknown[] = { 0, 0 };
|
static char *unknown[] = { 0, 0 };
|
||||||
|
|
||||||
char **
|
static char **
|
||||||
mklist(char *buf, char *name)
|
mklist(char *buf, char *name)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
@@ -636,7 +615,7 @@ mklist(char *buf, char *name)
|
|||||||
return(unknown);
|
return(unknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
is_unique(char *name, char **as, char **ae)
|
is_unique(char *name, char **as, char **ae)
|
||||||
{
|
{
|
||||||
char **ap;
|
char **ap;
|
||||||
@@ -652,7 +631,7 @@ is_unique(char *name, char **as, char **ae)
|
|||||||
#ifndef HAVE_SETUPTERM
|
#ifndef HAVE_SETUPTERM
|
||||||
char termbuf[1024];
|
char termbuf[1024];
|
||||||
|
|
||||||
int
|
static int
|
||||||
setupterm(char *tname, int fd, int *errp)
|
setupterm(char *tname, int fd, int *errp)
|
||||||
{
|
{
|
||||||
if (tgetent(termbuf, tname) == 1) {
|
if (tgetent(termbuf, tname) == 1) {
|
||||||
@@ -672,7 +651,7 @@ extern char ttytype[];
|
|||||||
|
|
||||||
int resettermname = 1;
|
int resettermname = 1;
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
gettermname()
|
gettermname()
|
||||||
{
|
{
|
||||||
char *tname;
|
char *tname;
|
||||||
@@ -685,7 +664,7 @@ gettermname()
|
|||||||
if (tnamep && tnamep != unknown)
|
if (tnamep && tnamep != unknown)
|
||||||
free(tnamep);
|
free(tnamep);
|
||||||
if ((tname = (char *)env_getvalue((unsigned char *)"TERM")) &&
|
if ((tname = (char *)env_getvalue((unsigned char *)"TERM")) &&
|
||||||
(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 && ((int)strlen(tname) <= 40)) {
|
||||||
@@ -759,8 +738,8 @@ suboption()
|
|||||||
TerminalSpeeds(&ispeed, &ospeed);
|
TerminalSpeeds(&ispeed, &ospeed);
|
||||||
|
|
||||||
snprintf((char *)temp, sizeof(temp),
|
snprintf((char *)temp, sizeof(temp),
|
||||||
"%c%c%c%c%d,%d%c%c", IAC, SB, TELOPT_TSPEED,
|
"%c%c%c%c%u,%u%c%c", IAC, SB, TELOPT_TSPEED,
|
||||||
TELQUAL_IS, ospeed, ispeed, IAC, SE);
|
TELQUAL_IS, (unsigned)ospeed, (unsigned)ispeed, IAC, SE);
|
||||||
len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */
|
len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */
|
||||||
|
|
||||||
if (len < NETROOM()) {
|
if (len < NETROOM()) {
|
||||||
@@ -1106,7 +1085,7 @@ slc_init()
|
|||||||
|
|
||||||
#define initfunc(func, flags) { \
|
#define initfunc(func, flags) { \
|
||||||
spcp = &spc_data[func]; \
|
spcp = &spc_data[func]; \
|
||||||
if (spcp->valp = tcval(func)) { \
|
if ((spcp->valp = tcval(func))) { \
|
||||||
spcp->val = *spcp->valp; \
|
spcp->val = *spcp->valp; \
|
||||||
spcp->mylevel = SLC_VARIABLE|flags; \
|
spcp->mylevel = SLC_VARIABLE|flags; \
|
||||||
} else { \
|
} else { \
|
||||||
@@ -1470,12 +1449,12 @@ env_opt_add(unsigned char *ep)
|
|||||||
if (ep == NULL || *ep == '\0') {
|
if (ep == NULL || *ep == '\0') {
|
||||||
/* Send user defined variables first. */
|
/* Send user defined variables first. */
|
||||||
env_default(1, 0);
|
env_default(1, 0);
|
||||||
while (ep = env_default(0, 0))
|
while ((ep = env_default(0, 0)))
|
||||||
env_opt_add(ep);
|
env_opt_add(ep);
|
||||||
|
|
||||||
/* Now add the list of well know variables. */
|
/* Now add the list of well know variables. */
|
||||||
env_default(1, 1);
|
env_default(1, 1);
|
||||||
while (ep = env_default(0, 1))
|
while ((ep = env_default(0, 1)))
|
||||||
env_opt_add(ep);
|
env_opt_add(ep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1505,7 +1484,7 @@ env_opt_add(unsigned char *ep)
|
|||||||
else
|
else
|
||||||
*opt_replyp++ = ENV_USERVAR;
|
*opt_replyp++ = ENV_USERVAR;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
while (c = *ep++) {
|
while ((c = *ep++)) {
|
||||||
switch(c&0xff) {
|
switch(c&0xff) {
|
||||||
case IAC:
|
case IAC:
|
||||||
*opt_replyp++ = IAC;
|
*opt_replyp++ = IAC;
|
||||||
@@ -1519,7 +1498,7 @@ env_opt_add(unsigned char *ep)
|
|||||||
}
|
}
|
||||||
*opt_replyp++ = c;
|
*opt_replyp++ = c;
|
||||||
}
|
}
|
||||||
if (ep = vp) {
|
if ((ep = vp)) {
|
||||||
#ifdef OLD_ENVIRON
|
#ifdef OLD_ENVIRON
|
||||||
if (telopt_environ == TELOPT_OLD_ENVIRON)
|
if (telopt_environ == TELOPT_OLD_ENVIRON)
|
||||||
*opt_replyp++ = old_env_value;
|
*opt_replyp++ = old_env_value;
|
||||||
@@ -1569,7 +1548,7 @@ env_opt_end(int emptyok)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
telrcv()
|
telrcv(void)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int scc;
|
int scc;
|
||||||
@@ -1801,7 +1780,7 @@ process_iac:
|
|||||||
static int bol = 1, local = 0;
|
static int bol = 1, local = 0;
|
||||||
|
|
||||||
int
|
int
|
||||||
rlogin_susp()
|
rlogin_susp(void)
|
||||||
{
|
{
|
||||||
if (local) {
|
if (local) {
|
||||||
local = 0;
|
local = 0;
|
||||||
@@ -1963,7 +1942,7 @@ telsnd()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int
|
static int
|
||||||
Scheduler(int block) /* should we block in the select ? */
|
Scheduler(int block) /* should we block in the select ? */
|
||||||
{
|
{
|
||||||
/* One wants to be a bit careful about setting returnValue
|
/* One wants to be a bit careful about setting returnValue
|
||||||
@@ -2143,7 +2122,7 @@ doflush()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xmitAO()
|
xmitAO(void)
|
||||||
{
|
{
|
||||||
NET2ADD(IAC, AO);
|
NET2ADD(IAC, AO);
|
||||||
printoption("SENT", IAC, AO);
|
printoption("SENT", IAC, AO);
|
||||||
@@ -2154,14 +2133,14 @@ xmitAO()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xmitEL()
|
xmitEL(void)
|
||||||
{
|
{
|
||||||
NET2ADD(IAC, EL);
|
NET2ADD(IAC, EL);
|
||||||
printoption("SENT", IAC, EL);
|
printoption("SENT", IAC, EL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xmitEC()
|
xmitEC(void)
|
||||||
{
|
{
|
||||||
NET2ADD(IAC, EC);
|
NET2ADD(IAC, EC);
|
||||||
printoption("SENT", IAC, EC);
|
printoption("SENT", IAC, EC);
|
||||||
@@ -2208,7 +2187,7 @@ get_status()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
intp()
|
intp(void)
|
||||||
{
|
{
|
||||||
NET2ADD(IAC, IP);
|
NET2ADD(IAC, IP);
|
||||||
printoption("SENT", IAC, IP);
|
printoption("SENT", IAC, IP);
|
||||||
@@ -2222,7 +2201,7 @@ intp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sendbrk()
|
sendbrk(void)
|
||||||
{
|
{
|
||||||
NET2ADD(IAC, BREAK);
|
NET2ADD(IAC, BREAK);
|
||||||
printoption("SENT", IAC, BREAK);
|
printoption("SENT", IAC, BREAK);
|
||||||
@@ -2236,7 +2215,7 @@ sendbrk()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sendabort()
|
sendabort(void)
|
||||||
{
|
{
|
||||||
NET2ADD(IAC, ABORT);
|
NET2ADD(IAC, ABORT);
|
||||||
printoption("SENT", IAC, ABORT);
|
printoption("SENT", IAC, ABORT);
|
||||||
@@ -2250,7 +2229,7 @@ sendabort()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sendsusp()
|
sendsusp(void)
|
||||||
{
|
{
|
||||||
NET2ADD(IAC, SUSP);
|
NET2ADD(IAC, SUSP);
|
||||||
printoption("SENT", IAC, SUSP);
|
printoption("SENT", IAC, SUSP);
|
||||||
@@ -2264,14 +2243,14 @@ sendsusp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sendeof()
|
sendeof(void)
|
||||||
{
|
{
|
||||||
NET2ADD(IAC, xEOF);
|
NET2ADD(IAC, xEOF);
|
||||||
printoption("SENT", IAC, xEOF);
|
printoption("SENT", IAC, xEOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sendayt()
|
sendayt(void)
|
||||||
{
|
{
|
||||||
NET2ADD(IAC, AYT);
|
NET2ADD(IAC, AYT);
|
||||||
printoption("SENT", IAC, AYT);
|
printoption("SENT", IAC, AYT);
|
||||||
|
150
appl/telnet/telnet/telnet_locl.h
Normal file
150
appl/telnet/telnet/telnet_locl.h
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska H<>gskolan
|
||||||
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the Kungliga Tekniska
|
||||||
|
* H<>gskolan and its contributors.
|
||||||
|
*
|
||||||
|
* 4. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
#ifdef SOCKS
|
||||||
|
#include <socks.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#ifdef HAVE_SIGNAL_H
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
#include <errno.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <termios.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_NETDB_H
|
||||||
|
#include <netdb.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_PWD_H
|
||||||
|
#include <pwd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_CURSES_H
|
||||||
|
#include <curses.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_SELECT_H
|
||||||
|
#include <sys/select.h>
|
||||||
|
#endif
|
||||||
|
#ifdef TIME_WITH_SYS_TIME
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <time.h>
|
||||||
|
#elif defined(HAVE_SYS_TIME_H)
|
||||||
|
#include <sys/time.h>
|
||||||
|
#else
|
||||||
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_PARAM_H
|
||||||
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
/* not with SunOS 4 */
|
||||||
|
#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#endif /* HAVE_SYS_RESOURCE_H */
|
||||||
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_FILIO_H
|
||||||
|
#include <sys/filio.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_FILE_H
|
||||||
|
#include <sys/file.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_NETINET_IN_H
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_NETINET_IN_SYSTM_H
|
||||||
|
#include <netinet/in_systm.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_NETINET_IP_H
|
||||||
|
#include <netinet/ip.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_ARPA_INET_H
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_ARPA_TELNET_H
|
||||||
|
#include <arpa/telnet.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <roken.h>
|
||||||
|
#include <krb.h>
|
||||||
|
|
||||||
|
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||||
|
#include <libtelnet/auth.h>
|
||||||
|
#include <libtelnet/encrypt.h>
|
||||||
|
#endif
|
||||||
|
#include <libtelnet/misc.h>
|
||||||
|
#include <libtelnet/misc-proto.h>
|
||||||
|
|
||||||
|
#include "ring.h"
|
||||||
|
#include "externs.h"
|
||||||
|
#include "defines.h"
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
/* prototypes */
|
||||||
|
|
@@ -31,21 +31,10 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "telnet_locl.h"
|
||||||
#ifdef SOCKS
|
|
||||||
#include <socks.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
#include <arpa/telnet.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include "ring.h"
|
|
||||||
|
|
||||||
#include "externs.h"
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
Ring ttyoring, ttyiring;
|
Ring ttyoring, ttyiring;
|
||||||
unsigned char ttyobuf[2*BUFSIZ], ttyibuf[BUFSIZ];
|
unsigned char ttyobuf[2*BUFSIZ], ttyibuf[BUFSIZ];
|
||||||
|
|
||||||
@@ -86,8 +75,8 @@ cc_t termAytChar;
|
|||||||
* initialize the terminal data structures.
|
* initialize the terminal data structures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
init_terminal()
|
init_terminal(void)
|
||||||
{
|
{
|
||||||
if (ring_init(&ttyoring, ttyobuf, sizeof ttyobuf) != 1) {
|
if (ring_init(&ttyoring, ttyobuf, sizeof ttyobuf) != 1) {
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -110,9 +99,8 @@ init_terminal()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ttyflush(drop)
|
ttyflush(int drop)
|
||||||
int drop;
|
|
||||||
{
|
{
|
||||||
int n, n0, n1;
|
int n, n0, n1;
|
||||||
|
|
||||||
@@ -160,8 +148,8 @@ ttyflush(drop)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
getconnmode()
|
getconnmode(void)
|
||||||
{
|
{
|
||||||
extern int linemode;
|
extern int linemode;
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
|
@@ -31,46 +31,14 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#define TELOPTS
|
||||||
#ifdef SOCKS
|
#define TELCMDS
|
||||||
#include <socks.h>
|
#define SLC_NAMES
|
||||||
#endif
|
|
||||||
|
#include "telnet_locl.h"
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
#define TELOPTS
|
|
||||||
#define TELCMDS
|
|
||||||
#define SLC_NAMES
|
|
||||||
#include <arpa/telnet.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#ifdef HAVE_SYS_SELECT_H
|
|
||||||
#include <sys/select.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#ifdef TIME_WITH_SYS_TIME
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <time.h>
|
|
||||||
#elif defined(HAVE_SYS_TIME_H)
|
|
||||||
#include <sys/time.h>
|
|
||||||
#else
|
|
||||||
#include <time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <roken.h>
|
|
||||||
|
|
||||||
#include "general.h"
|
|
||||||
|
|
||||||
#include "fdset.h"
|
|
||||||
|
|
||||||
#include "ring.h"
|
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
|
|
||||||
#include "externs.h"
|
|
||||||
|
|
||||||
FILE *NetTrace = 0; /* Not in bss, since needs to stay */
|
FILE *NetTrace = 0; /* Not in bss, since needs to stay */
|
||||||
int prettydump;
|
int prettydump;
|
||||||
|
|
||||||
@@ -129,7 +97,6 @@ Dump(char direction, unsigned char *buffer, int length)
|
|||||||
# define BYTES_PER_LINE 32
|
# define BYTES_PER_LINE 32
|
||||||
unsigned char *pThis;
|
unsigned char *pThis;
|
||||||
int offset;
|
int offset;
|
||||||
extern int pettydump;
|
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
@@ -797,7 +764,6 @@ printsub(char direction, unsigned char *pointer, int length)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
def_case:
|
|
||||||
if (isprint(pointer[i]) && pointer[i] != '"') {
|
if (isprint(pointer[i]) && pointer[i] != '"') {
|
||||||
if (noquote) {
|
if (noquote) {
|
||||||
putc('"', NetTrace);
|
putc('"', NetTrace);
|
||||||
|
Reference in New Issue
Block a user