From c19800e8cd5640693f36f2040db4ab5e8d738146 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Wed, 7 May 2008 13:39:42 +0000 Subject: Vendor import of Heimdal 1.1 --- crypto/heimdal/appl/telnet/telnetd/Makefile.am | 8 +- crypto/heimdal/appl/telnet/telnetd/Makefile.in | 317 +++++++++++++----------- crypto/heimdal/appl/telnet/telnetd/authenc.c | 2 +- crypto/heimdal/appl/telnet/telnetd/ext.h | 8 +- crypto/heimdal/appl/telnet/telnetd/global.c | 4 +- crypto/heimdal/appl/telnet/telnetd/slc.c | 2 +- crypto/heimdal/appl/telnet/telnetd/state.c | 21 +- crypto/heimdal/appl/telnet/telnetd/sys_term.c | 328 ++++++++++++------------- crypto/heimdal/appl/telnet/telnetd/telnetd.8 | 8 +- crypto/heimdal/appl/telnet/telnetd/telnetd.c | 102 +++++--- crypto/heimdal/appl/telnet/telnetd/telnetd.h | 28 +++ crypto/heimdal/appl/telnet/telnetd/termstat.c | 2 +- crypto/heimdal/appl/telnet/telnetd/utility.c | 17 +- 13 files changed, 460 insertions(+), 387 deletions(-) (limited to 'crypto/heimdal/appl/telnet/telnetd') diff --git a/crypto/heimdal/appl/telnet/telnetd/Makefile.am b/crypto/heimdal/appl/telnet/telnetd/Makefile.am index 19e10bc8b942..df2b864dc17e 100644 --- a/crypto/heimdal/appl/telnet/telnetd/Makefile.am +++ b/crypto/heimdal/appl/telnet/telnetd/Makefile.am @@ -1,8 +1,8 @@ -# $Id: Makefile.am,v 1.18 2001/08/28 11:21:17 joda Exp $ +# $Id: Makefile.am 20466 2007-04-20 08:29:05Z lha $ include $(top_srcdir)/Makefile.am.common -INCLUDES += -I$(srcdir)/.. $(INCLUDE_krb4) $(INCLUDE_des) +AM_CPPFLAGS += -I$(srcdir)/.. $(INCLUDE_krb4) $(INCLUDE_hcrypto) libexec_PROGRAMS = telnetd @@ -17,10 +17,12 @@ LDADD = \ ../libtelnet/libtelnet.a \ $(LIB_krb5) \ $(LIB_krb4) \ - $(LIB_des) \ + $(LIB_hcrypto) \ $(LIB_tgetent) \ $(LIB_logwtmp) \ $(LIB_logout) \ $(LIB_openpty) \ $(LIB_kdfs) \ $(LIB_roken) + +EXTRA_DIST = $(man_MANS) diff --git a/crypto/heimdal/appl/telnet/telnetd/Makefile.in b/crypto/heimdal/appl/telnet/telnetd/Makefile.in index 1a14fc4f3ec8..ba4cd3594b4f 100644 --- a/crypto/heimdal/appl/telnet/telnetd/Makefile.in +++ b/crypto/heimdal/appl/telnet/telnetd/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,23 +14,17 @@ @SET_MAKE@ -# $Id: Makefile.am,v 1.18 2001/08/28 11:21:17 joda Exp $ +# $Id: Makefile.am 20466 2007-04-20 08:29:05Z lha $ -# $Id: Makefile.am.common,v 1.5 2002/05/19 18:35:37 joda Exp $ +# $Id: Makefile.am.common 10998 2002-05-19 18:35:37Z joda $ -# $Id: Makefile.am.common,v 1.37.2.2 2003/10/13 13:15:39 joda Exp $ +# $Id: Makefile.am.common 22488 2008-01-21 11:47:22Z lha $ -SOURCES = $(telnetd_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -42,6 +36,7 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.am.common \ @@ -50,16 +45,14 @@ libexec_PROGRAMS = telnetd$(EXEEXT) subdir = appl/telnet/telnetd ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/cf/aix.m4 \ - $(top_srcdir)/cf/auth-modules.m4 \ + $(top_srcdir)/cf/auth-modules.m4 $(top_srcdir)/cf/autobuild.m4 \ $(top_srcdir)/cf/broken-getaddrinfo.m4 \ - $(top_srcdir)/cf/broken-getnameinfo.m4 \ $(top_srcdir)/cf/broken-glob.m4 \ $(top_srcdir)/cf/broken-realloc.m4 \ $(top_srcdir)/cf/broken-snprintf.m4 $(top_srcdir)/cf/broken.m4 \ $(top_srcdir)/cf/broken2.m4 $(top_srcdir)/cf/c-attribute.m4 \ $(top_srcdir)/cf/capabilities.m4 \ $(top_srcdir)/cf/check-compile-et.m4 \ - $(top_srcdir)/cf/check-declaration.m4 \ $(top_srcdir)/cf/check-getpwnam_r-posix.m4 \ $(top_srcdir)/cf/check-man.m4 \ $(top_srcdir)/cf/check-netinet-ip-and-tcp.m4 \ @@ -72,6 +65,7 @@ am__aclocal_m4_deps = $(top_srcdir)/cf/aix.m4 \ $(top_srcdir)/cf/find-func-no-libs2.m4 \ $(top_srcdir)/cf/find-func.m4 \ $(top_srcdir)/cf/find-if-not-broken.m4 \ + $(top_srcdir)/cf/framework-security.m4 \ $(top_srcdir)/cf/have-struct-field.m4 \ $(top_srcdir)/cf/have-type.m4 $(top_srcdir)/cf/irix.m4 \ $(top_srcdir)/cf/krb-bigendian.m4 \ @@ -80,16 +74,20 @@ am__aclocal_m4_deps = $(top_srcdir)/cf/aix.m4 \ $(top_srcdir)/cf/krb-readline.m4 \ $(top_srcdir)/cf/krb-struct-spwd.m4 \ $(top_srcdir)/cf/krb-struct-winsize.m4 \ - $(top_srcdir)/cf/mips-abi.m4 $(top_srcdir)/cf/misc.m4 \ - $(top_srcdir)/cf/need-proto.m4 $(top_srcdir)/cf/osfc2.m4 \ - $(top_srcdir)/cf/otp.m4 $(top_srcdir)/cf/proto-compat.m4 \ - $(top_srcdir)/cf/retsigtype.m4 $(top_srcdir)/cf/roken-frag.m4 \ - $(top_srcdir)/cf/sunos.m4 $(top_srcdir)/cf/telnet.m4 \ - $(top_srcdir)/cf/test-package.m4 $(top_srcdir)/cf/wflags.m4 \ - $(top_srcdir)/cf/with-all.m4 $(top_srcdir)/configure.in + $(top_srcdir)/cf/largefile.m4 $(top_srcdir)/cf/mips-abi.m4 \ + $(top_srcdir)/cf/misc.m4 $(top_srcdir)/cf/need-proto.m4 \ + $(top_srcdir)/cf/osfc2.m4 $(top_srcdir)/cf/otp.m4 \ + $(top_srcdir)/cf/proto-compat.m4 $(top_srcdir)/cf/pthreads.m4 \ + $(top_srcdir)/cf/resolv.m4 $(top_srcdir)/cf/retsigtype.m4 \ + $(top_srcdir)/cf/roken-frag.m4 \ + $(top_srcdir)/cf/socket-wrapper.m4 $(top_srcdir)/cf/sunos.m4 \ + $(top_srcdir)/cf/telnet.m4 $(top_srcdir)/cf/test-package.m4 \ + $(top_srcdir)/cf/version-script.m4 $(top_srcdir)/cf/wflags.m4 \ + $(top_srcdir)/cf/win32.m4 $(top_srcdir)/cf/with-all.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(man8dir)" @@ -100,26 +98,24 @@ am_telnetd_OBJECTS = telnetd.$(OBJEXT) state.$(OBJEXT) \ utility.$(OBJEXT) global.$(OBJEXT) authenc.$(OBJEXT) telnetd_OBJECTS = $(am_telnetd_OBJECTS) telnetd_LDADD = $(LDADD) -@KRB5_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/lib/krb5/libkrb5.la \ -@KRB5_TRUE@ $(top_builddir)/lib/asn1/libasn1.la -am__DEPENDENCIES_2 = -@DCE_TRUE@am__DEPENDENCIES_3 = $(top_builddir)/lib/kdfs/libkdfs.la -telnetd_DEPENDENCIES = ../libtelnet/libtelnet.a $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include +am__DEPENDENCIES_1 = +telnetd_DEPENDENCIES = ../libtelnet/libtelnet.a $(LIB_krb5) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(LIB_kdfs) \ + $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(top_builddir)/include@am__isrc@ depcomp = am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ SOURCES = $(telnetd_SOURCES) DIST_SOURCES = $(telnetd_SOURCES) man8dir = $(mandir)/man8 @@ -128,13 +124,7 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AIX4_FALSE = @AIX4_FALSE@ -AIX4_TRUE = @AIX4_TRUE@ -AIX_DYNAMIC_AFS_FALSE = @AIX_DYNAMIC_AFS_FALSE@ -AIX_DYNAMIC_AFS_TRUE = @AIX_DYNAMIC_AFS_TRUE@ AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@ -AIX_FALSE = @AIX_FALSE@ -AIX_TRUE = @AIX_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -144,8 +134,6 @@ AWK = @AWK@ CANONICAL_HOST = @CANONICAL_HOST@ CATMAN = @CATMAN@ CATMANEXT = @CATMANEXT@ -CATMAN_FALSE = @CATMAN_FALSE@ -CATMAN_TRUE = @CATMAN_TRUE@ CC = @CC@ CFLAGS = @CFLAGS@ COMPILE_ET = @COMPILE_ET@ @@ -156,11 +144,10 @@ CXXCPP = @CXXCPP@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBLIB = @DBLIB@ -DCE_FALSE = @DCE_FALSE@ -DCE_TRUE = @DCE_TRUE@ DEFS = @DEFS@ DIR_com_err = @DIR_com_err@ -DIR_des = @DIR_des@ +DIR_hcrypto = @DIR_hcrypto@ +DIR_hdbdir = @DIR_hdbdir@ DIR_roken = @DIR_roken@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ @@ -168,42 +155,27 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -EXTRA_LIB45 = @EXTRA_LIB45@ F77 = @F77@ FFLAGS = @FFLAGS@ +GREP = @GREP@ GROFF = @GROFF@ -HAVE_DB1_FALSE = @HAVE_DB1_FALSE@ -HAVE_DB1_TRUE = @HAVE_DB1_TRUE@ -HAVE_DB3_FALSE = @HAVE_DB3_FALSE@ -HAVE_DB3_TRUE = @HAVE_DB3_TRUE@ -HAVE_DLOPEN_FALSE = @HAVE_DLOPEN_FALSE@ -HAVE_DLOPEN_TRUE = @HAVE_DLOPEN_TRUE@ -HAVE_NDBM_FALSE = @HAVE_NDBM_FALSE@ -HAVE_NDBM_TRUE = @HAVE_NDBM_TRUE@ -HAVE_OPENSSL_FALSE = @HAVE_OPENSSL_FALSE@ -HAVE_OPENSSL_TRUE = @HAVE_OPENSSL_TRUE@ -HAVE_X_FALSE = @HAVE_X_FALSE@ -HAVE_X_TRUE = @HAVE_X_TRUE@ INCLUDES_roken = @INCLUDES_roken@ -INCLUDE_des = @INCLUDE_des@ +INCLUDE_hcrypto = @INCLUDE_hcrypto@ INCLUDE_hesiod = @INCLUDE_hesiod@ INCLUDE_krb4 = @INCLUDE_krb4@ INCLUDE_openldap = @INCLUDE_openldap@ INCLUDE_readline = @INCLUDE_readline@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -IRIX_FALSE = @IRIX_FALSE@ -IRIX_TRUE = @IRIX_TRUE@ -KRB4_FALSE = @KRB4_FALSE@ -KRB4_TRUE = @KRB4_TRUE@ -KRB5_FALSE = @KRB5_FALSE@ -KRB5_TRUE = @KRB5_TRUE@ LDFLAGS = @LDFLAGS@ +LDFLAGS_VERSION_SCRIPT = @LDFLAGS_VERSION_SCRIPT@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBADD_roken = @LIBADD_roken@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -221,12 +193,9 @@ LIB_crypt = @LIB_crypt@ LIB_db_create = @LIB_db_create@ LIB_dbm_firstkey = @LIB_dbm_firstkey@ LIB_dbopen = @LIB_dbopen@ -LIB_des = @LIB_des@ -LIB_des_a = @LIB_des_a@ -LIB_des_appl = @LIB_des_appl@ -LIB_des_so = @LIB_des_so@ LIB_dlopen = @LIB_dlopen@ LIB_dn_expand = @LIB_dn_expand@ +LIB_door_create = @LIB_door_create@ LIB_el_init = @LIB_el_init@ LIB_freeaddrinfo = @LIB_freeaddrinfo@ LIB_gai_strerror = @LIB_gai_strerror@ @@ -236,15 +205,14 @@ LIB_gethostbyname2 = @LIB_gethostbyname2@ LIB_getnameinfo = @LIB_getnameinfo@ LIB_getpwnam_r = @LIB_getpwnam_r@ LIB_getsockopt = @LIB_getsockopt@ +LIB_hcrypto = @LIB_hcrypto@ +LIB_hcrypto_a = @LIB_hcrypto_a@ +LIB_hcrypto_appl = @LIB_hcrypto_appl@ +LIB_hcrypto_so = @LIB_hcrypto_so@ LIB_hesiod = @LIB_hesiod@ LIB_hstrerror = @LIB_hstrerror@ LIB_kdb = @LIB_kdb@ LIB_krb4 = @LIB_krb4@ -LIB_krb_disable_debug = @LIB_krb_disable_debug@ -LIB_krb_enable_debug = @LIB_krb_enable_debug@ -LIB_krb_get_kdc_time_diff = @LIB_krb_get_kdc_time_diff@ -LIB_krb_get_our_ip_for_realm = @LIB_krb_get_our_ip_for_realm@ -LIB_krb_kdctimeofday = @LIB_krb_kdctimeofday@ LIB_loadquery = @LIB_loadquery@ LIB_logout = @LIB_logout@ LIB_logwtmp = @LIB_logwtmp@ @@ -253,6 +221,7 @@ LIB_openpty = @LIB_openpty@ LIB_otp = @LIB_otp@ LIB_pidfile = @LIB_pidfile@ LIB_readline = @LIB_readline@ +LIB_res_ndestroy = @LIB_res_ndestroy@ LIB_res_nsearch = @LIB_res_nsearch@ LIB_res_search = @LIB_res_search@ LIB_roken = @LIB_roken@ @@ -264,15 +233,10 @@ LIB_tgetent = @LIB_tgetent@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ -NEED_WRITEAUTH_FALSE = @NEED_WRITEAUTH_FALSE@ -NEED_WRITEAUTH_TRUE = @NEED_WRITEAUTH_TRUE@ +MKDIR_P = @MKDIR_P@ NROFF = @NROFF@ OBJEXT = @OBJEXT@ -OTP_FALSE = @OTP_FALSE@ -OTP_TRUE = @OTP_TRUE@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -280,74 +244,80 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTHREADS_CFLAGS = @PTHREADS_CFLAGS@ +PTHREADS_LIBS = @PTHREADS_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +VERSIONING = @VERSIONING@ VOID_RETSIGTYPE = @VOID_RETSIGTYPE@ WFLAGS = @WFLAGS@ WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@ WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@ +XMKMF = @XMKMF@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ YACC = @YACC@ -ac_ct_AR = @ac_ct_AR@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ -do_roken_rename_FALSE = @do_roken_rename_FALSE@ -do_roken_rename_TRUE = @do_roken_rename_TRUE@ +datarootdir = @datarootdir@ +docdir = @docdir@ dpagaix_cflags = @dpagaix_cflags@ dpagaix_ldadd = @dpagaix_ldadd@ dpagaix_ldflags = @dpagaix_ldflags@ -el_compat_FALSE = @el_compat_FALSE@ -el_compat_TRUE = @el_compat_TRUE@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ -have_err_h_FALSE = @have_err_h_FALSE@ -have_err_h_TRUE = @have_err_h_TRUE@ -have_fnmatch_h_FALSE = @have_fnmatch_h_FALSE@ -have_fnmatch_h_TRUE = @have_fnmatch_h_TRUE@ -have_glob_h_FALSE = @have_glob_h_FALSE@ -have_glob_h_TRUE = @have_glob_h_TRUE@ -have_ifaddrs_h_FALSE = @have_ifaddrs_h_FALSE@ -have_ifaddrs_h_TRUE = @have_ifaddrs_h_TRUE@ -have_vis_h_FALSE = @have_vis_h_FALSE@ -have_vis_h_TRUE = @have_vis_h_TRUE@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -SUFFIXES = .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 -INCLUDES = -I$(top_builddir)/include $(INCLUDES_roken) -I$(srcdir)/.. $(INCLUDE_krb4) $(INCLUDE_des) +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUFFIXES = .et .h .x .z .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 +AM_CPPFLAGS = -I$(top_builddir)/include $(INCLUDES_roken) \ + -I$(srcdir)/.. $(INCLUDE_krb4) $(INCLUDE_hcrypto) @do_roken_rename_TRUE@ROKEN_RENAME = -DROKEN_RENAME AM_CFLAGS = $(WFLAGS) CP = cp @@ -364,6 +334,7 @@ LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS) @KRB5_TRUE@ $(top_builddir)/lib/asn1/libasn1.la @KRB5_TRUE@LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la +@KRB5_TRUE@LIB_tsasl = $(top_builddir)/lib/tsasl/libtsasl.la @DCE_TRUE@LIB_kdfs = $(top_builddir)/lib/kdfs/libkdfs.la CHECK_LOCAL = telnetd_SOURCES = telnetd.c state.c termstat.c slc.c sys_term.c \ @@ -374,7 +345,7 @@ LDADD = \ ../libtelnet/libtelnet.a \ $(LIB_krb5) \ $(LIB_krb4) \ - $(LIB_des) \ + $(LIB_hcrypto) \ $(LIB_tgetent) \ $(LIB_logwtmp) \ $(LIB_logout) \ @@ -382,10 +353,11 @@ LDADD = \ $(LIB_kdfs) \ $(LIB_roken) +EXTRA_DIST = $(man_MANS) all: all-am .SUFFIXES: -.SUFFIXES: .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .c .lo .o .obj +.SUFFIXES: .et .h .x .z .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -417,7 +389,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libexecPROGRAMS: $(libexec_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(libexecdir)" || $(mkdir_p) "$(DESTDIR)$(libexecdir)" + test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)" @list='$(libexec_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -445,7 +417,7 @@ clean-libexecPROGRAMS: done telnetd$(EXEEXT): $(telnetd_OBJECTS) $(telnetd_DEPENDENCIES) @rm -f telnetd$(EXEEXT) - $(LINK) $(telnetd_LDFLAGS) $(telnetd_OBJECTS) $(telnetd_LDADD) $(LIBS) + $(LINK) $(telnetd_OBJECTS) $(telnetd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -467,13 +439,9 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: install-man8: $(man8_MANS) $(man_MANS) @$(NORMAL_INSTALL) - test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)" + test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ @@ -537,9 +505,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -564,23 +534,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/../../.. $(distdir)/../../../cf - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -600,7 +568,7 @@ check: check-am all-am: Makefile $(PROGRAMS) $(MANS) all-local installdirs: for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(man8dir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -621,7 +589,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -634,7 +602,7 @@ clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am @@ -650,14 +618,22 @@ install-data-am: install-man @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook +install-dvi: install-dvi-am + install-exec-am: install-libexecPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook +install-html: install-html-am + install-info: install-info-am install-man: install-man8 +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -677,24 +653,30 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am uninstall-libexecPROGRAMS \ - uninstall-man +uninstall-am: uninstall-libexecPROGRAMS uninstall-man + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-man: uninstall-man8 +.MAKE: install-am install-data-am install-exec-am install-strip \ + uninstall-am + .PHONY: CTAGS GTAGS all all-am all-local check check-am check-local \ clean clean-generic clean-libexecPROGRAMS clean-libtool ctags \ - distclean distclean-compile distclean-generic \ + dist-hook distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-libexecPROGRAMS install-man \ - install-man8 install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am uninstall-libexecPROGRAMS \ - uninstall-man uninstall-man8 + install-data-am install-data-hook install-dvi install-dvi-am \ + install-exec install-exec-am install-exec-hook install-html \ + install-html-am install-info install-info-am \ + install-libexecPROGRAMS install-man install-man8 install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-hook \ + uninstall-libexecPROGRAMS uninstall-man uninstall-man8 install-suid-programs: @@ -709,8 +691,8 @@ install-suid-programs: install-exec-hook: install-suid-programs -install-build-headers:: $(include_HEADERS) $(build_HEADERZ) - @foo='$(include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ)'; \ +install-build-headers:: $(include_HEADERS) $(dist_include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ) $(nobase_include_HEADERS) + @foo='$(include_HEADERS) $(dist_include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ)'; \ for f in $$foo; do \ f=`basename $$f`; \ if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \ @@ -720,19 +702,31 @@ install-build-headers:: $(include_HEADERS) $(build_HEADERZ) echo " $(CP) $$file $(buildinclude)/$$f"; \ $(CP) $$file $(buildinclude)/$$f; \ fi ; \ + done ; \ + foo='$(nobase_include_HEADERS)'; \ + for f in $$foo; do \ + if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \ + else file="$$f"; fi; \ + $(mkdir_p) $(buildinclude)/`dirname $$f` ; \ + if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \ + : ; else \ + echo " $(CP) $$file $(buildinclude)/$$f"; \ + $(CP) $$file $(buildinclude)/$$f; \ + fi ; \ done all-local: install-build-headers check-local:: - @if test '$(CHECK_LOCAL)'; then \ + @if test '$(CHECK_LOCAL)' = "no-check-local"; then \ + foo=''; elif test '$(CHECK_LOCAL)'; then \ foo='$(CHECK_LOCAL)'; else \ foo='$(PROGRAMS)'; fi; \ if test "$$foo"; then \ failed=0; all=0; \ for i in $$foo; do \ all=`expr $$all + 1`; \ - if ./$$i --version > /dev/null 2>&1; then \ + if (./$$i --version && ./$$i --help) > /dev/null 2>&1; then \ echo "PASS: $$i"; \ else \ echo "FAIL: $$i"; \ @@ -748,7 +742,7 @@ check-local:: echo "$$dashes"; \ echo "$$banner"; \ echo "$$dashes"; \ - test "$$failed" -eq 0; \ + test "$$failed" -eq 0 || exit 1; \ fi .x.c: @@ -818,14 +812,39 @@ dist-cat8-mans: dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans install-cat-mans: - $(SHELL) $(top_srcdir)/cf/install-catman.sh "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS) + $(SHELL) $(top_srcdir)/cf/install-catman.sh install "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS) + +uninstall-cat-mans: + $(SHELL) $(top_srcdir)/cf/install-catman.sh uninstall "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS) install-data-hook: install-cat-mans +uninstall-hook: uninstall-cat-mans .et.h: $(COMPILE_ET) $< .et.c: $(COMPILE_ET) $< + +# +# Useful target for debugging +# + +check-valgrind: + tobjdir=`cd $(top_builddir) && pwd` ; \ + tsrcdir=`cd $(top_srcdir) && pwd` ; \ + env TESTS_ENVIRONMENT="$${tobjdir}/libtool --mode execute valgrind --leak-check=full --trace-children=yes --quiet -q --num-callers=30 --suppressions=$${tsrcdir}/cf/valgrind-suppressions" make check + +# +# Target to please samba build farm, builds distfiles in-tree. +# Will break when automake changes... +# + +distdir-in-tree: $(DISTFILES) $(INFO_DEPS) + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" != .; then \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) distdir-in-tree) ; \ + fi ; \ + done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/crypto/heimdal/appl/telnet/telnetd/authenc.c b/crypto/heimdal/appl/telnet/telnetd/authenc.c index 14594ea22cb5..1fac6c0917ae 100644 --- a/crypto/heimdal/appl/telnet/telnetd/authenc.c +++ b/crypto/heimdal/appl/telnet/telnetd/authenc.c @@ -33,7 +33,7 @@ #include "telnetd.h" -RCSID("$Id: authenc.c,v 1.10 2000/11/15 23:20:43 assar Exp $"); +RCSID("$Id: authenc.c 9200 2000-11-15 23:20:43Z assar $"); #ifdef AUTHENTICATION diff --git a/crypto/heimdal/appl/telnet/telnetd/ext.h b/crypto/heimdal/appl/telnet/telnetd/ext.h index 8f9993415e78..68b97bfea3e9 100644 --- a/crypto/heimdal/appl/telnet/telnetd/ext.h +++ b/crypto/heimdal/appl/telnet/telnetd/ext.h @@ -33,7 +33,7 @@ * @(#)ext.h 8.2 (Berkeley) 12/15/93 */ -/* $Id: ext.h,v 1.23 2001/08/29 00:45:22 assar Exp $ */ +/* $Id: ext.h 15841 2005-08-08 13:34:26Z lha $ */ #ifndef __EXT_H__ #define __EXT_H__ @@ -57,7 +57,7 @@ extern const char *new_login; extern slcfun slctab[NSLC + 1]; /* slc mapping table */ -extern char *terminaltype; +extern char terminaltype[41]; /* * I/O data buffers, pointers, and counters. @@ -115,7 +115,7 @@ int tty_iscrnl (void); void tty_tspeed (int val); void tty_rspeed (int val); void getptyslave (void); -int cleanopen (char *line); +int cleanopen (char *); void startslave (const char *host, const char *, int autologin, char *autoname); void init_env (void); void start_login (const char *host, int autologin, char *name); @@ -138,7 +138,7 @@ void ptyflush (void); char *nextitem (char *current); void netclear (void); void netflush (void); -void writenet (unsigned char *ptr, int len); +void writenet (const void *, size_t); void fatal (int f, char *msg); void fatalperror (int f, const char *msg); void fatalperror_errno (int f, const char *msg, int error); diff --git a/crypto/heimdal/appl/telnet/telnetd/global.c b/crypto/heimdal/appl/telnet/telnetd/global.c index 54d1a777abb2..8b3c40580e3d 100644 --- a/crypto/heimdal/appl/telnet/telnetd/global.c +++ b/crypto/heimdal/appl/telnet/telnetd/global.c @@ -36,7 +36,7 @@ #include "telnetd.h" -RCSID("$Id: global.c,v 1.13 2001/07/19 16:00:42 assar Exp $"); +RCSID("$Id: global.c 14939 2005-04-24 20:59:35Z lha $"); /* * Telnet server variable declarations @@ -54,7 +54,7 @@ int require_otp; slcfun slctab[NSLC + 1]; /* slc mapping table */ -char *terminaltype; +char terminaltype[41]; /* * I/O data buffers, pointers, and counters. diff --git a/crypto/heimdal/appl/telnet/telnetd/slc.c b/crypto/heimdal/appl/telnet/telnetd/slc.c index 799d2d807c20..b9ab1212c07f 100644 --- a/crypto/heimdal/appl/telnet/telnetd/slc.c +++ b/crypto/heimdal/appl/telnet/telnetd/slc.c @@ -33,7 +33,7 @@ #include "telnetd.h" -RCSID("$Id: slc.c,v 1.10 1997/05/11 06:30:00 assar Exp $"); +RCSID("$Id: slc.c 1695 1997-05-11 06:30:05Z assar $"); /* * get_slc_defaults diff --git a/crypto/heimdal/appl/telnet/telnetd/state.c b/crypto/heimdal/appl/telnet/telnetd/state.c index 3bc7f63253a9..32c3d0e02c39 100644 --- a/crypto/heimdal/appl/telnet/telnetd/state.c +++ b/crypto/heimdal/appl/telnet/telnetd/state.c @@ -33,7 +33,7 @@ #include "telnetd.h" -RCSID("$Id: state.c,v 1.14.12.1 2004/06/21 08:21:58 lha Exp $"); +RCSID("$Id: state.c 18110 2006-09-19 08:25:20Z lha $"); unsigned char doopt[] = { IAC, DO, '%', 'c', 0 }; unsigned char dont[] = { IAC, DONT, '%', 'c', 0 }; @@ -427,14 +427,14 @@ send_do(int option, int init) extern void auth_request(void); #endif #ifdef ENCRYPTION -extern void encrypt_send_support(); +extern void encrypt_send_support(void); #endif void willoption(int option) { int changeok = 0; - void (*func)() = 0; + void (*func)(void) = NULL; /* * process input from peer. @@ -939,7 +939,7 @@ suboption(void) } /* end of case TELOPT_TSPEED */ case TELOPT_TTYPE: { /* Yaaaay! */ - static char terminalname[41]; + char *p; if (his_state_is_wont(TELOPT_TTYPE)) /* Ignore if option disabled */ break; @@ -949,9 +949,9 @@ suboption(void) return; /* ??? XXX but, this is the most robust */ } - terminaltype = terminalname; + p = terminaltype; - while ((terminaltype < (terminalname + sizeof terminalname-1)) && + while ((p < (terminaltype + sizeof terminaltype-1)) && !SB_EOF()) { int c; @@ -959,10 +959,9 @@ suboption(void) if (isupper(c)) { c = tolower(c); } - *terminaltype++ = c; /* accumulate name */ + *p++ = c; /* accumulate name */ } - *terminaltype = 0; - terminaltype = terminalname; + *p = 0; break; } /* end of case TELOPT_TTYPE */ @@ -1246,6 +1245,8 @@ suboption(void) encrypt_start(subpointer, SB_LEN()); break; case ENCRYPT_END: + if (require_encryption) + fatal(net, "Output encryption is not possible to turn off"); encrypt_end(); break; case ENCRYPT_REQSTART: @@ -1258,6 +1259,8 @@ suboption(void) * if we have been able to get in the correct mode * anyhow. */ + if (require_encryption) + fatal(net, "Input encryption is not possible to turn off"); encrypt_request_end(); break; case ENCRYPT_ENC_KEYID: diff --git a/crypto/heimdal/appl/telnet/telnetd/sys_term.c b/crypto/heimdal/appl/telnet/telnetd/sys_term.c index 23b24682ea75..852611f8eefa 100644 --- a/crypto/heimdal/appl/telnet/telnetd/sys_term.c +++ b/crypto/heimdal/appl/telnet/telnetd/sys_term.c @@ -33,7 +33,7 @@ #include "telnetd.h" -RCSID("$Id: sys_term.c,v 1.104 2001/09/17 02:09:04 assar Exp $"); +RCSID("$Id: sys_term.c 22390 2007-12-31 10:12:48Z lha $"); #if defined(_CRAY) || (defined(__hpux) && !defined(HAVE_UTMPX_H)) # define PARENT_DOES_UTMP @@ -90,29 +90,6 @@ char wtmpf[] = "/etc/wtmp"; #include #endif /* CRAY */ -#ifdef STREAMSPTY - -#ifdef HAVE_SAC_H -#include -#endif - -#ifdef HAVE_SYS_STROPTS_H -#include -#endif - -#endif /* STREAMSPTY */ - -#undef NOERROR - -#ifdef HAVE_SYS_STREAM_H -#ifdef HAVE_SYS_UIO_H -#include -#endif -#ifdef __hpux -#undef SE -#endif -#include -#endif #if !(defined(__sgi) || defined(__linux) || defined(_AIX)) && defined(HAVE_SYS_TTY) #include #endif @@ -215,13 +192,14 @@ set_termbuf(void) /* * Only make the necessary changes. */ - if (memcmp(&termbuf, &termbuf2, sizeof(termbuf))) + if (memcmp(&termbuf, &termbuf2, sizeof(termbuf))) { # ifdef STREAMSPTY if (really_stream) tcsetattr(ttyfd, TCSANOW, &termbuf); else # endif tcsetattr(ourpty, TCSANOW, &termbuf); + } } @@ -358,6 +336,8 @@ getnpty() * Returns the file descriptor of the opened pty. */ +static int ptyslavefd = -1; + static char Xline[] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; char *line = Xline; @@ -378,150 +358,151 @@ static char *ptsname(int fd) int getpty(int *ptynum) { -#ifdef __osf__ /* XXX */ - int master; - int slave; - if(openpty(&master, &slave, line, 0, 0) == 0){ - close(slave); - return master; +#if defined(HAVE_OPENPTY) || defined(__linux) || defined(__osf__) /* XXX */ + { + int master; + int slave; + if(openpty(&master, &slave, line, 0, 0) == 0){ + ptyslavefd = slave; + return master; + } } - return -1; -#else +#endif /* HAVE_OPENPTY .... */ #ifdef HAVE__GETPTY - int master, slave; - char *p; - p = _getpty(&master, O_RDWR, 0600, 1); - if(p == NULL) - return -1; - strlcpy(line, p, sizeof(Xline)); - return master; -#else - - int p; - char *cp, *p1, *p2; - int i; -#if SunOS == 40 - int dummy; -#endif -#if __linux - int master; - int slave; - if(openpty(&master, &slave, line, 0, 0) == 0){ - close(slave); + { + int master; + char *p; + p = _getpty(&master, O_RDWR, 0600, 1); + if(p == NULL) + return -1; + strlcpy(line, p, sizeof(Xline)); return master; } -#else +#endif + #ifdef STREAMSPTY - char *clone[] = { "/dev/ptc", "/dev/ptmx", "/dev/ptm", - "/dev/ptym/clone", 0 }; - - char **q; - for(q=clone; *q; q++){ - p=open(*q, O_RDWR); - if(p >= 0){ + { + char *clone[] = { "/dev/ptc", "/dev/ptmx", "/dev/ptm", + "/dev/ptym/clone", 0 }; + + char **q; + int p; + for(q=clone; *q; q++){ + p=open(*q, O_RDWR); + if(p >= 0){ #ifdef HAVE_GRANTPT - grantpt(p); + grantpt(p); #endif #ifdef HAVE_UNLOCKPT - unlockpt(p); + unlockpt(p); #endif - strlcpy(line, ptsname(p), sizeof(Xline)); - really_stream = 1; - return p; + strlcpy(line, ptsname(p), sizeof(Xline)); + really_stream = 1; + return p; + } } } #endif /* STREAMSPTY */ #ifndef _CRAY - + { + int p; + char *cp, *p1, *p2; + int i; + #ifndef __hpux - snprintf(line, sizeof(Xline), "/dev/ptyXX"); - p1 = &line[8]; - p2 = &line[9]; + snprintf(line, sizeof(Xline), "/dev/ptyXX"); + p1 = &line[8]; + p2 = &line[9]; #else - snprintf(line, sizeof(Xline), "/dev/ptym/ptyXX"); - p1 = &line[13]; - p2 = &line[14]; + snprintf(line, sizeof(Xline), "/dev/ptym/ptyXX"); + p1 = &line[13]; + p2 = &line[14]; #endif - - for (cp = "pqrstuvwxyzPQRST"; *cp; cp++) { - struct stat stb; - - *p1 = *cp; - *p2 = '0'; - /* - * This stat() check is just to keep us from - * looping through all 256 combinations if there - * aren't that many ptys available. - */ - if (stat(line, &stb) < 0) - break; - for (i = 0; i < 16; i++) { - *p2 = "0123456789abcdef"[i]; - p = open(line, O_RDWR); - if (p > 0) { + + for (cp = "pqrstuvwxyzPQRST"; *cp; cp++) { + struct stat stb; + + *p1 = *cp; + *p2 = '0'; + /* + * This stat() check is just to keep us from + * looping through all 256 combinations if there + * aren't that many ptys available. + */ + if (stat(line, &stb) < 0) + break; + for (i = 0; i < 16; i++) { + *p2 = "0123456789abcdef"[i]; + p = open(line, O_RDWR); + if (p > 0) { +#if SunOS == 40 + int dummy; +#endif + #ifndef __hpux - line[5] = 't'; + line[5] = 't'; #else - for (p1 = &line[8]; *p1; p1++) - *p1 = *(p1+1); - line[9] = 't'; + for (p1 = &line[8]; *p1; p1++) + *p1 = *(p1+1); + line[9] = 't'; #endif - chown(line, 0, 0); - chmod(line, 0600); + chown(line, 0, 0); + chmod(line, 0600); #if SunOS == 40 - if (ioctl(p, TIOCGPGRP, &dummy) == 0 - || errno != EIO) { - chmod(line, 0666); - close(p); - line[5] = 'p'; - } else + if (ioctl(p, TIOCGPGRP, &dummy) == 0 + || errno != EIO) { + chmod(line, 0666); + close(p); + line[5] = 'p'; + } else #endif /* SunOS == 40 */ - return(p); + return(p); + } } } } #else /* CRAY */ - extern lowpty, highpty; - struct stat sb; - - for (*ptynum = lowpty; *ptynum <= highpty; (*ptynum)++) { - snprintf(myline, sizeof(myline), "/dev/pty/%03d", *ptynum); - p = open(myline, 2); - if (p < 0) - continue; - snprintf(line, sizeof(Xline), "/dev/ttyp%03d", *ptynum); - /* - * Here are some shenanigans to make sure that there - * are no listeners lurking on the line. - */ - if(stat(line, &sb) < 0) { - close(p); - continue; - } - if(sb.st_uid || sb.st_gid || sb.st_mode != 0600) { - chown(line, 0, 0); - chmod(line, 0600); - close(p); + { + extern lowpty, highpty; + struct stat sb; + int p; + + for (*ptynum = lowpty; *ptynum <= highpty; (*ptynum)++) { + snprintf(myline, sizeof(myline), "/dev/pty/%03d", *ptynum); 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 */ - close(p); + snprintf(line, sizeof(Xline), "/dev/ttyp%03d", *ptynum); + /* + * Here are some shenanigans to make sure that there + * are no listeners lurking on the line. + */ + if(stat(line, &sb) < 0) { + close(p); + continue; + } + if(sb.st_uid || sb.st_gid || sb.st_mode != 0600) { + chown(line, 0, 0); + chmod(line, 0600); + 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 */ + close(p); + } } } #endif /* CRAY */ -#endif /* STREAMSPTY */ -#endif /* OPENPTY */ return(-1); -#endif } @@ -966,6 +947,9 @@ int cleanopen(char *line) { int t; + if (ptyslavefd != -1) + return ptyslavefd; + #ifdef STREAMSPTY if (!really_stream) #endif @@ -1072,6 +1056,8 @@ int login_tty(int t) * Clean the tty name. Return a pointer to the cleaned version. */ +static char * clean_ttyname (char *) __attribute__((unused)); + static char * clean_ttyname (char *tty) { @@ -1135,7 +1121,7 @@ startslave(const char *host, const char *utmp_host, #ifdef ENCRYPTION if (!no_warn && (encrypt_output == 0 || decrypt_input == 0)) #endif - writenet((unsigned char*)tbuf, strlen(tbuf)); + writenet(tbuf, strlen(tbuf)); } # ifdef PARENT_DOES_UTMP utmp_sig_init(); @@ -1262,7 +1248,7 @@ scrub_env(void) struct arg_val { int size; int argc; - const char **argv; + char **argv; }; static void addarg(struct arg_val*, const char*); @@ -1281,29 +1267,40 @@ start_login(const char *host, int autologin, char *name) char *user; int save_errno; +#ifdef ENCRYPTION + encrypt_output = NULL; + decrypt_input = NULL; +#endif + #ifdef HAVE_UTMPX_H - int pid = getpid(); - struct utmpx utmpx; - char *clean_tty; - - /* - * Create utmp entry for child - */ - - clean_tty = clean_ttyname(line); - memset(&utmpx, 0, sizeof(utmpx)); - strncpy(utmpx.ut_user, ".telnet", sizeof(utmpx.ut_user)); - strncpy(utmpx.ut_line, clean_tty, sizeof(utmpx.ut_line)); + { + int pid = getpid(); + struct utmpx utmpx; + struct timeval tv; + char *clean_tty; + + /* + * Create utmp entry for child + */ + + clean_tty = clean_ttyname(line); + memset(&utmpx, 0, sizeof(utmpx)); + strncpy(utmpx.ut_user, ".telnet", sizeof(utmpx.ut_user)); + strncpy(utmpx.ut_line, clean_tty, sizeof(utmpx.ut_line)); #ifdef HAVE_STRUCT_UTMP_UT_ID - strncpy(utmpx.ut_id, make_id(clean_tty), sizeof(utmpx.ut_id)); + strncpy(utmpx.ut_id, make_id(clean_tty), sizeof(utmpx.ut_id)); #endif - utmpx.ut_pid = pid; + utmpx.ut_pid = pid; - utmpx.ut_type = LOGIN_PROCESS; + utmpx.ut_type = LOGIN_PROCESS; + + gettimeofday (&tv, NULL); + utmpx.ut_tv.tv_sec = tv.tv_sec; + utmpx.ut_tv.tv_usec = tv.tv_usec; - gettimeofday (&utmpx.ut_tv, NULL); - if (pututxline(&utmpx) == NULL) - fatal(net, "pututxline failed"); + if (pututxline(&utmpx) == NULL) + fatal(net, "pututxline failed"); + } #endif scrub_env(); @@ -1376,7 +1373,7 @@ start_login(const char *host, int autologin, char *name) execv(new_login, argv.argv); save_errno = errno; - syslog(LOG_ERR, "%s: %m\n", new_login); + syslog(LOG_ERR, "%s: %m", new_login); fatalperror_errno(net, new_login, save_errno); /*NOTREACHED*/ } @@ -1390,7 +1387,8 @@ addarg(struct arg_val *argv, const char *val) fatal (net, "realloc: out of memory"); argv->size+=10; } - argv->argv[argv->argc++] = val; + if((argv->argv[argv->argc++] = strdup(val)) == NULL) + fatal (net, "strdup: out of memory"); argv->argv[argv->argc] = NULL; } @@ -1420,6 +1418,7 @@ rmut(void) non_save_utxp = getutxline(&utmpx); if (non_save_utxp) { struct utmpx *utxp; + struct timeval tv; char user0; utxp = malloc(sizeof(struct utmpx)); @@ -1439,7 +1438,10 @@ rmut(void) utxp->ut_exit.e_exit = 0; #endif #endif - gettimeofday(&utxp->ut_tv, NULL); + gettimeofday (&tv, NULL); + utxp->ut_tv.tv_sec = tv.tv_sec; + utxp->ut_tv.tv_usec = tv.tv_usec; + pututxline(utxp); #ifdef WTMPX_FILE utxp->ut_user[0] = user0; @@ -1838,10 +1840,8 @@ jobend(jid, path, user) } 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'; + strlcpy(saved_path, path, sizeof(saved_path)); + strlcpy(saved_user, user, sizeof(saved_user)); } if (saved_jid == 0) { saved_jid = jid; @@ -1883,7 +1883,7 @@ cleantmpdir(jid, tpath, user) tpath); break; case 0: - execl(CLEANTMPCMD, CLEANTMPCMD, user, tpath, 0); + execl(CLEANTMPCMD, CLEANTMPCMD, user, tpath, NULL); syslog(LOG_ERR, "TMPDIR cleanup(%s): execl(%s) failed: %m\n", tpath, CLEANTMPCMD); exit(1); diff --git a/crypto/heimdal/appl/telnet/telnetd/telnetd.8 b/crypto/heimdal/appl/telnet/telnetd/telnetd.8 index fd7d0bde43d2..a7dd67024c46 100644 --- a/crypto/heimdal/appl/telnet/telnetd/telnetd.8 +++ b/crypto/heimdal/appl/telnet/telnetd/telnetd.8 @@ -31,7 +31,7 @@ .\" .\" @(#)telnetd.8 8.4 (Berkeley) 6/1/94 .\" -.Dd June 1, 1994 +.Dd September 19, 2006 .Dt TELNETD 8 .Os BSD 4.2 .Sh NAME @@ -41,7 +41,7 @@ protocol server .Sh SYNOPSIS .Nm telnetd -.Op Fl BUhkln +.Op Fl BeUhkln .Op Fl D Ar debugmode .Op Fl S Ar tos .Op Fl X Ar authtype @@ -173,6 +173,10 @@ Displays data written to the pty. .It Cm exercise Has not been implemented yet. .El +.It Fl e +require encryption to be turned on (in both direction) by the client +and disconnects if the client tries to turn the encryption off (in +either direction). .It Fl h Disables the printing of host-specific information before login has been completed. diff --git a/crypto/heimdal/appl/telnet/telnetd/telnetd.c b/crypto/heimdal/appl/telnet/telnetd/telnetd.c index e57eed7169a9..033a0bffc3e1 100644 --- a/crypto/heimdal/appl/telnet/telnetd/telnetd.c +++ b/crypto/heimdal/appl/telnet/telnetd/telnetd.c @@ -33,7 +33,7 @@ #include "telnetd.h" -RCSID("$Id: telnetd.c,v 1.69.6.1 2004/03/22 18:17:25 lha Exp $"); +RCSID("$Id: telnetd.c 21748 2007-07-31 18:57:20Z lha $"); #ifdef _SC_CRAY_SECURE_SYS #include @@ -51,21 +51,20 @@ struct socksec ss; int auth_level = 0; #endif +#ifdef KRB5 +#define Authenticator k5_Authenticator +#include +#undef Authenticator +#endif + extern int utmp_len; int registerd_host_only = 0; - -#undef NOERROR - -#ifdef STREAMSPTY -# include -# include -#ifdef HAVE_SYS_UIO_H -#include -#endif /* HAVE_SYS_UIO_H */ -#ifdef HAVE_SYS_STREAM_H -#include +#ifdef ENCRYPTION +int require_encryption = 0; #endif +#ifdef STREAMSPTY + #ifdef _AIX #include #endif @@ -120,7 +119,7 @@ int debug = 0; int keepalive = 1; char *progname; -static void usage (void); +static void usage (int error_code); /* * The string to pass to getopt(). We do it this way so @@ -131,6 +130,9 @@ char valid_opts[] = "Bd:hklnS:u:UL:y" #ifdef AUTHENTICATION "a:X:z" #endif +#ifdef ENCRYPTION + "e" +#endif #ifdef DIAGNOSTICS "D:" #endif @@ -141,10 +143,6 @@ char valid_opts[] = "Bd:hklnS:u:UL:y" static void doit(struct sockaddr*, int); -#ifdef ENCRYPTION -extern int des_check_key; -#endif - int main(int argc, char **argv) { @@ -155,9 +153,6 @@ main(int argc, char **argv) int ch; #if defined(IPPROTO_IP) && defined(IP_TOS) int tos = -1; -#endif -#ifdef ENCRYPTION - des_check_key = 1; /* Kludge for Mac NCSA telnet 2.6 /bg */ #endif pfrontp = pbackp = ptyobuf; netip = netibuf; @@ -182,6 +177,8 @@ main(int argc, char **argv) print_version(NULL); exit(0); } + if (argc == 2 && strcmp(argv[1], "--help") == 0) + usage(0); while ((ch = getopt(argc, argv, valid_opts)) != -1) { switch(ch) { @@ -223,7 +220,7 @@ main(int argc, char **argv) debug++; break; } - usage(); + usage(1); /* NOTREACHED */ break; @@ -243,12 +240,17 @@ main(int argc, char **argv) } else if (!strcmp(optarg, "options")) { diagnostic |= TD_OPTIONS; } else { - usage(); + usage(1); /* NOT REACHED */ } break; #endif /* DIAGNOSTICS */ +#ifdef ENCRYPTION + case 'e': + require_encryption = 1; + break; +#endif case 'h': hostinfo = 0; @@ -283,7 +285,7 @@ main(int argc, char **argv) lowpty = atoi(optarg); if ((lowpty > highpty) || (lowpty < 0) || (highpty > 32767)) { - usage(); + usage(1); /* NOT REACHED */ } break; @@ -341,7 +343,7 @@ main(int argc, char **argv) fprintf(stderr, "telnetd: %c: unknown option\n", ch); /* FALLTHROUGH */ case '?': - usage(); + usage(0); /* NOTREACHED */ } } @@ -354,7 +356,7 @@ main(int argc, char **argv) struct servent *sp; if (argc > 1) { - usage (); + usage (1); } else if (argc == 1) { sp = roken_getservbyname (*argv, "tcp"); if (sp) @@ -370,7 +372,7 @@ main(int argc, char **argv) } mini_inetd (port); } else if (argc > 0) { - usage(); + usage(1); /* NOT REACHED */ } @@ -463,9 +465,11 @@ main(int argc, char **argv) } /* end of main */ static void -usage(void) +usage(int exit_code) { fprintf(stderr, "Usage: telnetd"); + fprintf(stderr, " [--help]"); + fprintf(stderr, " [--version]"); #ifdef AUTHENTICATION fprintf(stderr, " [-a (debug|other|otp|user|valid|off|none)]\n\t"); #endif @@ -491,7 +495,7 @@ usage(void) #endif fprintf(stderr, " [-u utmp_hostname_length] [-U]"); fprintf(stderr, " [port]\n"); - exit(1); + exit(exit_code); } /* @@ -550,6 +554,15 @@ getterminaltype(char *name, size_t name_sz) if (his_state_is_will(TELOPT_ENCRYPT)) { encrypt_wait(); } + if (require_encryption) { + + while (encrypt_delay()) + if (telnet_spin()) + fatal(net, "Failed while waiting for encryption"); + + if (!encrypt_is_encrypting()) + fatal(net, "Encryption required but not turned on by client"); + } #endif if (his_state_is_will(TELOPT_TSPEED)) { static unsigned char sb[] = @@ -636,7 +649,7 @@ getterminaltype(char *name, size_t name_sz) */ _gettermname(); if (strncmp(first, terminaltype, sizeof(first)) != 0) - strcpy(terminaltype, first); + strlcpy(terminaltype, first, sizeof(terminaltype)); break; } } @@ -747,12 +760,21 @@ Please contact your net administrator"); #endif init_env(); + + /* begin server processing */ + + /* + * Initialize the slc mapping table. + */ + + get_slc_defaults(); + /* * get terminal type. */ *user_name = 0; level = getterminaltype(user_name, sizeof(user_name)); - esetenv("TERM", terminaltype ? terminaltype : "network", 1); + esetenv("TERM", terminaltype[0] ? terminaltype : "network", 1); #ifdef _SC_CRAY_SECURE_SYS if (secflag) { @@ -763,7 +785,6 @@ Please contact your net administrator"); } #endif /* _SC_CRAY_SECURE_SYS */ - /* begin server processing */ my_telnet(net, ourpty, remote_host_name, remote_utmp_name, level, user_name); /*NOTREACHED*/ @@ -779,9 +800,17 @@ show_issue(void) if(f == NULL) f = fopen(SYSCONFDIR "/issue", "r"); if(f){ - while(fgets(buf, sizeof(buf)-2, f)){ - strcpy(buf + strcspn(buf, "\r\n"), "\r\n"); - writenet((unsigned char*)buf, strlen(buf)); + while(fgets(buf, sizeof(buf), f) != NULL) { + size_t len = strcspn(buf, "\r\n"); + if(len == strlen(buf)) { + /* there's no newline */ + writenet(buf, len); + } else { + /* replace newline with \r\n */ + buf[len] = '\0'; + writenet(buf, len); + writenet("\r\n", 2); + } } fclose(f); } @@ -802,11 +831,6 @@ my_telnet(int f, int p, const char *host, const char *utmp_host, int startslave_called = 0; time_t timeout; - /* - * Initialize the slc mapping table. - */ - get_slc_defaults(); - /* * Do some tests where it is desireable to wait for a response. * Rather than doing them slowly, one at a time, do them all diff --git a/crypto/heimdal/appl/telnet/telnetd/telnetd.h b/crypto/heimdal/appl/telnet/telnetd/telnetd.h index 65046073e923..51a5725bd9a0 100644 --- a/crypto/heimdal/appl/telnet/telnetd/telnetd.h +++ b/crypto/heimdal/appl/telnet/telnetd/telnetd.h @@ -122,6 +122,30 @@ #include #endif +#ifdef STREAMSPTY +#ifdef HAVE_SAC_H +#include +#endif +#ifdef HAVE_SYS_STROPTS_H +#include +#endif + +# include + +#ifdef HAVE_SYS_UIO_H +#include +#ifdef __hpux +#undef SE +#endif +#endif +#ifdef HAVE_SYS_STREAM_H +#include +#endif + +#endif /* STREAMSPTY */ + +#undef NOERROR + #include "defs.h" #ifndef _POSIX_VDISABLE @@ -221,3 +245,7 @@ int output_data (const char *format, ...) __attribute__ ((format (printf, 1, 2))) #endif ; + +#ifdef ENCRYPTION +extern int require_encryption; +#endif diff --git a/crypto/heimdal/appl/telnet/telnetd/termstat.c b/crypto/heimdal/appl/telnet/telnetd/termstat.c index a223269f0374..696a2343dffd 100644 --- a/crypto/heimdal/appl/telnet/telnetd/termstat.c +++ b/crypto/heimdal/appl/telnet/telnetd/termstat.c @@ -33,7 +33,7 @@ #include "telnetd.h" -RCSID("$Id: termstat.c,v 1.12 2001/08/29 00:45:23 assar Exp $"); +RCSID("$Id: termstat.c 10587 2001-08-29 00:45:23Z assar $"); /* * local variables diff --git a/crypto/heimdal/appl/telnet/telnetd/utility.c b/crypto/heimdal/appl/telnet/telnetd/utility.c index a98b3fc79060..f55914f199b3 100644 --- a/crypto/heimdal/appl/telnet/telnetd/utility.c +++ b/crypto/heimdal/appl/telnet/telnetd/utility.c @@ -34,7 +34,7 @@ #define PRINTOPTIONS #include "telnetd.h" -RCSID("$Id: utility.c,v 1.27 2001/09/03 05:54:17 assar Exp $"); +RCSID("$Id: utility.c 15844 2005-08-08 13:36:16Z lha $"); /* * utility functions performing io related tasks @@ -323,13 +323,15 @@ netflush(void) * len - How many bytes to write */ void -writenet(unsigned char *ptr, int len) +writenet(const void *ptr, size_t len) { /* flush buffer if no room for new data) */ while ((&netobuf[BUFSIZ] - nfrontp) < len) { /* if this fails, don't worry, buffer is a little big */ netflush(); } + if ((&netobuf[BUFSIZ] - nfrontp) < len) + abort(); memmove(nfrontp, ptr, len); nfrontp += len; @@ -431,11 +433,7 @@ putchr(int cc) *putlocation++ = cc; } -/* - * This is split on two lines so that SCCS will not see the M - * between two % signs and expand it... - */ -static char fmtstr[] = { "%l:%M" "%P on %A, %d %B %Y" }; +static char fmtstr[] = { "%l:%M%P on %A, %d %B %Y" }; void putf(char *cp, char *where) { @@ -470,12 +468,7 @@ void putf(char *cp, char *where) switch (*++cp) { case 't': -#ifdef STREAMSPTY - /* names are like /dev/pts/2 -- we want pts/2 */ slash = strchr(line+1, '/'); -#else - slash = strrchr(line, '/'); -#endif if (slash == (char *) 0) putstr(line); else -- cgit v1.2.3