summaryrefslogtreecommitdiffstats
path: root/libexec/telnetd
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2001-08-29 14:16:17 +0000
committermarkm <markm@FreeBSD.org>2001-08-29 14:16:17 +0000
commit5987cca2b86151d430e62288a0608ec25c84c045 (patch)
tree2704c88e81d43025eb2e9acbf5530ba5d0ec8f63 /libexec/telnetd
parent92c57599167493c3bef125d0aa3416a4f3abf082 (diff)
downloadFreeBSD-src-5987cca2b86151d430e62288a0608ec25c84c045.zip
FreeBSD-src-5987cca2b86151d430e62288a0608ec25c84c045.tar.gz
Manually unifdef(1) CRAY, UNICOS, hpux and sun uselsess code.
Diffstat (limited to 'libexec/telnetd')
-rw-r--r--libexec/telnetd/defs.h40
-rw-r--r--libexec/telnetd/ext.h18
-rw-r--r--libexec/telnetd/state.c18
-rw-r--r--libexec/telnetd/sys_term.c505
-rw-r--r--libexec/telnetd/telnetd.825
-rw-r--r--libexec/telnetd/telnetd.c248
-rw-r--r--libexec/telnetd/termstat.c36
7 files changed, 5 insertions, 885 deletions
diff --git a/libexec/telnetd/defs.h b/libexec/telnetd/defs.h
index a73d4a6..d727f36 100644
--- a/libexec/telnetd/defs.h
+++ b/libexec/telnetd/defs.h
@@ -31,6 +31,7 @@
* SUCH DAMAGE.
*
* @(#)defs.h 8.1 (Berkeley) 6/4/93
+ * $FreeBSD$
*/
/*
@@ -43,23 +44,6 @@
# define BSD 43
#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)
#define TELOPTS
#define TELCMDS
@@ -71,9 +55,7 @@
#endif
#include <sys/socket.h>
-#ifndef CRAY
#include <sys/wait.h>
-#endif /* CRAY */
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
@@ -134,22 +116,6 @@ typedef unsigned char cc_t;
# 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)
# define TIOCSCTTY TCSETCTTY
#endif
@@ -169,10 +135,6 @@ typedef struct fd_set { int fds_bits[1]; } fd_set;
* I/O data buffers defines
*/
#define NETSLOP 64
-#ifdef CRAY
-#undef BUFSIZ
-#define BUFSIZ 2048
-#endif
#define NIACCUM(c) { *netip++ = c; \
ncc++; \
diff --git a/libexec/telnetd/ext.h b/libexec/telnetd/ext.h
index 97c2e94..94b2080 100644
--- a/libexec/telnetd/ext.h
+++ b/libexec/telnetd/ext.h
@@ -76,11 +76,6 @@ extern char *neturg; /* one past last bye of urgent data */
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 char line[16];
extern int SYNCHing; /* we are in TELNET SYNCH mode */
@@ -207,18 +202,7 @@ extern struct {
gotDM; /* when did we last see a data mark */
} clocks;
-
-#if defined(CRAY2) && defined(UNICOS5)
-extern int needtermstat;
-#endif
-
#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
# define DEFAULT_IM "\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
# else
@@ -228,6 +212,4 @@ extern int needtermstat;
# define DEFAULT_IM "\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
# endif
# endif
-# endif
-# endif
#endif
diff --git a/libexec/telnetd/state.c b/libexec/telnetd/state.c
index 8b7a62d..21dbacf 100644
--- a/libexec/telnetd/state.c
+++ b/libexec/telnetd/state.c
@@ -88,9 +88,6 @@ telrcv()
{
register int c;
static int state = TS_DATA;
-#if defined(CRAY2) && defined(UNICOS5)
- char *opfrontp = pfrontp;
-#endif
while (ncc > 0) {
if ((&ptyobuf[BUFSIZ] - pfrontp) < 2)
@@ -349,21 +346,6 @@ gotiac: switch (c) {
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 */
/*
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index a5c4aeb..282eea0 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -47,10 +47,6 @@ extern char *altlogin;
int cleanopen(char *line);
void scrub_env(void);
-#if defined(CRAY) || defined(__hpux)
-# define PARENT_DOES_UTMP
-#endif
-
#ifdef NEWINIT
#include <initreq.h>
#else /* NEWINIT*/
@@ -79,20 +75,6 @@ char wtmpf[] = "/etc/wtmp";
#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 */
#ifdef STREAMSPTY
@@ -106,10 +88,6 @@ extern struct sysv sysv;
#ifdef STREAMS
#include <sys/stream.h>
#endif
-#ifdef __hpux
-#include <sys/resource.h>
-#include <sys/proc.h>
-#endif
#include <sys/tty.h>
#ifdef t_erase
#undef t_erase
@@ -128,10 +106,6 @@ extern struct sysv sysv;
#undef t_lnextc
#endif
-#if defined(UNICOS5) && defined(CRAY2) && !defined(EXTPROC)
-# define EXTPROC 0400
-#endif
-
#ifndef USE_TERMIO
struct termbuf {
struct sgttyb sg;
@@ -259,9 +233,6 @@ set_termbuf()
# else
(void) tcsetattr(pty, TCSANOW, &termbuf);
# endif
-# if defined(CRAY2) && defined(UNICOS5)
- needtermstat = 1;
-# endif
#endif /* USE_TERMIO */
}
@@ -449,26 +420,6 @@ spcset(func, valp, valpp)
}
#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
/*
* getpty()
@@ -478,11 +429,7 @@ getnpty()
*
* Returns the file descriptor of the opened pty.
*/
-#ifdef CRAY
-char myline[16];
-#else
char line[16];
-#endif /* CRAY */
int
getpty(ptynum)
@@ -502,23 +449,13 @@ int *ptynum;
}
#else /* ! STREAMSPTY */
-#ifndef CRAY
register char *cp, *p1, *p2;
register int i;
-#if defined(sun) && defined(TIOCGPGRP) && BSD < 199207
- int dummy;
-#endif
-#ifndef __hpux
(void) strcpy(line, _PATH_DEV);
(void) strcat(line, "ptyXX");
p1 = &line[8];
p2 = &line[9];
-#else
- (void) strcpy(line, "/dev/ptym/ptyXX");
- p1 = &line[13];
- p2 = &line[14];
-#endif
for (cp = "pqrsPQRS"; *cp; cp++) {
struct stat stb;
@@ -536,64 +473,13 @@ int *ptynum;
*p2 = "0123456789abcdefghijklmnopqrstuv"[i];
p = open(line, 2);
if (p > 0) {
-#ifndef __hpux
line[5] = 't';
-#else
- for (p1 = &line[8]; *p1; p1++)
- *p1 = *(p1+1);
- line[9] = 't';
-#endif
chown(line, 0, 0);
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);
}
}
}
-#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 */
return(-1);
}
@@ -1022,15 +908,6 @@ tty_rspeed(val)
#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
# ifndef NEWINIT
extern struct utmp wtmp;
@@ -1069,7 +946,6 @@ getptyslave()
register int t = -1;
char erase;
-#if !defined(CRAY) || !defined(NEWINIT)
# ifdef LINEMODE
int waslm;
# endif
@@ -1151,21 +1027,11 @@ getptyslave()
# 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
* systems, other than 4.4BSD. In 4.4BSD the
* kernel does the initial terminal setup.
*/
-# if defined(USE_TERMIO) && !(defined(CRAY) || defined(__hpux)) && (BSD <= 43)
+# if defined(USE_TERMIO) && (BSD <= 43)
# ifndef OXTABS
# define OXTABS 0
# endif
@@ -1173,7 +1039,7 @@ getptyslave()
termbuf.c_oflag |= ONLCR|OXTABS;
termbuf.c_iflag |= ICRNL;
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_tspeed((def_tspeed > 0) ? def_tspeed : 9600);
if (erase)
@@ -1189,7 +1055,6 @@ getptyslave()
set_termbuf();
if (login_tty(t) == -1)
fatalperror(net, "login_tty");
-#endif /* !defined(CRAY) || !defined(NEWINIT) */
if (net > 2)
(void) close(net);
if (pty > 2) {
@@ -1198,7 +1063,6 @@ getptyslave()
}
}
-#if !defined(CRAY) || !defined(NEWINIT)
#ifndef O_NOCTTY
#define O_NOCTTY 0
#endif
@@ -1211,9 +1075,6 @@ cleanopen(line)
char *line;
{
register int t;
-#ifdef UNICOS7x
- struct secstat secbuf;
-#endif /* UNICOS7x */
#ifndef STREAMSPTY
/*
@@ -1224,31 +1085,10 @@ cleanopen(line)
(void) chmod(line, 0600);
#endif
-# if !defined(CRAY) && (BSD > 43)
(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);
-#ifdef UNICOS7x
- if (secflag) {
- if (setulvl(sysv.sy_minlvl) < 0)
- return(-1);
- if (setucmp(0) < 0)
- return(-1);
- }
-#endif /* UNICOS7x */
-
if (t < 0)
return(-1);
@@ -1256,7 +1096,7 @@ cleanopen(line)
* Hangup anybody else using this ttyp, then reopen it for
* ourselves.
*/
-# if !(defined(CRAY) || defined(__hpux)) && (BSD <= 43) && !defined(STREAMSPTY)
+# if (BSD <= 43) && !defined(STREAMSPTY)
(void) signal(SIGHUP, SIG_IGN);
vhangup();
(void) signal(SIGHUP, SIG_DFL);
@@ -1264,45 +1104,8 @@ cleanopen(line)
if (t < 0)
return(-1);
# 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);
}
-#endif /* !defined(CRAY) || !defined(NEWINIT) */
#if BSD <= 43
@@ -1324,15 +1127,6 @@ login_tty(t)
# ifdef TIOCSCTTY
if (ioctl(t, TIOCSCTTY, (char *)0) < 0)
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
/*
* We get our controlling tty assigned as a side-effect
@@ -1341,11 +1135,7 @@ login_tty(t)
* setsid() call above may have set our pgrp, so clear
* it out before opening the tty...
*/
-# ifndef SOLARIS
(void) setpgrp(0, 0);
-# else
- (void) setpgrp();
-# endif
close(open(line, O_RDWR));
# endif
if (t != 0)
@@ -1415,20 +1205,13 @@ startslave(host, autologin, autoname)
SCPYN(wtmp.ut_user, "LOGIN");
SCPYN(wtmp.ut_host, host);
SCPYN(wtmp.ut_line, line + sizeof(_PATH_DEV) - 1);
-#ifndef __hpux
SCPYN(wtmp.ut_id, wtmp.ut_line+3);
-#else
- SCPYN(wtmp.ut_id, wtmp.ut_line+7);
-#endif
pututline(&wtmp);
endutent();
if ((i = open(wtmpf, O_WRONLY|O_APPEND)) >= 0) {
(void) write(i, (char *)&wtmp, sizeof(struct utmp));
(void) close(i);
}
-#ifdef CRAY
- (void) signal(WJSIGNAL, sigjob);
-#endif
utmp_sig_notify(pid);
# endif /* PARENT_DOES_UTMP */
} else {
@@ -1453,10 +1236,8 @@ startslave(host, autologin, autoname)
SCPYN(request.tty_id, &line[8]);
SCPYN(request.host, host);
SCPYN(request.term_type, terminaltype ? terminaltype : "network");
-#if !defined(UNICOS5)
request.signal = SIGCLD;
request.pid = getpid();
-#endif
#ifdef BFTPDAEMON
/*
* Are we working as the bftp daemon?
@@ -1504,10 +1285,6 @@ init_env()
envp = envinit;
if ((*envp = getenv("TZ")))
*envp++ -= 3;
-#if defined(CRAY) || defined(__hpux)
- else
- *envp++ = "TZ=GMT0";
-#endif
*envp = 0;
environ = envinit;
}
@@ -1788,61 +1565,9 @@ cleanup(sig)
(void) shutdown(net, 2);
exit(1);
# 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);
close(pty);
(void) shutdown(net, 2);
-# ifdef CRAY
- if (t == 0)
- cleantmp(&wtmp);
-# endif /* CRAY */
exit(1);
# endif /* NEWINT */
#endif /* PARENT_DOES_UTMP */
@@ -1886,11 +1611,6 @@ utmp_sig_reset()
(void) signal(SIGUSR1, func); /* reset handler to default */
}
-# ifdef __hpux
-# define sigoff() /* do nothing */
-# define sigon() /* do nothing */
-# endif
-
void
utmp_sig_wait()
{
@@ -1911,184 +1631,6 @@ utmp_sig_notify(pid)
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) */
/*
@@ -2128,7 +1670,7 @@ rmut()
} /* end of rmut */
#endif
-#if !defined(UTMPX) && !(defined(CRAY) || defined(__hpux)) && BSD <= 43
+#if !defined(UTMPX) && BSD <= 43
void
rmut()
{
@@ -2179,43 +1721,4 @@ rmut()
(void) chmod(line, 0666);
(void) chown(line, 0, 0);
} /* 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
diff --git a/libexec/telnetd/telnetd.8 b/libexec/telnetd/telnetd.8
index a8e5462..00b444c 100644
--- a/libexec/telnetd/telnetd.8
+++ b/libexec/telnetd/telnetd.8
@@ -243,29 +243,6 @@ have been idle for some period of time to determine
if the client is still there, so that idle connections
from machines that have crashed or can no longer
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
This option is only enabled if
.Nm
@@ -543,8 +520,6 @@ will be displayed to both console and remote logins.
.Bl -tag -width /usr/ucb/bftp -compact
.It Pa /etc/services
.It Pa /etc/gettytab
-.It Pa /etc/inittab
-(UNICOS systems only)
.It Pa /etc/iptos
(if supported)
.It Pa /usr/ucb/bftp
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c
index f433294..f25eced 100644
--- a/libexec/telnetd/telnetd.c
+++ b/libexec/telnetd/telnetd.c
@@ -48,15 +48,6 @@ static const char rcsid[] =
#include "telnetd.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 <arpa/inet.h>
@@ -65,30 +56,6 @@ static const char rcsid[] =
#include <paths.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(SecurID)
int require_SecurID = 0;
#endif
@@ -136,11 +103,6 @@ void startslave(char *host, int autologin, char *autoname);
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 keepalive = 1;
char *altlogin;
@@ -164,15 +126,9 @@ char valid_opts[] = {
#ifdef DIAGNOSTICS
'D', ':',
#endif
-#if defined(CRAY) && defined(NEWINIT)
- 'I', ':',
-#endif
#ifdef LINEMODE
'l',
#endif
-#ifdef CRAY
- 'r', ':',
-#endif
#ifdef SecurID
's',
#endif
@@ -212,14 +168,6 @@ main(argc, argv)
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) {
switch(ch) {
@@ -266,15 +214,6 @@ main(argc, argv)
hostinfo = 0;
break;
-#if defined(CRAY) && defined(NEWINIT)
- case 'I':
- {
- extern char *gen_id;
- gen_id = optarg;
- break;
- }
-#endif /* defined(CRAY) && defined(NEWINIT) */
-
#ifdef LINEMODE
case 'l':
alwayslinemode = 1;
@@ -297,34 +236,6 @@ main(argc, argv)
altlogin = optarg;
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
case 's':
/* SecurID required */
@@ -427,60 +338,6 @@ main(argc, argv)
/* 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);
fromlen = sizeof (from);
if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0) {
@@ -527,9 +384,6 @@ usage()
fprintf(stderr, " [-D (options|report|exercise|netdata|ptydata)]\n\t");
#endif
fprintf(stderr, " [-h]");
-#if defined(CRAY) && defined(NEWINIT)
- fprintf(stderr, " [-Iinitid]");
-#endif
#if defined(LINEMODE) && defined(KLUDGELINEMODE)
fprintf(stderr, " [-k]");
#endif
@@ -537,9 +391,6 @@ usage()
fprintf(stderr, " [-l]");
#endif
fprintf(stderr, " [-n]");
-#ifdef CRAY
- fprintf(stderr, " [-r[lowpty]-[highpty]]");
-#endif
fprintf(stderr, "\n\t");
#ifdef SecurID
fprintf(stderr, " [-s]");
@@ -764,22 +615,6 @@ doit(who)
}
#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 */
if (realhostname_sa(remote_hostname, sizeof(remote_hostname) - 1,
who, who->sa_len) == HOSTNAME_INVALIDADDR && registerd_host_only)
@@ -807,35 +642,11 @@ doit(who)
level = getterminaltype(user_name);
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 */
/*NOTREACHED*/
} /* 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
* hand data to telnet receiver finite state machine.
@@ -976,9 +787,6 @@ telnet(f, p, host)
(void) ioctl(f, 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)
(void) setsockopt(net, SOL_SOCKET, SO_OOBINLINE,
@@ -998,21 +806,6 @@ telnet(f, p, host)
(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
{
register int t;
@@ -1024,11 +817,6 @@ telnet(f, p, host)
}
#endif
-#if defined(CRAY) && defined(NEWINIT) && defined(TIOCSCTTY)
- (void) setsid();
- ioctl(p, TIOCSCTTY, 0);
-#endif
-
/*
* Show banner that getty never gave.
*
@@ -1037,11 +825,6 @@ telnet(f, p, host)
* other pty --> client data.
*/
-#if !defined(CRAY) || !defined(NEWINIT)
- if (getenv("USER"))
- hostinfo = 0;
-#endif
-
if (getent(defent, "default") == 1) {
char *Getstr();
char *cp=defstrs;
@@ -1090,10 +873,6 @@ telnet(f, p, host)
if (ncc < 0 && pcc < 0)
break;
-#if defined(CRAY2) && defined(UNICOS5)
- if (needtermstat)
- _termstat();
-#endif /* defined(CRAY2) && defined(UNICOS5) */
FD_ZERO(&ibits);
FD_ZERO(&obits);
FD_ZERO(&xbits);
@@ -1229,7 +1008,6 @@ telnet(f, p, host)
} else {
if (pcc <= 0)
break;
-#if !defined(CRAY2) || !defined(UNICOS5)
#ifdef LINEMODE
/*
* If ioctl from pty, pass it through net
@@ -1275,16 +1053,6 @@ telnet(f, p, host)
}
pcc--;
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) */
}
}
@@ -1294,11 +1062,6 @@ telnet(f, p, host)
c = *ptyip++ & 0377, pcc--;
if (c == IAC)
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);
if ((c == '\r') && (my_state_is_wont(TELOPT_BINARY))) {
if (pcc > 0 && ((*ptyip & 0377) == '\n')) {
@@ -1308,17 +1071,6 @@ telnet(f, p, host)
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)
netflush();
diff --git a/libexec/telnetd/termstat.c b/libexec/telnetd/termstat.c
index c36e798..b4fb137 100644
--- a/libexec/telnetd/termstat.c
+++ b/libexec/telnetd/termstat.c
@@ -52,10 +52,6 @@ int def_row = 0, def_col = 0;
static int _terminit = 0;
#endif /* LINEMODE */
-#if defined(CRAY2) && defined(UNICOS5)
-int newmap = 1; /* nonzero if \n maps to ^M^J */
-#endif
-
#ifdef LINEMODE
/*
* localstat
@@ -138,14 +134,6 @@ localstat()
{
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.
*/
@@ -564,34 +552,10 @@ clientstat(code, parm1, parm2)
break;
} /* 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();
} /* 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
/*
* defer_terminit
OpenPOWER on IntegriCloud