[487] in linux-security and linux-alert archive

home help back first fref pref prev next nref lref last post

telnetd.95.10.23.patch

daemon@ATHENA.MIT.EDU (Matt 'Panzer Boy')
Sat Nov 11 01:35:11 1995

To: linux-security@tarsier.cv.nrao.edu
From: panzer@dhp.com (Matt 'Panzer Boy')
Date: 11 Nov 1995 00:52:06 -0500

I patched the telnetd from cray to build properly on linux systems.  If
people are interested in the latest version of telnet, as opposed to the
one in the netkit.  This is the version that is mentioned as being fixed
in the CERT advisory.

You can get the original telnet/telnetd from:
  ftp://ftp.cray.com/src/telnet/telnet.95.10.23.NE.tar.Z

My patch is for the "telnet.95.10.23.tar.Z" package, but is the same for
the NE version also, just rename the directory to "telnet.95.10.23" and
run patch -p0 <telnet.patch on it.  Then "make linux" and you're all set.
(It is a merging of the old NetKit patches with the new code basically.)

You can also pick this patch from:
 ftp://ftp.dhp.com/pub/linux/security/telnet.95.10.23.patch

----------------------------Cut Here------------------------------------
diff -u --recursive telnet.95.10.23.orig/Config.generic telnet.95.10.23/Config.generic
--- telnet.95.10.23.orig/Config.generic Mon Oct 23 10:47:06 1995
+++ telnet.95.10.23/Config.generic      Fri Nov 10 01:46:31 1995
@@ -921,5 +921,20 @@
                LIB_SRC="getent.c setsid.c strftime.c \
                        tcsetattr.c tcgetattr.c"

+linux:
+       @make -f Makefile.generic ${WHAT} \
+               LIBS="../libtelnet/libtelnet.a -ltermcap" \
+               LIBPATH="/usr/lib/libc.a ../libtelnet/libtelnet.a /usr/lib/libtermcap.a" \
+               AR=ar ARFLAGS=cq RANLIB=ranlib \
+               LIBEXEC=${DESTDIR}/usr/sbin/in.telnetd \
+               CC="gcc" LCCFLAGS="-O2 -m486" \
+               DEFINES="-DLINUX \
+                       -DDEFAULT_IM='\"\r\n\"' \
+                       -DUSE_TERMIO -DTERMCAP -DDIAGNOSTICS \
+                       -DKLUDGELINEMODE -DOLD_ENVIRON" \
+               INCLUDES="-I.." \
+               LIB_OBJ="getent.o" \
+               LIB_SRC="getent.c"
+
 clean cleandir:
        make -f Makefile.generic $@
diff -u --recursive telnet.95.10.23.orig/libtelnet/Makefile.generic telnet.95.10.23/libtelnet/Makefile.generic
--- telnet.95.10.23.orig/libtelnet/Makefile.generic     Mon Oct 23 10:47:12 1995
+++ telnet.95.10.23/libtelnet/Makefile.generic  Fri Nov  3 16:02:08 1995
@@ -38,7 +38,8 @@

 ${LIB}: ${OBJS}
        rm -f ${LIB}
-       ${AR} ${ARFLAGS} ${LIB} `lorder ${OBJS} | tsort`
+#      ${AR} ${ARFLAGS} ${LIB} `lorder ${OBJS} | tsort`
+       ${AR} ${ARFLAGS} ${LIB} ${OBJS}
        @if [ ${RANLIB} != NONE ]; \
                then echo ${RANLIB} ${LIB}; ${RANLIB} ${LIB}; fi

diff -u --recursive telnet.95.10.23.orig/telnet/externs.h telnet.95.10.23/telnet/externs.h
--- telnet.95.10.23.orig/telnet/externs.h       Mon Oct 23 10:47:13 1995
+++ telnet.95.10.23/telnet/externs.h    Mon Nov  6 02:31:55 1995
@@ -72,6 +72,9 @@
 #   define termio termios
 #  endif
 # endif
+# ifdef LINUX
+# define termio termios
+# endif
 #endif
 #if defined(NO_CC_T) || !defined(USE_TERMIO)
 # if !defined(USE_TERMIO)
diff -u --recursive telnet.95.10.23.orig/telnetd/ext.h telnet.95.10.23/telnetd/ext.h
--- telnet.95.10.23.orig/telnetd/ext.h  Mon Oct 23 10:47:16 1995
+++ telnet.95.10.23/telnetd/ext.h       Fri Nov  3 16:02:47 1995
@@ -233,7 +233,11 @@
 #   ifdef ultrix
 #    define DEFAULT_IM "\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
 #   else
+#    ifdef LINUX
+#     define DEFAULT_IM    "\r\n\r\n%s %r (%h) (%t)\r\n\r\r\n\r"
+#    else
 #    define DEFAULT_IM "\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
+#    endif
 #   endif
 #  endif
 # endif
diff -u --recursive telnet.95.10.23.orig/telnetd/sys_term.c telnet.95.10.23/telnetd/sys_term.c
--- telnet.95.10.23.orig/telnetd/sys_term.c     Mon Oct 23 10:47:17 1995
+++ telnet.95.10.23/telnetd/sys_term.c  Fri Nov  3 15:57:01 1995
@@ -97,7 +97,9 @@
 #include <sys/resource.h>
 #include <sys/proc.h>
 #endif
+#ifndef LINUX
 #include <sys/tty.h>
+#endif
 #ifdef t_erase
 #undef t_erase
 #undef t_kill
diff -u --recursive telnet.95.10.23.orig/telnetd/utility.c telnet.95.10.23/telnetd/utility.c
--- telnet.95.10.23.orig/telnetd/utility.c      Mon Oct 23 10:47:18 1995
+++ telnet.95.10.23/telnetd/utility.c   Fri Nov  3 15:57:02 1995
@@ -37,6 +37,9 @@

 #define PRINTOPTIONS
 #include "telnetd.h"
+#ifdef LINUX
+#  include <sys/utsname.h>
+#endif

 /*
  * utility functions performing io related tasks
@@ -445,6 +448,9 @@
        register char *cp;
        char *where;
 {
+#ifdef LINUX
+        struct utsname utsname;
+#endif
        char *slash;
        time_t t;
        char db[100];
@@ -485,6 +491,22 @@
                        (void)strftime(db, sizeof(db), fmtstr, localtime(&t));
                        putstr(db);
                        break;
+#ifdef LINUX
+                     case 's':
+                        (void) uname(&utsname);
+                        putstr(utsname.sysname);
+                        break;
+
+                     case 'r':
+                        (void) uname(&utsname);
+                        putstr(utsname.release);
+                        break;
+
+                     case 'v':
+                        (void) uname(&utsname);
+                        putstr(utsname.version);
+                        break;
+#endif

                case '%':
                        putchr('%');
----------------------------Cut Here------------------------------------




-- 
 -Matt     (panzer@dhp.com)                         DI-1-9026
 "That which can never be enforced should not be prohibited."

home help back first fref pref prev next nref lref last post