mirror of
https://github.com/sheumann/telnetd.git
synced 2024-06-04 22:29:28 +00:00
Manually unifdef(1) CRAY, UNICOS, hpux and sun uselsess code.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@82497 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
This commit is contained in:
parent
ee8be0d9e9
commit
3efb267b2d
|
@ -40,18 +40,12 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||||
#if defined(unix)
|
#if defined(unix)
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#if defined(CRAY) || defined(sysV88)
|
|
||||||
#include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif /* defined(unix) */
|
#endif /* defined(unix) */
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#ifdef CRAY
|
|
||||||
#include <fcntl.h>
|
|
||||||
#endif /* CRAY */
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -81,12 +75,10 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||||
#include <libtelnet/encrypt.h>
|
#include <libtelnet/encrypt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CRAY) && !defined(sysV88)
|
|
||||||
#include <netinet/in_systm.h>
|
#include <netinet/in_systm.h>
|
||||||
# if (defined(vax) || defined(tahoe) || defined(hp300)) && !defined(ultrix)
|
# if (defined(vax) || defined(tahoe) || defined(hp300)) && !defined(ultrix)
|
||||||
# include <machine/endian.h>
|
# include <machine/endian.h>
|
||||||
# endif /* vax */
|
# endif /* vax */
|
||||||
#endif /* !defined(CRAY) && !defined(sysV88) */
|
|
||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
#include <netinet/ip6.h>
|
#include <netinet/ip6.h>
|
||||||
|
|
||||||
|
@ -936,35 +928,6 @@ static struct setlist Setlist[] = {
|
||||||
{ 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(name)
|
getset(name)
|
||||||
char *name;
|
char *name;
|
||||||
|
|
|
@ -53,17 +53,12 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#if defined(CRAY) && !defined(NO_BSD_SETJMP)
|
|
||||||
#include <bsdsetjmp.h>
|
|
||||||
#endif
|
|
||||||
#ifndef FILIO_H
|
#ifndef FILIO_H
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/filio.h>
|
#include <sys/filio.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef CRAY
|
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
#endif /* CRAY */
|
|
||||||
#ifdef USE_TERMIO
|
#ifdef USE_TERMIO
|
||||||
# ifndef VINTR
|
# ifndef VINTR
|
||||||
# ifdef SYSV_TERMIO
|
# ifdef SYSV_TERMIO
|
||||||
|
@ -109,10 +104,6 @@ extern char *ipsec_policy_out;
|
||||||
|
|
||||||
#define SUBBUFSIZE 256
|
#define SUBBUFSIZE 256
|
||||||
|
|
||||||
#ifndef CRAY
|
|
||||||
extern int errno; /* outside this world */
|
|
||||||
#endif /* !CRAY */
|
|
||||||
|
|
||||||
#if !defined(P)
|
#if !defined(P)
|
||||||
# ifdef __STDC__
|
# ifdef __STDC__
|
||||||
# define P(x) x
|
# define P(x) x
|
||||||
|
@ -432,7 +423,7 @@ extern cc_t termAytChar;
|
||||||
# define termAytChar new_tc.c_cc[VSTATUS]
|
# define termAytChar new_tc.c_cc[VSTATUS]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# if !defined(CRAY) || defined(__STDC__)
|
# if defined(__STDC__)
|
||||||
# define termEofCharp &termEofChar
|
# define termEofCharp &termEofChar
|
||||||
# define termEraseCharp &termEraseChar
|
# define termEraseCharp &termEraseChar
|
||||||
# define termIntCharp &termIntChar
|
# define termIntCharp &termIntChar
|
||||||
|
|
|
@ -148,9 +148,6 @@ main(argc, argv)
|
||||||
#endif /* FORWARD */
|
#endif /* FORWARD */
|
||||||
|
|
||||||
tninit(); /* Clear out things */
|
tninit(); /* Clear out things */
|
||||||
#if defined(CRAY) && !defined(__STDC__)
|
|
||||||
_setlist_init(); /* Work around compiler bug */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TerminalSaveState();
|
TerminalSaveState();
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ static const char rcsid[] =
|
||||||
#include "externs.h"
|
#include "externs.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#if defined(CRAY) || (defined(USE_TERMIO) && !defined(SYSV_TERMIO))
|
#if defined(USE_TERMIO) && !defined(SYSV_TERMIO)
|
||||||
#define SIG_FUNC_RET void
|
#define SIG_FUNC_RET void
|
||||||
#else
|
#else
|
||||||
#define SIG_FUNC_RET int
|
#define SIG_FUNC_RET int
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)defs.h 8.1 (Berkeley) 6/4/93
|
* @(#)defs.h 8.1 (Berkeley) 6/4/93
|
||||||
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -43,23 +44,6 @@
|
||||||
# define BSD 43
|
# define BSD 43
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CRAY) && !defined(LINEMODE)
|
|
||||||
# define SYSV_TERMIO
|
|
||||||
# define LINEMODE
|
|
||||||
# define KLUDGELINEMODE
|
|
||||||
# define DIAGNOSTICS
|
|
||||||
# if defined(UNICOS50) && !defined(UNICOS5)
|
|
||||||
# define UNICOS5
|
|
||||||
# endif
|
|
||||||
# if !defined(UNICOS5)
|
|
||||||
# define BFTPDAEMON
|
|
||||||
# define HAS_IP_TOS
|
|
||||||
# endif
|
|
||||||
#endif /* CRAY */
|
|
||||||
#if defined(UNICOS5) && !defined(NO_SETSID)
|
|
||||||
# define NO_SETSID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PRINTOPTIONS) && defined(DIAGNOSTICS)
|
#if defined(PRINTOPTIONS) && defined(DIAGNOSTICS)
|
||||||
#define TELOPTS
|
#define TELOPTS
|
||||||
#define TELCMDS
|
#define TELCMDS
|
||||||
|
@ -71,9 +55,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#ifndef CRAY
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif /* CRAY */
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -134,22 +116,6 @@ typedef unsigned char cc_t;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef CRAY
|
|
||||||
# ifdef CRAY1
|
|
||||||
# include <sys/pty.h>
|
|
||||||
# ifndef FD_ZERO
|
|
||||||
# include <sys/select.h>
|
|
||||||
# endif /* FD_ZERO */
|
|
||||||
# endif /* CRAY1 */
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#endif /* CRAY */
|
|
||||||
|
|
||||||
#ifdef __hpux
|
|
||||||
#include <sys/ptyio.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(TIOCSCTTY) && defined(TCSETCTTY)
|
#if !defined(TIOCSCTTY) && defined(TCSETCTTY)
|
||||||
# define TIOCSCTTY TCSETCTTY
|
# define TIOCSCTTY TCSETCTTY
|
||||||
#endif
|
#endif
|
||||||
|
@ -169,10 +135,6 @@ typedef struct fd_set { int fds_bits[1]; } fd_set;
|
||||||
* I/O data buffers defines
|
* I/O data buffers defines
|
||||||
*/
|
*/
|
||||||
#define NETSLOP 64
|
#define NETSLOP 64
|
||||||
#ifdef CRAY
|
|
||||||
#undef BUFSIZ
|
|
||||||
#define BUFSIZ 2048
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NIACCUM(c) { *netip++ = c; \
|
#define NIACCUM(c) { *netip++ = c; \
|
||||||
ncc++; \
|
ncc++; \
|
||||||
|
|
|
@ -79,11 +79,6 @@ extern char *neturg; /* one past last bye of urgent data */
|
||||||
|
|
||||||
extern int pcc, ncc;
|
extern int pcc, ncc;
|
||||||
|
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
extern int unpcc; /* characters left unprocessed by CRAY-2 terminal routine */
|
|
||||||
extern char *unptyip; /* pointer to remaining characters in buffer */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int pty, net;
|
extern int pty, net;
|
||||||
extern char line[16];
|
extern char line[16];
|
||||||
extern int SYNCHing; /* we are in TELNET SYNCH mode */
|
extern int SYNCHing; /* we are in TELNET SYNCH mode */
|
||||||
|
@ -219,18 +214,7 @@ extern struct {
|
||||||
gotDM; /* when did we last see a data mark */
|
gotDM; /* when did we last see a data mark */
|
||||||
} clocks;
|
} clocks;
|
||||||
|
|
||||||
|
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
extern int needtermstat;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEFAULT_IM
|
#ifndef DEFAULT_IM
|
||||||
# ifdef CRAY
|
|
||||||
# define DEFAULT_IM "\r\n\r\nCray UNICOS (%h) (%t)\r\n\r\r\n\r"
|
|
||||||
# else
|
|
||||||
# ifdef sun
|
|
||||||
# define DEFAULT_IM "\r\n\r\nSunOS UNIX (%h) (%t)\r\n\r\r\n\r"
|
|
||||||
# else
|
|
||||||
# ifdef ultrix
|
# ifdef ultrix
|
||||||
# define DEFAULT_IM "\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
|
# define DEFAULT_IM "\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
|
||||||
# else
|
# else
|
||||||
|
@ -240,6 +224,4 @@ extern int needtermstat;
|
||||||
# define DEFAULT_IM "\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
|
# define DEFAULT_IM "\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -94,9 +94,6 @@ telrcv()
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
static int state = TS_DATA;
|
static int state = TS_DATA;
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
char *opfrontp = pfrontp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (ncc > 0) {
|
while (ncc > 0) {
|
||||||
if ((&ptyobuf[BUFSIZ] - pfrontp) < 2)
|
if ((&ptyobuf[BUFSIZ] - pfrontp) < 2)
|
||||||
|
@ -367,21 +364,6 @@ gotiac: switch (c) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
if (!linemode) {
|
|
||||||
char xptyobuf[BUFSIZ+NETSLOP];
|
|
||||||
char xbuf2[BUFSIZ];
|
|
||||||
register char *cp;
|
|
||||||
int n = pfrontp - opfrontp, oc;
|
|
||||||
memmove(xptyobuf, opfrontp, n);
|
|
||||||
pfrontp = opfrontp;
|
|
||||||
pfrontp += term_input(xptyobuf, pfrontp, n, BUFSIZ+NETSLOP,
|
|
||||||
xbuf2, &oc, BUFSIZ);
|
|
||||||
for (cp = xbuf2; oc > 0; --oc)
|
|
||||||
if ((*nfrontp++ = *cp++) == IAC)
|
|
||||||
*nfrontp++ = IAC;
|
|
||||||
}
|
|
||||||
#endif /* defined(CRAY2) && defined(UNICOS5) */
|
|
||||||
} /* end of telrcv */
|
} /* end of telrcv */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -50,10 +50,6 @@ extern char *altlogin;
|
||||||
int cleanopen(char *line);
|
int cleanopen(char *line);
|
||||||
void scrub_env(void);
|
void scrub_env(void);
|
||||||
|
|
||||||
#if defined(CRAY) || defined(__hpux)
|
|
||||||
# define PARENT_DOES_UTMP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NEWINIT
|
#ifdef NEWINIT
|
||||||
#include <initreq.h>
|
#include <initreq.h>
|
||||||
#else /* NEWINIT*/
|
#else /* NEWINIT*/
|
||||||
|
@ -82,20 +78,6 @@ char wtmpf[] = "/etc/wtmp";
|
||||||
|
|
||||||
#include <libutil.h>
|
#include <libutil.h>
|
||||||
|
|
||||||
# ifdef CRAY
|
|
||||||
#include <tmpdir.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
# if (UNICOS_LVL == '7.0') || (UNICOS_LVL == '7.1')
|
|
||||||
# define UNICOS7x
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef UNICOS7x
|
|
||||||
#include <sys/sysv.h>
|
|
||||||
#include <sys/secstat.h>
|
|
||||||
extern int secflag;
|
|
||||||
extern struct sysv sysv;
|
|
||||||
# endif /* UNICOS7x */
|
|
||||||
# endif /* CRAY */
|
|
||||||
#endif /* NEWINIT */
|
#endif /* NEWINIT */
|
||||||
|
|
||||||
#ifdef STREAMSPTY
|
#ifdef STREAMSPTY
|
||||||
|
@ -109,10 +91,6 @@ extern struct sysv sysv;
|
||||||
#ifdef STREAMS
|
#ifdef STREAMS
|
||||||
#include <sys/stream.h>
|
#include <sys/stream.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __hpux
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/proc.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/tty.h>
|
#include <sys/tty.h>
|
||||||
#ifdef t_erase
|
#ifdef t_erase
|
||||||
#undef t_erase
|
#undef t_erase
|
||||||
|
@ -131,10 +109,6 @@ extern struct sysv sysv;
|
||||||
#undef t_lnextc
|
#undef t_lnextc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(UNICOS5) && defined(CRAY2) && !defined(EXTPROC)
|
|
||||||
# define EXTPROC 0400
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef USE_TERMIO
|
#ifndef USE_TERMIO
|
||||||
struct termbuf {
|
struct termbuf {
|
||||||
struct sgttyb sg;
|
struct sgttyb sg;
|
||||||
|
@ -262,9 +236,6 @@ set_termbuf()
|
||||||
# else
|
# else
|
||||||
(void) tcsetattr(pty, TCSANOW, &termbuf);
|
(void) tcsetattr(pty, TCSANOW, &termbuf);
|
||||||
# endif
|
# endif
|
||||||
# if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
needtermstat = 1;
|
|
||||||
# endif
|
|
||||||
#endif /* USE_TERMIO */
|
#endif /* USE_TERMIO */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,26 +423,6 @@ spcset(func, valp, valpp)
|
||||||
}
|
}
|
||||||
#endif /* USE_TERMIO */
|
#endif /* USE_TERMIO */
|
||||||
|
|
||||||
#ifdef CRAY
|
|
||||||
/*
|
|
||||||
* getnpty()
|
|
||||||
*
|
|
||||||
* Return the number of pty's configured into the system.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
getnpty()
|
|
||||||
{
|
|
||||||
#ifdef _SC_CRAY_NPTY
|
|
||||||
int numptys;
|
|
||||||
|
|
||||||
if ((numptys = sysconf(_SC_CRAY_NPTY)) != -1)
|
|
||||||
return numptys;
|
|
||||||
else
|
|
||||||
#endif /* _SC_CRAY_NPTY */
|
|
||||||
return 128;
|
|
||||||
}
|
|
||||||
#endif /* CRAY */
|
|
||||||
|
|
||||||
#ifndef convex
|
#ifndef convex
|
||||||
/*
|
/*
|
||||||
* getpty()
|
* getpty()
|
||||||
|
@ -481,11 +432,7 @@ getnpty()
|
||||||
*
|
*
|
||||||
* Returns the file descriptor of the opened pty.
|
* Returns the file descriptor of the opened pty.
|
||||||
*/
|
*/
|
||||||
#ifdef CRAY
|
|
||||||
char myline[16];
|
|
||||||
#else
|
|
||||||
char line[16];
|
char line[16];
|
||||||
#endif /* CRAY */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
getpty(ptynum)
|
getpty(ptynum)
|
||||||
|
@ -505,23 +452,13 @@ int *ptynum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* ! STREAMSPTY */
|
#else /* ! STREAMSPTY */
|
||||||
#ifndef CRAY
|
|
||||||
register char *cp, *p1, *p2;
|
register char *cp, *p1, *p2;
|
||||||
register int i;
|
register int i;
|
||||||
#if defined(sun) && defined(TIOCGPGRP) && BSD < 199207
|
|
||||||
int dummy;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __hpux
|
|
||||||
(void) strcpy(line, _PATH_DEV);
|
(void) strcpy(line, _PATH_DEV);
|
||||||
(void) strcat(line, "ptyXX");
|
(void) strcat(line, "ptyXX");
|
||||||
p1 = &line[8];
|
p1 = &line[8];
|
||||||
p2 = &line[9];
|
p2 = &line[9];
|
||||||
#else
|
|
||||||
(void) strcpy(line, "/dev/ptym/ptyXX");
|
|
||||||
p1 = &line[13];
|
|
||||||
p2 = &line[14];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (cp = "pqrsPQRS"; *cp; cp++) {
|
for (cp = "pqrsPQRS"; *cp; cp++) {
|
||||||
struct stat stb;
|
struct stat stb;
|
||||||
|
@ -539,64 +476,13 @@ int *ptynum;
|
||||||
*p2 = "0123456789abcdefghijklmnopqrstuv"[i];
|
*p2 = "0123456789abcdefghijklmnopqrstuv"[i];
|
||||||
p = open(line, 2);
|
p = open(line, 2);
|
||||||
if (p > 0) {
|
if (p > 0) {
|
||||||
#ifndef __hpux
|
|
||||||
line[5] = 't';
|
line[5] = 't';
|
||||||
#else
|
|
||||||
for (p1 = &line[8]; *p1; p1++)
|
|
||||||
*p1 = *(p1+1);
|
|
||||||
line[9] = 't';
|
|
||||||
#endif
|
|
||||||
chown(line, 0, 0);
|
chown(line, 0, 0);
|
||||||
chmod(line, 0600);
|
chmod(line, 0600);
|
||||||
#if defined(sun) && defined(TIOCGPGRP) && BSD < 199207
|
|
||||||
if (ioctl(p, TIOCGPGRP, &dummy) == 0
|
|
||||||
|| errno != EIO) {
|
|
||||||
chmod(line, 0666);
|
|
||||||
close(p);
|
|
||||||
line[5] = 'p';
|
|
||||||
} else
|
|
||||||
#endif /* defined(sun) && defined(TIOCGPGRP) && BSD < 199207 */
|
|
||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* CRAY */
|
|
||||||
extern lowpty, highpty;
|
|
||||||
struct stat sb;
|
|
||||||
|
|
||||||
for (*ptynum = lowpty; *ptynum <= highpty; (*ptynum)++) {
|
|
||||||
(void) sprintf(myline, "%spty/%03d", _PATH_DEV, *ptynum);
|
|
||||||
p = open(myline, 2);
|
|
||||||
if (p < 0)
|
|
||||||
continue;
|
|
||||||
(void) sprintf(line, "%sp%03d", _PATH_TTY, *ptynum);
|
|
||||||
/*
|
|
||||||
* Here are some shenanigans to make sure that there
|
|
||||||
* are no listeners lurking on the line.
|
|
||||||
*/
|
|
||||||
if(stat(line, &sb) < 0) {
|
|
||||||
(void) close(p);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(sb.st_uid || sb.st_gid || sb.st_mode != 0600) {
|
|
||||||
chown(line, 0, 0);
|
|
||||||
chmod(line, 0600);
|
|
||||||
(void)close(p);
|
|
||||||
p = open(myline, 2);
|
|
||||||
if (p < 0)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Now it should be safe...check for accessability.
|
|
||||||
*/
|
|
||||||
if (access(line, 6) == 0)
|
|
||||||
return(p);
|
|
||||||
else {
|
|
||||||
/* no tty side to pty so skip it */
|
|
||||||
(void) close(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* CRAY */
|
|
||||||
#endif /* STREAMSPTY */
|
#endif /* STREAMSPTY */
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
@ -1042,15 +928,6 @@ tty_rspeed(val)
|
||||||
#endif /* DECODE_BAUD */
|
#endif /* DECODE_BAUD */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
int
|
|
||||||
tty_isnewmap()
|
|
||||||
{
|
|
||||||
return((termbuf.c_oflag & OPOST) && (termbuf.c_oflag & ONLCR) &&
|
|
||||||
!(termbuf.c_oflag & ONLRET));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PARENT_DOES_UTMP
|
#ifdef PARENT_DOES_UTMP
|
||||||
# ifndef NEWINIT
|
# ifndef NEWINIT
|
||||||
extern struct utmp wtmp;
|
extern struct utmp wtmp;
|
||||||
|
@ -1089,7 +966,6 @@ getptyslave()
|
||||||
register int t = -1;
|
register int t = -1;
|
||||||
char erase;
|
char erase;
|
||||||
|
|
||||||
#if !defined(CRAY) || !defined(NEWINIT)
|
|
||||||
# ifdef LINEMODE
|
# ifdef LINEMODE
|
||||||
int waslm;
|
int waslm;
|
||||||
# endif
|
# endif
|
||||||
|
@ -1170,22 +1046,12 @@ getptyslave()
|
||||||
termbuf.sg.sg_flags |= CRMOD|ANYP|ECHO|XTABS;
|
termbuf.sg.sg_flags |= CRMOD|ANYP|ECHO|XTABS;
|
||||||
# endif /* USE_TERMIO */
|
# endif /* USE_TERMIO */
|
||||||
|
|
||||||
/*
|
|
||||||
* Settings for UNICOS (and HPUX)
|
|
||||||
*/
|
|
||||||
# if defined(CRAY) || defined(__hpux)
|
|
||||||
termbuf.c_oflag = OPOST|ONLCR|TAB3;
|
|
||||||
termbuf.c_iflag = IGNPAR|ISTRIP|ICRNL|IXON;
|
|
||||||
termbuf.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK;
|
|
||||||
termbuf.c_cflag = EXTB|HUPCL|CS8;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Settings for all other termios/termio based
|
* Settings for all other termios/termio based
|
||||||
* systems, other than 4.4BSD. In 4.4BSD the
|
* systems, other than 4.4BSD. In 4.4BSD the
|
||||||
* kernel does the initial terminal setup.
|
* kernel does the initial terminal setup.
|
||||||
*/
|
*/
|
||||||
# if defined(USE_TERMIO) && !(defined(CRAY) || defined(__hpux)) && (BSD <= 43)
|
# if defined(USE_TERMIO) && (BSD <= 43)
|
||||||
# ifndef OXTABS
|
# ifndef OXTABS
|
||||||
# define OXTABS 0
|
# define OXTABS 0
|
||||||
# endif
|
# endif
|
||||||
|
@ -1193,7 +1059,7 @@ getptyslave()
|
||||||
termbuf.c_oflag |= ONLCR|OXTABS;
|
termbuf.c_oflag |= ONLCR|OXTABS;
|
||||||
termbuf.c_iflag |= ICRNL;
|
termbuf.c_iflag |= ICRNL;
|
||||||
termbuf.c_iflag &= ~IXOFF;
|
termbuf.c_iflag &= ~IXOFF;
|
||||||
# endif /* defined(USE_TERMIO) && !defined(CRAY) && (BSD <= 43) */
|
# endif /* defined(USE_TERMIO) && (BSD <= 43) */
|
||||||
tty_rspeed((def_rspeed > 0) ? def_rspeed : 9600);
|
tty_rspeed((def_rspeed > 0) ? def_rspeed : 9600);
|
||||||
tty_tspeed((def_tspeed > 0) ? def_tspeed : 9600);
|
tty_tspeed((def_tspeed > 0) ? def_tspeed : 9600);
|
||||||
if (erase)
|
if (erase)
|
||||||
|
@ -1209,7 +1075,6 @@ getptyslave()
|
||||||
set_termbuf();
|
set_termbuf();
|
||||||
if (login_tty(t) == -1)
|
if (login_tty(t) == -1)
|
||||||
fatalperror(net, "login_tty");
|
fatalperror(net, "login_tty");
|
||||||
#endif /* !defined(CRAY) || !defined(NEWINIT) */
|
|
||||||
if (net > 2)
|
if (net > 2)
|
||||||
(void) close(net);
|
(void) close(net);
|
||||||
#if defined(AUTHENTICATION) && defined(NO_LOGIN_F) && defined(LOGIN_R)
|
#if defined(AUTHENTICATION) && defined(NO_LOGIN_F) && defined(LOGIN_R)
|
||||||
|
@ -1225,7 +1090,6 @@ getptyslave()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(CRAY) || !defined(NEWINIT)
|
|
||||||
#ifndef O_NOCTTY
|
#ifndef O_NOCTTY
|
||||||
#define O_NOCTTY 0
|
#define O_NOCTTY 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -1238,9 +1102,6 @@ cleanopen(line)
|
||||||
char *line;
|
char *line;
|
||||||
{
|
{
|
||||||
register int t;
|
register int t;
|
||||||
#ifdef UNICOS7x
|
|
||||||
struct secstat secbuf;
|
|
||||||
#endif /* UNICOS7x */
|
|
||||||
|
|
||||||
#ifndef STREAMSPTY
|
#ifndef STREAMSPTY
|
||||||
/*
|
/*
|
||||||
|
@ -1251,31 +1112,10 @@ cleanopen(line)
|
||||||
(void) chmod(line, 0600);
|
(void) chmod(line, 0600);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# if !defined(CRAY) && (BSD > 43)
|
|
||||||
(void) revoke(line);
|
(void) revoke(line);
|
||||||
# endif
|
|
||||||
#ifdef UNICOS7x
|
|
||||||
if (secflag) {
|
|
||||||
if (secstat(line, &secbuf) < 0)
|
|
||||||
return(-1);
|
|
||||||
if (setulvl(secbuf.st_slevel) < 0)
|
|
||||||
return(-1);
|
|
||||||
if (setucmp(secbuf.st_compart) < 0)
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
#endif /* UNICOS7x */
|
|
||||||
|
|
||||||
t = open(line, O_RDWR|O_NOCTTY);
|
t = open(line, O_RDWR|O_NOCTTY);
|
||||||
|
|
||||||
#ifdef UNICOS7x
|
|
||||||
if (secflag) {
|
|
||||||
if (setulvl(sysv.sy_minlvl) < 0)
|
|
||||||
return(-1);
|
|
||||||
if (setucmp(0) < 0)
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
#endif /* UNICOS7x */
|
|
||||||
|
|
||||||
if (t < 0)
|
if (t < 0)
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
|
@ -1283,7 +1123,7 @@ cleanopen(line)
|
||||||
* Hangup anybody else using this ttyp, then reopen it for
|
* Hangup anybody else using this ttyp, then reopen it for
|
||||||
* ourselves.
|
* ourselves.
|
||||||
*/
|
*/
|
||||||
# if !(defined(CRAY) || defined(__hpux)) && (BSD <= 43) && !defined(STREAMSPTY)
|
# if (BSD <= 43) && !defined(STREAMSPTY)
|
||||||
(void) signal(SIGHUP, SIG_IGN);
|
(void) signal(SIGHUP, SIG_IGN);
|
||||||
vhangup();
|
vhangup();
|
||||||
(void) signal(SIGHUP, SIG_DFL);
|
(void) signal(SIGHUP, SIG_DFL);
|
||||||
|
@ -1291,45 +1131,8 @@ cleanopen(line)
|
||||||
if (t < 0)
|
if (t < 0)
|
||||||
return(-1);
|
return(-1);
|
||||||
# endif
|
# endif
|
||||||
# if defined(CRAY) && defined(TCVHUP)
|
|
||||||
{
|
|
||||||
register int i;
|
|
||||||
(void) signal(SIGHUP, SIG_IGN);
|
|
||||||
(void) ioctl(t, TCVHUP, (char *)0);
|
|
||||||
(void) signal(SIGHUP, SIG_DFL);
|
|
||||||
setpgrp();
|
|
||||||
|
|
||||||
#ifdef UNICOS7x
|
|
||||||
if (secflag) {
|
|
||||||
if (secstat(line, &secbuf) < 0)
|
|
||||||
return(-1);
|
|
||||||
if (setulvl(secbuf.st_slevel) < 0)
|
|
||||||
return(-1);
|
|
||||||
if (setucmp(secbuf.st_compart) < 0)
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
#endif /* UNICOS7x */
|
|
||||||
|
|
||||||
i = open(line, O_RDWR);
|
|
||||||
|
|
||||||
#ifdef UNICOS7x
|
|
||||||
if (secflag) {
|
|
||||||
if (setulvl(sysv.sy_minlvl) < 0)
|
|
||||||
return(-1);
|
|
||||||
if (setucmp(0) < 0)
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
#endif /* UNICOS7x */
|
|
||||||
|
|
||||||
if (i < 0)
|
|
||||||
return(-1);
|
|
||||||
(void) close(t);
|
|
||||||
t = i;
|
|
||||||
}
|
|
||||||
# endif /* defined(CRAY) && defined(TCVHUP) */
|
|
||||||
return(t);
|
return(t);
|
||||||
}
|
}
|
||||||
#endif /* !defined(CRAY) || !defined(NEWINIT) */
|
|
||||||
|
|
||||||
#if BSD <= 43
|
#if BSD <= 43
|
||||||
|
|
||||||
|
@ -1351,15 +1154,6 @@ login_tty(t)
|
||||||
# ifdef TIOCSCTTY
|
# ifdef TIOCSCTTY
|
||||||
if (ioctl(t, TIOCSCTTY, (char *)0) < 0)
|
if (ioctl(t, TIOCSCTTY, (char *)0) < 0)
|
||||||
fatalperror(net, "ioctl(sctty)");
|
fatalperror(net, "ioctl(sctty)");
|
||||||
# if defined(CRAY)
|
|
||||||
/*
|
|
||||||
* Close the hard fd to /dev/ttypXXX, and re-open through
|
|
||||||
* the indirect /dev/tty interface.
|
|
||||||
*/
|
|
||||||
close(t);
|
|
||||||
if ((t = open(_PATH_TTY, O_RDWR)) < 0)
|
|
||||||
fatalperror(net, "open(/dev/tty)");
|
|
||||||
# endif
|
|
||||||
# else
|
# else
|
||||||
/*
|
/*
|
||||||
* We get our controlling tty assigned as a side-effect
|
* We get our controlling tty assigned as a side-effect
|
||||||
|
@ -1368,11 +1162,7 @@ login_tty(t)
|
||||||
* setsid() call above may have set our pgrp, so clear
|
* setsid() call above may have set our pgrp, so clear
|
||||||
* it out before opening the tty...
|
* it out before opening the tty...
|
||||||
*/
|
*/
|
||||||
# ifndef SOLARIS
|
|
||||||
(void) setpgrp(0, 0);
|
(void) setpgrp(0, 0);
|
||||||
# else
|
|
||||||
(void) setpgrp();
|
|
||||||
# endif
|
|
||||||
close(open(line, O_RDWR));
|
close(open(line, O_RDWR));
|
||||||
# endif
|
# endif
|
||||||
if (t != 0)
|
if (t != 0)
|
||||||
|
@ -1451,20 +1241,13 @@ startslave(host, autologin, autoname)
|
||||||
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(_PATH_DEV) - 1);
|
SCPYN(wtmp.ut_line, line + sizeof(_PATH_DEV) - 1);
|
||||||
#ifndef __hpux
|
|
||||||
SCPYN(wtmp.ut_id, wtmp.ut_line+3);
|
SCPYN(wtmp.ut_id, wtmp.ut_line+3);
|
||||||
#else
|
|
||||||
SCPYN(wtmp.ut_id, wtmp.ut_line+7);
|
|
||||||
#endif
|
|
||||||
pututline(&wtmp);
|
pututline(&wtmp);
|
||||||
endutent();
|
endutent();
|
||||||
if ((i = open(wtmpf, O_WRONLY|O_APPEND)) >= 0) {
|
if ((i = open(wtmpf, O_WRONLY|O_APPEND)) >= 0) {
|
||||||
(void) write(i, (char *)&wtmp, sizeof(struct utmp));
|
(void) write(i, (char *)&wtmp, sizeof(struct utmp));
|
||||||
(void) close(i);
|
(void) close(i);
|
||||||
}
|
}
|
||||||
#ifdef CRAY
|
|
||||||
(void) signal(WJSIGNAL, sigjob);
|
|
||||||
#endif
|
|
||||||
utmp_sig_notify(pid);
|
utmp_sig_notify(pid);
|
||||||
# endif /* PARENT_DOES_UTMP */
|
# endif /* PARENT_DOES_UTMP */
|
||||||
} else {
|
} else {
|
||||||
|
@ -1489,10 +1272,8 @@ startslave(host, autologin, autoname)
|
||||||
SCPYN(request.tty_id, &line[8]);
|
SCPYN(request.tty_id, &line[8]);
|
||||||
SCPYN(request.host, host);
|
SCPYN(request.host, host);
|
||||||
SCPYN(request.term_type, terminaltype ? terminaltype : "network");
|
SCPYN(request.term_type, terminaltype ? terminaltype : "network");
|
||||||
#if !defined(UNICOS5)
|
|
||||||
request.signal = SIGCLD;
|
request.signal = SIGCLD;
|
||||||
request.pid = getpid();
|
request.pid = getpid();
|
||||||
#endif
|
|
||||||
#ifdef BFTPDAEMON
|
#ifdef BFTPDAEMON
|
||||||
/*
|
/*
|
||||||
* Are we working as the bftp daemon?
|
* Are we working as the bftp daemon?
|
||||||
|
@ -1540,10 +1321,6 @@ init_env()
|
||||||
envp = envinit;
|
envp = envinit;
|
||||||
if ((*envp = getenv("TZ")))
|
if ((*envp = getenv("TZ")))
|
||||||
*envp++ -= 3;
|
*envp++ -= 3;
|
||||||
#if defined(CRAY) || defined(__hpux)
|
|
||||||
else
|
|
||||||
*envp++ = "TZ=GMT0";
|
|
||||||
#endif
|
|
||||||
*envp = 0;
|
*envp = 0;
|
||||||
environ = envinit;
|
environ = envinit;
|
||||||
}
|
}
|
||||||
|
@ -1919,61 +1696,9 @@ cleanup(sig)
|
||||||
(void) shutdown(net, 2);
|
(void) shutdown(net, 2);
|
||||||
exit(1);
|
exit(1);
|
||||||
# else /* NEWINIT */
|
# else /* NEWINIT */
|
||||||
# ifdef CRAY
|
|
||||||
static int incleanup = 0;
|
|
||||||
register int t;
|
|
||||||
int child_status; /* status of child process as returned by waitpid */
|
|
||||||
int flags = WNOHANG|WUNTRACED;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 1: Pick up the zombie, if we are being called
|
|
||||||
* as the signal handler.
|
|
||||||
* 2: If we are a nested cleanup(), return.
|
|
||||||
* 3: Try to clean up TMPDIR.
|
|
||||||
* 4: Fill in utmp with shutdown of process.
|
|
||||||
* 5: Close down the network and pty connections.
|
|
||||||
* 6: Finish up the TMPDIR cleanup, if needed.
|
|
||||||
*/
|
|
||||||
if (sig == SIGCHLD) {
|
|
||||||
while (waitpid(-1, &child_status, flags) > 0)
|
|
||||||
; /* VOID */
|
|
||||||
/* Check if the child process was stopped
|
|
||||||
* rather than exited. We want cleanup only if
|
|
||||||
* the child has died.
|
|
||||||
*/
|
|
||||||
if (WIFSTOPPED(child_status)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
t = sigblock(sigmask(SIGCHLD));
|
|
||||||
if (incleanup) {
|
|
||||||
sigsetmask(t);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
incleanup = 1;
|
|
||||||
sigsetmask(t);
|
|
||||||
#ifdef UNICOS7x
|
|
||||||
if (secflag) {
|
|
||||||
/*
|
|
||||||
* We need to set ourselves back to a null
|
|
||||||
* label to clean up.
|
|
||||||
*/
|
|
||||||
|
|
||||||
setulvl(sysv.sy_minlvl);
|
|
||||||
setucmp((long)0);
|
|
||||||
}
|
|
||||||
#endif /* UNICOS7x */
|
|
||||||
|
|
||||||
t = cleantmp(&wtmp);
|
|
||||||
setutent(); /* just to make sure */
|
|
||||||
# endif /* CRAY */
|
|
||||||
rmut(line);
|
rmut(line);
|
||||||
close(pty);
|
close(pty);
|
||||||
(void) shutdown(net, 2);
|
(void) shutdown(net, 2);
|
||||||
# ifdef CRAY
|
|
||||||
if (t == 0)
|
|
||||||
cleantmp(&wtmp);
|
|
||||||
# endif /* CRAY */
|
|
||||||
exit(1);
|
exit(1);
|
||||||
# endif /* NEWINT */
|
# endif /* NEWINT */
|
||||||
#endif /* PARENT_DOES_UTMP */
|
#endif /* PARENT_DOES_UTMP */
|
||||||
|
@ -2017,11 +1742,6 @@ utmp_sig_reset()
|
||||||
(void) signal(SIGUSR1, func); /* reset handler to default */
|
(void) signal(SIGUSR1, func); /* reset handler to default */
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef __hpux
|
|
||||||
# define sigoff() /* do nothing */
|
|
||||||
# define sigon() /* do nothing */
|
|
||||||
# endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
utmp_sig_wait()
|
utmp_sig_wait()
|
||||||
{
|
{
|
||||||
|
@ -2042,184 +1762,6 @@ utmp_sig_notify(pid)
|
||||||
kill(pid, SIGUSR1);
|
kill(pid, SIGUSR1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef CRAY
|
|
||||||
static int gotsigjob = 0;
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
void
|
|
||||||
sigjob(sig)
|
|
||||||
int sig;
|
|
||||||
{
|
|
||||||
register int jid;
|
|
||||||
register struct jobtemp *jp;
|
|
||||||
|
|
||||||
while ((jid = waitjob(NULL)) != -1) {
|
|
||||||
if (jid == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gotsigjob++;
|
|
||||||
jobend(jid, NULL, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* jid_getutid:
|
|
||||||
* called by jobend() before calling cleantmp()
|
|
||||||
* to find the correct $TMPDIR to cleanup.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct utmp *
|
|
||||||
jid_getutid(jid)
|
|
||||||
int jid;
|
|
||||||
{
|
|
||||||
struct utmp *cur = NULL;
|
|
||||||
|
|
||||||
setutent(); /* just to make sure */
|
|
||||||
while (cur = getutent()) {
|
|
||||||
if ( (cur->ut_type != NULL) && (jid == cur->ut_jid) ) {
|
|
||||||
return(cur);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clean up the TMPDIR that login created.
|
|
||||||
* The first time this is called we pick up the info
|
|
||||||
* from the utmp. If the job has already gone away,
|
|
||||||
* then we'll clean up and be done. If not, then
|
|
||||||
* when this is called the second time it will wait
|
|
||||||
* for the signal that the job is done.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
cleantmp(wtp)
|
|
||||||
register struct utmp *wtp;
|
|
||||||
{
|
|
||||||
struct utmp *utp;
|
|
||||||
static int first = 1;
|
|
||||||
register int mask, omask, ret;
|
|
||||||
extern struct utmp *getutid P((const struct utmp *_Id));
|
|
||||||
|
|
||||||
|
|
||||||
mask = sigmask(WJSIGNAL);
|
|
||||||
|
|
||||||
if (first == 0) {
|
|
||||||
omask = sigblock(mask);
|
|
||||||
while (gotsigjob == 0)
|
|
||||||
sigpause(omask);
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
first = 0;
|
|
||||||
setutent(); /* just to make sure */
|
|
||||||
|
|
||||||
utp = getutid(wtp);
|
|
||||||
if (utp == 0) {
|
|
||||||
syslog(LOG_ERR, "can't get /etc/utmp entry to clean TMPDIR");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Nothing to clean up if the user shell was never started.
|
|
||||||
*/
|
|
||||||
if (utp->ut_type != USER_PROCESS || utp->ut_jid == 0)
|
|
||||||
return(1);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Block the WJSIGNAL while we are in jobend().
|
|
||||||
*/
|
|
||||||
omask = sigblock(mask);
|
|
||||||
ret = jobend(utp->ut_jid, utp->ut_tpath, utp->ut_user);
|
|
||||||
sigsetmask(omask);
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
jobend(jid, path, user)
|
|
||||||
register int jid;
|
|
||||||
register char *path;
|
|
||||||
register char *user;
|
|
||||||
{
|
|
||||||
static int saved_jid = 0;
|
|
||||||
static int pty_saved_jid = 0;
|
|
||||||
static char saved_path[sizeof(wtmp.ut_tpath)+1];
|
|
||||||
static char saved_user[sizeof(wtmp.ut_user)+1];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* this little piece of code comes into play
|
|
||||||
* only when ptyreconnect is used to reconnect
|
|
||||||
* to an previous session.
|
|
||||||
*
|
|
||||||
* this is the only time when the
|
|
||||||
* "saved_jid != jid" code is executed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( saved_jid && saved_jid != jid ) {
|
|
||||||
if (!path) { /* called from signal handler */
|
|
||||||
pty_saved_jid = jid;
|
|
||||||
} else {
|
|
||||||
pty_saved_jid = saved_jid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path) {
|
|
||||||
strncpy(saved_path, path, sizeof(wtmp.ut_tpath));
|
|
||||||
strncpy(saved_user, user, sizeof(wtmp.ut_user));
|
|
||||||
saved_path[sizeof(saved_path)] = '\0';
|
|
||||||
saved_user[sizeof(saved_user)] = '\0';
|
|
||||||
}
|
|
||||||
if (saved_jid == 0) {
|
|
||||||
saved_jid = jid;
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if the jid has changed, get the correct entry from the utmp file */
|
|
||||||
|
|
||||||
if ( saved_jid != jid ) {
|
|
||||||
struct utmp *utp = NULL;
|
|
||||||
struct utmp *jid_getutid();
|
|
||||||
|
|
||||||
utp = jid_getutid(pty_saved_jid);
|
|
||||||
|
|
||||||
if (utp == 0) {
|
|
||||||
syslog(LOG_ERR, "Can't get /etc/utmp entry to clean TMPDIR");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleantmpdir(jid, utp->ut_tpath, utp->ut_user);
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleantmpdir(jid, saved_path, saved_user);
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fork a child process to clean up the TMPDIR
|
|
||||||
*/
|
|
||||||
cleantmpdir(jid, tpath, user)
|
|
||||||
register int jid;
|
|
||||||
register char *tpath;
|
|
||||||
register char *user;
|
|
||||||
{
|
|
||||||
switch(fork()) {
|
|
||||||
case -1:
|
|
||||||
syslog(LOG_ERR, "TMPDIR cleanup(%s): fork() failed: %m",
|
|
||||||
tpath);
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
execl(CLEANTMPCMD, CLEANTMPCMD, user, tpath, (char *)0);
|
|
||||||
syslog(LOG_ERR, "TMPDIR cleanup(%s): execl(%s) failed: %m",
|
|
||||||
tpath, CLEANTMPCMD);
|
|
||||||
exit(1);
|
|
||||||
default:
|
|
||||||
/*
|
|
||||||
* Forget about child. We will exit, and
|
|
||||||
* /etc/init will pick it up.
|
|
||||||
*/
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# endif /* CRAY */
|
|
||||||
#endif /* defined(PARENT_DOES_UTMP) && !defined(NEWINIT) */
|
#endif /* defined(PARENT_DOES_UTMP) && !defined(NEWINIT) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2259,7 +1801,7 @@ rmut()
|
||||||
} /* end of rmut */
|
} /* end of rmut */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(UTMPX) && !(defined(CRAY) || defined(__hpux)) && BSD <= 43
|
#if !defined(UTMPX) && BSD <= 43
|
||||||
void
|
void
|
||||||
rmut()
|
rmut()
|
||||||
{
|
{
|
||||||
|
@ -2310,43 +1852,4 @@ rmut()
|
||||||
(void) chmod(line, 0666);
|
(void) chmod(line, 0666);
|
||||||
(void) chown(line, 0, 0);
|
(void) chown(line, 0, 0);
|
||||||
} /* end of rmut */
|
} /* end of rmut */
|
||||||
#endif /* CRAY */
|
|
||||||
|
|
||||||
#ifdef __hpux
|
|
||||||
rmut (line)
|
|
||||||
char *line;
|
|
||||||
{
|
|
||||||
struct utmp utmp;
|
|
||||||
struct utmp *utptr;
|
|
||||||
int fd; /* for /etc/wtmp */
|
|
||||||
|
|
||||||
utmp.ut_type = USER_PROCESS;
|
|
||||||
(void) strncpy(utmp.ut_id, line+12, sizeof(utmp.ut_id));
|
|
||||||
(void) setutent();
|
|
||||||
utptr = getutid(&utmp);
|
|
||||||
/* write it out only if it exists */
|
|
||||||
if (utptr) {
|
|
||||||
utptr->ut_type = DEAD_PROCESS;
|
|
||||||
utptr->ut_time = time((long *) 0);
|
|
||||||
(void) pututline(utptr);
|
|
||||||
/* set wtmp entry if wtmp file exists */
|
|
||||||
if ((fd = open(wtmpf, O_WRONLY | O_APPEND)) >= 0) {
|
|
||||||
(void) write(fd, utptr, sizeof(utmp));
|
|
||||||
(void) close(fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(void) endutent();
|
|
||||||
|
|
||||||
(void) chmod(line, 0666);
|
|
||||||
(void) chown(line, 0, 0);
|
|
||||||
line[14] = line[13];
|
|
||||||
line[13] = line[12];
|
|
||||||
line[8] = 'm';
|
|
||||||
line[9] = '/';
|
|
||||||
line[10] = 'p';
|
|
||||||
line[11] = 't';
|
|
||||||
line[12] = 'y';
|
|
||||||
(void) chmod(line, 0666);
|
|
||||||
(void) chown(line, 0, 0);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -243,29 +243,6 @@ have been idle for some period of time to determine
|
||||||
if the client is still there, so that idle connections
|
if the client is still there, so that idle connections
|
||||||
from machines that have crashed or can no longer
|
from machines that have crashed or can no longer
|
||||||
be reached may be cleaned up.
|
be reached may be cleaned up.
|
||||||
.It Fl r Ar lowpty-highpty
|
|
||||||
This option is only enabled when
|
|
||||||
.Nm
|
|
||||||
is compiled for
|
|
||||||
.Dv UNICOS .
|
|
||||||
It specifies an inclusive range of pseudo-terminal devices to
|
|
||||||
use. If the system has sysconf variable
|
|
||||||
.Dv _SC_CRAY_NPTY
|
|
||||||
configured, the default pty search range is 0 to
|
|
||||||
.Dv _SC_CRAY_NPTY ;
|
|
||||||
otherwise, the default range is 0 to 128. Either
|
|
||||||
.Ar lowpty
|
|
||||||
or
|
|
||||||
.Ar highpty
|
|
||||||
may be omitted to allow changing
|
|
||||||
either end of the search range. If
|
|
||||||
.Ar lowpty
|
|
||||||
is omitted, the - character is still required so that
|
|
||||||
.Nm
|
|
||||||
can differentiate
|
|
||||||
.Ar highpty
|
|
||||||
from
|
|
||||||
.Ar lowpty .
|
|
||||||
.It Fl s
|
.It Fl s
|
||||||
This option is only enabled if
|
This option is only enabled if
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -543,8 +520,6 @@ will be displayed to both console and remote logins.
|
||||||
.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/gettytab
|
||||||
.It Pa /etc/inittab
|
|
||||||
(UNICOS systems only)
|
|
||||||
.It Pa /etc/iptos
|
.It Pa /etc/iptos
|
||||||
(if supported)
|
(if supported)
|
||||||
.It Pa /usr/ucb/bftp
|
.It Pa /usr/ucb/bftp
|
||||||
|
|
|
@ -48,15 +48,6 @@ static const char rcsid[] =
|
||||||
#include "telnetd.h"
|
#include "telnetd.h"
|
||||||
#include "pathnames.h"
|
#include "pathnames.h"
|
||||||
|
|
||||||
#if defined(_SC_CRAY_SECURE_SYS) && !defined(SCM_SECURITY)
|
|
||||||
/*
|
|
||||||
* UNICOS 6.0/6.1 do not have SCM_SECURITY defined, so we can
|
|
||||||
* use it to tell us to turn off all the socket security code,
|
|
||||||
* since that is only used in UNICOS 7.0 and later.
|
|
||||||
*/
|
|
||||||
# undef _SC_CRAY_SECURE_SYS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
@ -65,30 +56,6 @@ static const char rcsid[] =
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
|
|
||||||
#if defined(_SC_CRAY_SECURE_SYS)
|
|
||||||
#include <sys/sysv.h>
|
|
||||||
#include <sys/secdev.h>
|
|
||||||
# ifdef SO_SEC_MULTI /* 8.0 code */
|
|
||||||
#include <sys/secparm.h>
|
|
||||||
#include <sys/usrv.h>
|
|
||||||
# endif /* SO_SEC_MULTI */
|
|
||||||
|
|
||||||
/* wrapper for KAME-special getnameinfo() */
|
|
||||||
#ifndef NI_WITHSCOPEID
|
|
||||||
#define NI_WITHSCOPEID 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int secflag;
|
|
||||||
char tty_dev[16];
|
|
||||||
struct secdev dv;
|
|
||||||
struct sysv sysv;
|
|
||||||
# ifdef SO_SEC_MULTI /* 8.0 code */
|
|
||||||
struct socksec ss;
|
|
||||||
# else /* SO_SEC_MULTI */ /* 7.0 code */
|
|
||||||
struct socket_security ss;
|
|
||||||
# endif /* SO_SEC_MULTI */
|
|
||||||
#endif /* _SC_CRAY_SECURE_SYS */
|
|
||||||
|
|
||||||
#if defined(AUTHENTICATION)
|
#if defined(AUTHENTICATION)
|
||||||
#include <libtelnet/auth.h>
|
#include <libtelnet/auth.h>
|
||||||
int auth_level = 0;
|
int auth_level = 0;
|
||||||
|
@ -144,11 +111,6 @@ void startslave(char *host, int autologin, char *autoname);
|
||||||
|
|
||||||
int hostinfo = 1; /* do we print login banner? */
|
int hostinfo = 1; /* do we print login banner? */
|
||||||
|
|
||||||
#ifdef CRAY
|
|
||||||
extern int newmap; /* nonzero if \n maps to ^M^J */
|
|
||||||
int lowpty = 0, highpty; /* low, high pty numbers */
|
|
||||||
#endif /* CRAY */
|
|
||||||
|
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
int keepalive = 1;
|
int keepalive = 1;
|
||||||
char *altlogin;
|
char *altlogin;
|
||||||
|
@ -178,15 +140,9 @@ char valid_opts[] = {
|
||||||
#ifdef ENCRYPTION
|
#ifdef ENCRYPTION
|
||||||
'e', ':',
|
'e', ':',
|
||||||
#endif
|
#endif
|
||||||
#if defined(CRAY) && defined(NEWINIT)
|
|
||||||
'I', ':',
|
|
||||||
#endif
|
|
||||||
#ifdef LINEMODE
|
#ifdef LINEMODE
|
||||||
'l',
|
'l',
|
||||||
#endif
|
#endif
|
||||||
#ifdef CRAY
|
|
||||||
'r', ':',
|
|
||||||
#endif
|
|
||||||
#ifdef SecurID
|
#ifdef SecurID
|
||||||
's',
|
's',
|
||||||
#endif
|
#endif
|
||||||
|
@ -229,14 +185,6 @@ main(argc, argv)
|
||||||
|
|
||||||
linemode=1; /*Default to mode that works on bulk of clients*/
|
linemode=1; /*Default to mode that works on bulk of clients*/
|
||||||
|
|
||||||
#ifdef CRAY
|
|
||||||
/*
|
|
||||||
* Get number of pty's before trying to process options,
|
|
||||||
* which may include changing pty range.
|
|
||||||
*/
|
|
||||||
highpty = getnpty();
|
|
||||||
#endif /* CRAY */
|
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, valid_opts)) != -1) {
|
while ((ch = getopt(argc, argv, valid_opts)) != -1) {
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
|
|
||||||
|
@ -320,15 +268,6 @@ main(argc, argv)
|
||||||
hostinfo = 0;
|
hostinfo = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(CRAY) && defined(NEWINIT)
|
|
||||||
case 'I':
|
|
||||||
{
|
|
||||||
extern char *gen_id;
|
|
||||||
gen_id = optarg;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif /* defined(CRAY) && defined(NEWINIT) */
|
|
||||||
|
|
||||||
#ifdef LINEMODE
|
#ifdef LINEMODE
|
||||||
case 'l':
|
case 'l':
|
||||||
alwayslinemode = 1;
|
alwayslinemode = 1;
|
||||||
|
@ -351,34 +290,6 @@ main(argc, argv)
|
||||||
altlogin = optarg;
|
altlogin = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef CRAY
|
|
||||||
case 'r':
|
|
||||||
{
|
|
||||||
char *strchr();
|
|
||||||
char *c;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Allow the specification of alterations
|
|
||||||
* to the pty search range. It is legal to
|
|
||||||
* specify only one, and not change the
|
|
||||||
* other from its default.
|
|
||||||
*/
|
|
||||||
c = strchr(optarg, '-');
|
|
||||||
if (c) {
|
|
||||||
*c++ = '\0';
|
|
||||||
highpty = atoi(c);
|
|
||||||
}
|
|
||||||
if (*optarg != '\0')
|
|
||||||
lowpty = atoi(optarg);
|
|
||||||
if ((lowpty > highpty) || (lowpty < 0) ||
|
|
||||||
(highpty > 32767)) {
|
|
||||||
usage();
|
|
||||||
/* NOT REACHED */
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif /* CRAY */
|
|
||||||
|
|
||||||
#ifdef SecurID
|
#ifdef SecurID
|
||||||
case 's':
|
case 's':
|
||||||
/* SecurID required */
|
/* SecurID required */
|
||||||
|
@ -489,60 +400,6 @@ main(argc, argv)
|
||||||
/* NOT REACHED */
|
/* NOT REACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_SC_CRAY_SECURE_SYS)
|
|
||||||
secflag = sysconf(_SC_CRAY_SECURE_SYS);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get socket's security label
|
|
||||||
*/
|
|
||||||
if (secflag) {
|
|
||||||
int szss = sizeof(ss);
|
|
||||||
#ifdef SO_SEC_MULTI /* 8.0 code */
|
|
||||||
int sock_multi;
|
|
||||||
int szi = sizeof(int);
|
|
||||||
#endif /* SO_SEC_MULTI */
|
|
||||||
|
|
||||||
memset((char *)&dv, 0, sizeof(dv));
|
|
||||||
|
|
||||||
if (getsysv(&sysv, sizeof(struct sysv)) != 0)
|
|
||||||
err(1, "getsysv");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get socket security label and set device values
|
|
||||||
* {security label to be set on ttyp device}
|
|
||||||
*/
|
|
||||||
#ifdef SO_SEC_MULTI /* 8.0 code */
|
|
||||||
if ((getsockopt(0, SOL_SOCKET, SO_SECURITY,
|
|
||||||
(char *)&ss, &szss) < 0) ||
|
|
||||||
(getsockopt(0, SOL_SOCKET, SO_SEC_MULTI,
|
|
||||||
(char *)&sock_multi, &szi) < 0)) {
|
|
||||||
err(1, "getsockopt");
|
|
||||||
} else {
|
|
||||||
dv.dv_actlvl = ss.ss_actlabel.lt_level;
|
|
||||||
dv.dv_actcmp = ss.ss_actlabel.lt_compart;
|
|
||||||
if (!sock_multi) {
|
|
||||||
dv.dv_minlvl = dv.dv_maxlvl = dv.dv_actlvl;
|
|
||||||
dv.dv_valcmp = dv.dv_actcmp;
|
|
||||||
} else {
|
|
||||||
dv.dv_minlvl = ss.ss_minlabel.lt_level;
|
|
||||||
dv.dv_maxlvl = ss.ss_maxlabel.lt_level;
|
|
||||||
dv.dv_valcmp = ss.ss_maxlabel.lt_compart;
|
|
||||||
}
|
|
||||||
dv.dv_devflg = 0;
|
|
||||||
}
|
|
||||||
#else /* SO_SEC_MULTI */ /* 7.0 code */
|
|
||||||
if (getsockopt(0, SOL_SOCKET, SO_SECURITY,
|
|
||||||
(char *)&ss, &szss) >= 0) {
|
|
||||||
dv.dv_actlvl = ss.ss_slevel;
|
|
||||||
dv.dv_actcmp = ss.ss_compart;
|
|
||||||
dv.dv_minlvl = ss.ss_minlvl;
|
|
||||||
dv.dv_maxlvl = ss.ss_maxlvl;
|
|
||||||
dv.dv_valcmp = ss.ss_maxcmp;
|
|
||||||
}
|
|
||||||
#endif /* SO_SEC_MULTI */
|
|
||||||
}
|
|
||||||
#endif /* _SC_CRAY_SECURE_SYS */
|
|
||||||
|
|
||||||
openlog("telnetd", LOG_PID | LOG_ODELAY, LOG_DAEMON);
|
openlog("telnetd", LOG_PID | LOG_ODELAY, LOG_DAEMON);
|
||||||
fromlen = sizeof (from);
|
fromlen = sizeof (from);
|
||||||
if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0) {
|
if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0) {
|
||||||
|
@ -595,9 +452,6 @@ usage()
|
||||||
fprintf(stderr, " [-edebug]");
|
fprintf(stderr, " [-edebug]");
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, " [-h]");
|
fprintf(stderr, " [-h]");
|
||||||
#if defined(CRAY) && defined(NEWINIT)
|
|
||||||
fprintf(stderr, " [-Iinitid]");
|
|
||||||
#endif
|
|
||||||
#if defined(LINEMODE) && defined(KLUDGELINEMODE)
|
#if defined(LINEMODE) && defined(KLUDGELINEMODE)
|
||||||
fprintf(stderr, " [-k]");
|
fprintf(stderr, " [-k]");
|
||||||
#endif
|
#endif
|
||||||
|
@ -605,9 +459,6 @@ usage()
|
||||||
fprintf(stderr, " [-l]");
|
fprintf(stderr, " [-l]");
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, " [-n]");
|
fprintf(stderr, " [-n]");
|
||||||
#ifdef CRAY
|
|
||||||
fprintf(stderr, " [-r[lowpty]-[highpty]]");
|
|
||||||
#endif
|
|
||||||
fprintf(stderr, "\n\t");
|
fprintf(stderr, "\n\t");
|
||||||
#ifdef SecurID
|
#ifdef SecurID
|
||||||
fprintf(stderr, " [-s]");
|
fprintf(stderr, " [-s]");
|
||||||
|
@ -861,22 +712,6 @@ doit(who)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_SC_CRAY_SECURE_SYS)
|
|
||||||
/*
|
|
||||||
* set ttyp line security label
|
|
||||||
*/
|
|
||||||
if (secflag) {
|
|
||||||
char slave_dev[16];
|
|
||||||
|
|
||||||
sprintf(tty_dev, "%spty/%03d", _PATH_DEV, ptynum);
|
|
||||||
if (setdevs(tty_dev, &dv) < 0)
|
|
||||||
fatal(net, "cannot set pty security");
|
|
||||||
sprintf(slave_dev, "%sp%03d", _PATH_TTY, ptynum);
|
|
||||||
if (setdevs(slave_dev, &dv) < 0)
|
|
||||||
fatal(net, "cannot set tty security");
|
|
||||||
}
|
|
||||||
#endif /* _SC_CRAY_SECURE_SYS */
|
|
||||||
|
|
||||||
/* get name of connected client */
|
/* get name of connected client */
|
||||||
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)
|
||||||
|
@ -907,35 +742,11 @@ doit(who)
|
||||||
level = getterminaltype(user_name);
|
level = getterminaltype(user_name);
|
||||||
setenv("TERM", terminaltype ? terminaltype : "network", 1);
|
setenv("TERM", terminaltype ? terminaltype : "network", 1);
|
||||||
|
|
||||||
#if defined(_SC_CRAY_SECURE_SYS)
|
|
||||||
if (secflag) {
|
|
||||||
if (setulvl(dv.dv_actlvl) < 0)
|
|
||||||
fatal(net,"cannot setulvl()");
|
|
||||||
if (setucmp(dv.dv_actcmp) < 0)
|
|
||||||
fatal(net, "cannot setucmp()");
|
|
||||||
}
|
|
||||||
#endif /* _SC_CRAY_SECURE_SYS */
|
|
||||||
|
|
||||||
telnet(net, pty, remote_hostname); /* begin server process */
|
telnet(net, pty, remote_hostname); /* begin server process */
|
||||||
|
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
} /* end of doit */
|
} /* end of doit */
|
||||||
|
|
||||||
#if defined(CRAY2) && defined(UNICOS5) && defined(UNICOS50)
|
|
||||||
int
|
|
||||||
Xterm_output(ibufp, obuf, icountp, ocount)
|
|
||||||
char **ibufp, *obuf;
|
|
||||||
int *icountp, ocount;
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
ret = term_output(*ibufp, obuf, *icountp, ocount);
|
|
||||||
*ibufp += *icountp;
|
|
||||||
*icountp = 0;
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
#define term_output Xterm_output
|
|
||||||
#endif /* defined(CRAY2) && defined(UNICOS5) && defined(UNICOS50) */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main loop. Select from pty and network, and
|
* Main loop. Select from pty and network, and
|
||||||
* hand data to telnet receiver finite state machine.
|
* hand data to telnet receiver finite state machine.
|
||||||
|
@ -1076,9 +887,6 @@ telnet(f, p, host)
|
||||||
|
|
||||||
(void) ioctl(f, FIONBIO, (char *)&on);
|
(void) ioctl(f, FIONBIO, (char *)&on);
|
||||||
(void) ioctl(p, FIONBIO, (char *)&on);
|
(void) ioctl(p, FIONBIO, (char *)&on);
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
init_termdriver(f, p, interrupt, sendbrk);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SO_OOBINLINE)
|
#if defined(SO_OOBINLINE)
|
||||||
(void) setsockopt(net, SOL_SOCKET, SO_OOBINLINE,
|
(void) setsockopt(net, SOL_SOCKET, SO_OOBINLINE,
|
||||||
|
@ -1098,21 +906,6 @@ telnet(f, p, host)
|
||||||
|
|
||||||
(void) signal(SIGCHLD, cleanup);
|
(void) signal(SIGCHLD, cleanup);
|
||||||
|
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
/*
|
|
||||||
* Cray-2 will send a signal when pty modes are changed by slave
|
|
||||||
* side. Set up signal handler now.
|
|
||||||
*/
|
|
||||||
if ((int)signal(SIGUSR1, termstat) < 0)
|
|
||||||
warn("signal");
|
|
||||||
else if (ioctl(p, TCSIGME, (char *)SIGUSR1) < 0)
|
|
||||||
warn("ioctl:TCSIGME");
|
|
||||||
/*
|
|
||||||
* Make processing loop check terminal characteristics early on.
|
|
||||||
*/
|
|
||||||
termstat();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TIOCNOTTY
|
#ifdef TIOCNOTTY
|
||||||
{
|
{
|
||||||
register int t;
|
register int t;
|
||||||
|
@ -1124,11 +917,6 @@ telnet(f, p, host)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CRAY) && defined(NEWINIT) && defined(TIOCSCTTY)
|
|
||||||
(void) setsid();
|
|
||||||
ioctl(p, TIOCSCTTY, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show banner that getty never gave.
|
* Show banner that getty never gave.
|
||||||
*
|
*
|
||||||
|
@ -1137,11 +925,6 @@ telnet(f, p, host)
|
||||||
* other pty --> client data.
|
* other pty --> client data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(CRAY) || !defined(NEWINIT)
|
|
||||||
if (getenv("USER"))
|
|
||||||
hostinfo = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (getent(defent, "default") == 1) {
|
if (getent(defent, "default") == 1) {
|
||||||
char *Getstr();
|
char *Getstr();
|
||||||
char *cp=defstrs;
|
char *cp=defstrs;
|
||||||
|
@ -1190,10 +973,6 @@ telnet(f, p, host)
|
||||||
if (ncc < 0 && pcc < 0)
|
if (ncc < 0 && pcc < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
if (needtermstat)
|
|
||||||
_termstat();
|
|
||||||
#endif /* defined(CRAY2) && defined(UNICOS5) */
|
|
||||||
FD_ZERO(&ibits);
|
FD_ZERO(&ibits);
|
||||||
FD_ZERO(&obits);
|
FD_ZERO(&obits);
|
||||||
FD_ZERO(&xbits);
|
FD_ZERO(&xbits);
|
||||||
|
@ -1329,7 +1108,6 @@ telnet(f, p, host)
|
||||||
} else {
|
} else {
|
||||||
if (pcc <= 0)
|
if (pcc <= 0)
|
||||||
break;
|
break;
|
||||||
#if !defined(CRAY2) || !defined(UNICOS5)
|
|
||||||
#ifdef LINEMODE
|
#ifdef LINEMODE
|
||||||
/*
|
/*
|
||||||
* If ioctl from pty, pass it through net
|
* If ioctl from pty, pass it through net
|
||||||
|
@ -1375,16 +1153,6 @@ telnet(f, p, host)
|
||||||
}
|
}
|
||||||
pcc--;
|
pcc--;
|
||||||
ptyip = ptyibuf+1;
|
ptyip = ptyibuf+1;
|
||||||
#else /* defined(CRAY2) && defined(UNICOS5) */
|
|
||||||
if (!uselinemode) {
|
|
||||||
unpcc = pcc;
|
|
||||||
unptyip = ptyibuf;
|
|
||||||
pcc = term_output(&unptyip, ptyibuf2,
|
|
||||||
&unpcc, BUFSIZ);
|
|
||||||
ptyip = ptyibuf2;
|
|
||||||
} else
|
|
||||||
ptyip = ptyibuf;
|
|
||||||
#endif /* defined(CRAY2) && defined(UNICOS5) */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1394,11 +1162,6 @@ telnet(f, p, host)
|
||||||
c = *ptyip++ & 0377, pcc--;
|
c = *ptyip++ & 0377, pcc--;
|
||||||
if (c == IAC)
|
if (c == IAC)
|
||||||
output_data("%c", c);
|
output_data("%c", c);
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
else if (c == '\n' &&
|
|
||||||
my_state_is_wont(TELOPT_BINARY) && newmap)
|
|
||||||
output_data("\r");
|
|
||||||
#endif /* defined(CRAY2) && defined(UNICOS5) */
|
|
||||||
output_data("%c", c);
|
output_data("%c", c);
|
||||||
if ((c == '\r') && (my_state_is_wont(TELOPT_BINARY))) {
|
if ((c == '\r') && (my_state_is_wont(TELOPT_BINARY))) {
|
||||||
if (pcc > 0 && ((*ptyip & 0377) == '\n')) {
|
if (pcc > 0 && ((*ptyip & 0377) == '\n')) {
|
||||||
|
@ -1408,17 +1171,6 @@ telnet(f, p, host)
|
||||||
output_data("%c", '\0');
|
output_data("%c", '\0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
/*
|
|
||||||
* If chars were left over from the terminal driver,
|
|
||||||
* note their existence.
|
|
||||||
*/
|
|
||||||
if (!uselinemode && unpcc) {
|
|
||||||
pcc = unpcc;
|
|
||||||
unpcc = 0;
|
|
||||||
ptyip = unptyip;
|
|
||||||
}
|
|
||||||
#endif /* defined(CRAY2) && defined(UNICOS5) */
|
|
||||||
|
|
||||||
if (FD_ISSET(f, &obits) && (nfrontp - nbackp) > 0)
|
if (FD_ISSET(f, &obits) && (nfrontp - nbackp) > 0)
|
||||||
netflush();
|
netflush();
|
||||||
|
|
|
@ -56,10 +56,6 @@ int def_row = 0, def_col = 0;
|
||||||
static int _terminit = 0;
|
static int _terminit = 0;
|
||||||
#endif /* LINEMODE */
|
#endif /* LINEMODE */
|
||||||
|
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
int newmap = 1; /* nonzero if \n maps to ^M^J */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LINEMODE
|
#ifdef LINEMODE
|
||||||
/*
|
/*
|
||||||
* localstat
|
* localstat
|
||||||
|
@ -142,14 +138,6 @@ localstat()
|
||||||
{
|
{
|
||||||
int need_will_echo = 0;
|
int need_will_echo = 0;
|
||||||
|
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
/*
|
|
||||||
* Keep track of that ol' CR/NL mapping while we're in the
|
|
||||||
* neighborhood.
|
|
||||||
*/
|
|
||||||
newmap = tty_isnewmap();
|
|
||||||
#endif /* defined(CRAY2) && defined(UNICOS5) */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for changes to flow control if client supports it.
|
* Check for changes to flow control if client supports it.
|
||||||
*/
|
*/
|
||||||
|
@ -588,34 +576,10 @@ clientstat(code, parm1, parm2)
|
||||||
break;
|
break;
|
||||||
} /* end of switch */
|
} /* end of switch */
|
||||||
|
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
/*
|
|
||||||
* Just in case of the likely event that we changed the pty state.
|
|
||||||
*/
|
|
||||||
rcv_ioctl();
|
|
||||||
#endif /* defined(CRAY2) && defined(UNICOS5) */
|
|
||||||
|
|
||||||
netflush();
|
netflush();
|
||||||
|
|
||||||
} /* end of clientstat */
|
} /* end of clientstat */
|
||||||
|
|
||||||
#if defined(CRAY2) && defined(UNICOS5)
|
|
||||||
void
|
|
||||||
termstat()
|
|
||||||
{
|
|
||||||
needtermstat = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_termstat()
|
|
||||||
{
|
|
||||||
needtermstat = 0;
|
|
||||||
init_termbuf();
|
|
||||||
localstat();
|
|
||||||
rcv_ioctl();
|
|
||||||
}
|
|
||||||
#endif /* defined(CRAY2) && defined(UNICOS5) */
|
|
||||||
|
|
||||||
#ifdef LINEMODE
|
#ifdef LINEMODE
|
||||||
/*
|
/*
|
||||||
* defer_terminit
|
* defer_terminit
|
||||||
|
|
Loading…
Reference in New Issue
Block a user