[2336] in bugtraq
IRIX 5.3 port of telnetd.95.10.23.NE
daemon@ATHENA.MIT.EDU (Dan Mosedale)
Thu Nov 2 19:47:51 1995
Date: Wed, 1 Nov 1995 19:36:46 -0800
Reply-To: Bugtraq List <BUGTRAQ@CRIMELAB.COM>
From: Dan Mosedale <dmose@NETSCAPE.COM>
X-To: bugtraq@fc.net, hartmans@mit.edu, dab@cray.com, cert@cert.org,
tytso@mit.edu, dsiebert@icaen.uiowa.edu,
John Giannandrea <jg@netscape.com>,
Rod Beckwith <rodb@netscape.com>,
William Foss <bill@netscape.com>,
Robert Andrews <robert@netscape.com>,
Sven Sjoberg <svens@netscape.com>, Bob Lord <lord@netscape.com>
To: Multiple recipients of list BUGTRAQ <BUGTRAQ@CRIMELAB.COM>
I threw together a quick and dirty port of the telnet from cray.com to
IRIX 5.3. It's certainly a bit dirty, and not well-tested (I haven't
even tried to use the client, though it does build), but telnetd itself
does seem to work.
Some of the source changes were just to keep the SGI compiler from
excessive bitching and weren't really necessary. Also, even though this
stuff is all #ifdef'ed, I haven't actually tried to compile it on anything
other than an SGI.
Use at your own risk; I'm posting this on my own behalf, not that of
Netscape, etc. All standard disclaimers apply. With that out of the way,
here's the patch...
diff -c -r telnet.95.10.23.NE/Config.generic irix-telnet.95.10.23.NE/Config.generic
*** telnet.95.10.23.NE/Config.generic Mon Oct 23 07:47:21 1995
--- irix-telnet.95.10.23.NE/Config.generic Wed Nov 1 19:17:03 1995
***************
*** 242,248 ****
@echo " solaris2.2 solaris2.2.auth"
@echo " dynix3.0.12 dynix3.0.17"
@echo " ultrix3.1 ultrix4.0 ultrix4.1 ultrix4.3 ultrix4.3.auth"
! @echo " irix4.0.1"
@echo " hpux8.0"
@echo " next1.0"
@echo " convex"
--- 242,248 ----
@echo " solaris2.2 solaris2.2.auth"
@echo " dynix3.0.12 dynix3.0.17"
@echo " ultrix3.1 ultrix4.0 ultrix4.1 ultrix4.3 ultrix4.3.auth"
! @echo " irix4.0.1 irix5.3"
@echo " hpux8.0"
@echo " next1.0"
@echo " convex"
***************
*** 856,861 ****
--- 856,880 ----
AR=ar ARFLAGS=cq RANLIB=NONE \
LIBEXEC=${DESTDIR}/etc \
CC="${CC}" LCCFLAGS="-O"
+
+ irix5.3:
+ @echo $@ is not well-tested... it may or may not work..."
+ make -f Makefile.generic ${WHAT} \
+ LIBS="-ltermlib ../libtelnet/libtelnet.a" \
+ LIBPATH="/lib/libc.so.1 /usr/lib/libtermlib.a \
+ ../libtelnet/libtelnet.a" \
+ DEST=${DESTDIR}/usr/bin \
+ DEFINES=${ODEFS}"-Dvfork=fork -DUSE_TERMIO -DUTMPX \
+ -DDEFAULT_IM='\"\r\n\r\nIRIX System V.4 (%h)\r\n\r\r\n\r\"' \
+ -DNO_LOGIN_F -DNO_LOGIN_P \
+ -DDIAGNOSTICS " \
+ INCLUDES="-I.." \
+ LIB_OBJ="getent.o setenv.o" \
+ LIB_SRC="getent.c setenv.c" \
+ AR=ar ARFLAGS=cq RANLIB=NONE \
+ LIBEXEC=${DESTDIR}/usr/etc \
+ CC="${CC}" LCCFLAGS="-O"
+
hpux8.0:
@echo $@ is untested... it may or may not work..."
diff -c -r telnet.95.10.23.NE/libtelnet/setenv.c irix-telnet.95.10.23.NE/libtelnet/setenv.c
*** telnet.95.10.23.NE/libtelnet/setenv.c Mon Oct 23 07:47:31 1995
--- irix-telnet.95.10.23.NE/libtelnet/setenv.c Wed Nov 1 13:44:58 1995
***************
*** 52,58 ****
#ifndef __P
#define __P(x) ()
#endif
! char *__findenv __P((const char *, int *));
#ifndef NULL
#define NULL 0
#endif
--- 52,58 ----
#ifndef __P
#define __P(x) ()
#endif
! static char *__findenv __P((register const char *, int *));
#ifndef NULL
#define NULL 0
#endif
diff -c -r telnet.95.10.23.NE/telnet/commands.c irix-telnet.95.10.23.NE/telnet/commands.c
*** telnet.95.10.23.NE/telnet/commands.c Mon Oct 23 07:47:35 1995
--- irix-telnet.95.10.23.NE/telnet/commands.c Wed Nov 1 13:56:51 1995
***************
*** 821,827 ****
--- 821,831 ----
*/
#ifdef USE_TERMIO
+ # ifdef __sgi
+ struct termios new_tc = { 0 };
+ # else
struct termio new_tc = { 0 };
+ # endif
#endif
struct setlist {
diff -c -r telnet.95.10.23.NE/telnet/externs.h irix-telnet.95.10.23.NE/telnet/externs.h
*** telnet.95.10.23.NE/telnet/externs.h Mon Oct 23 07:47:35 1995
--- irix-telnet.95.10.23.NE/telnet/externs.h Wed Nov 1 13:58:47 1995
***************
*** 346,352 ****
--- 346,356 ----
# else
+ # ifdef __sgi
+ extern struct termios new_tc;
+ # else
extern struct termio new_tc;
+ # endif
# define termEofChar new_tc.c_cc[VEOF]
# define termEraseChar new_tc.c_cc[VERASE]
diff -c -r telnet.95.10.23.NE/telnet/sys_bsd.c irix-telnet.95.10.23.NE/telnet/sys_bsd.c
*** telnet.95.10.23.NE/telnet/sys_bsd.c Mon Oct 23 07:47:37 1995
--- irix-telnet.95.10.23.NE/telnet/sys_bsd.c Wed Nov 1 13:59:32 1995
***************
*** 82,89 ****
--- 82,95 ----
# define old_tc ottyb
#else /* USE_TERMIO */
+ # ifdef __sgi
+ /* keep sgi compiler from whining */
+ struct termios old_tc = { 0 };
+ extern struct termios new_tc;
+ # else
struct termio old_tc = { 0 };
extern struct termio new_tc;
+ # endif
# ifndef TCSANOW
# ifdef TCSETS
***************
*** 394,400 ****
--- 400,410 ----
struct sgttyb sb;
int lmode;
#else /* USE_TERMIO */
+ # ifdef __sgi
+ struct termios tmp_tc;
+ # else
struct termio tmp_tc;
+ # endif
#endif /* USE_TERMIO */
int onoff;
int old;
diff -c -r telnet.95.10.23.NE/telnetd/ext.h irix-telnet.95.10.23.NE/telnetd/ext.h
*** telnet.95.10.23.NE/telnetd/ext.h Mon Oct 23 07:47:40 1995
--- irix-telnet.95.10.23.NE/telnetd/ext.h Wed Nov 1 14:03:31 1995
***************
*** 66,72 ****
extern slcfun slctab[NSLC + 1]; /* slc mapping table */
! char *terminaltype;
/*
* I/O data buffers, pointers, and counters.
--- 66,72 ----
extern slcfun slctab[NSLC + 1]; /* slc mapping table */
! extern char *terminaltype;
/*
* I/O data buffers, pointers, and counters.
diff -c -r telnet.95.10.23.NE/telnetd/sys_term.c irix-telnet.95.10.23.NE/telnetd/sys_term.c
*** telnet.95.10.23.NE/telnetd/sys_term.c Mon Oct 23 07:47:42 1995
--- irix-telnet.95.10.23.NE/telnetd/sys_term.c Wed Nov 1 18:05:24 1995
***************
*** 51,56 ****
--- 51,59 ----
int utmp_len = MAXHOSTNAMELEN; /* sizeof(init_request.host) */
#else /* NEWINIT*/
# ifdef UTMPX
+ # ifdef __sgi
+ # include <sac.h>
+ # endif
# include <utmpx.h>
struct utmpx wtmp;
# else
***************
*** 97,103 ****
--- 100,108 ----
#include <sys/resource.h>
#include <sys/proc.h>
#endif
+ #ifndef __sgi
#include <sys/tty.h>
+ #endif
#ifdef t_erase
#undef t_erase
#undef t_kill
***************
*** 459,474 ****
*
* Returns the file descriptor of the opened pty.
*/
! #ifndef __GNUC__
char *line = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
! #else
static char Xline[] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
char *line = Xline;
! #endif
! #ifdef CRAY
char *myline = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
! #endif /* CRAY */
!
int
getpty(ptynum)
int *ptynum;
--- 464,480 ----
*
* Returns the file descriptor of the opened pty.
*/
! # ifndef __sgi
! # ifndef __GNUC__
char *line = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
! # else
static char Xline[] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
char *line = Xline;
! # endif
! # ifdef CRAY
char *myline = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
! # endif /* CRAY */
! # endif /* __sgi */
int
getpty(ptynum)
int *ptynum;
***************
*** 1345,1351 ****
* 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();
--- 1351,1357 ----
* setsid() call above may have set our pgrp, so clear
* it out before opening the tty...
*/
! # if !defined(SOLARIS) && !defined(__sgi)
(void) setpgrp(0, 0);
# else
(void) setpgrp();
diff -c -r telnet.95.10.23.NE/telnetd/telnetd.c irix-telnet.95.10.23.NE/telnetd/telnetd.c
*** telnet.95.10.23.NE/telnetd/telnetd.c Mon Oct 23 07:47:42 1995
--- irix-telnet.95.10.23.NE/telnetd/telnetd.c Wed Nov 1 17:59:49 1995
***************
*** 771,779 ****
--- 771,791 ----
* Find an available pty to use.
*/
#ifndef convex
+ # ifndef __sgi
pty = getpty(&ptynum);
if (pty < 0)
fatal(net, "All network ports in use");
+ # else
+
+ /* IRIX 5.3 does most of this work for us. */
+ /* Dan Mosedale <dmose@netscape.com> */
+
+ extern char *line, *_getpty(int *, int, mode_t, int);
+
+ if ((line = _getpty(&pty,O_RDWR,0600,1)) == 0)
+ fatal(net, strerror(errno));
+
+ # endif
#else
for (;;) {
char *lp;