From 6f0f6f1b300fa3febb958336901673d2584a3a07 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Tue, 14 Oct 1997 20:57:05 +0000 Subject: [PATCH] Update after merge git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3606 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/telnet/telnet/commands.c | 2 +- appl/telnet/telnet/telnet_locl.h | 12 ++++++--- appl/telnet/telnetd/ext.h | 2 +- appl/telnet/telnetd/telnetd.c | 42 +++++++++++++++----------------- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/appl/telnet/telnet/commands.c b/appl/telnet/telnet/commands.c index 144a52ff2..e16dc0b5c 100644 --- a/appl/telnet/telnet/commands.c +++ b/appl/telnet/telnet/commands.c @@ -2069,7 +2069,7 @@ tn(int argc, char **argv) --argc; ++argv; if (argc == 0) goto usage; - user = *argv++; + user = strdup(*argv++); --argc; continue; } diff --git a/appl/telnet/telnet/telnet_locl.h b/appl/telnet/telnet/telnet_locl.h index 59f8e3689..2665cc39e 100644 --- a/appl/telnet/telnet/telnet_locl.h +++ b/appl/telnet/telnet/telnet_locl.h @@ -56,6 +56,10 @@ #include #endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif + #ifdef HAVE_UNISTD_H #include #endif @@ -67,6 +71,10 @@ #include #endif +#ifdef HAVE_SYS_TERMIO_H +#include +#endif + #ifdef HAVE_FCNTL_H #include #endif @@ -79,9 +87,6 @@ #include #endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif #ifdef HAVE_SYS_SELECT_H #include #endif @@ -144,6 +149,7 @@ #endif #include +/* krb.h? */ #if defined(AUTHENTICATION) || defined(ENCRYPTION) #include diff --git a/appl/telnet/telnetd/ext.h b/appl/telnet/telnetd/ext.h index 285b4c967..b61770d4e 100644 --- a/appl/telnet/telnetd/ext.h +++ b/appl/telnet/telnetd/ext.h @@ -126,7 +126,7 @@ int getterminaltype (char *name); void _gettermname (void); int terminaltypeok (char *s); void doit (struct sockaddr_in *who); -void telnet (int f, int p); +void telnet (int f, int p, char*, int, char*); void interrupt (void); void sendbrk (void); void sendsusp (void); diff --git a/appl/telnet/telnetd/telnetd.c b/appl/telnet/telnetd/telnetd.c index 260a4ac9a..9b44f6373 100644 --- a/appl/telnet/telnetd/telnetd.c +++ b/appl/telnet/telnetd/telnetd.c @@ -124,24 +124,17 @@ extern void usage (void); * that only the actual options that we support will be * passed off to getopt(). */ -char valid_opts[] = { - 'B', 'd', ':', 'h', 'k', 'l', 'n', 'S', ':', 'u', ':', 'U', -#ifdef AUTHENTICATION - 'a', ':', 'X', ':', +char valid_opts[] = "Bd:hklnS:u:UL:y" +#ifdef AUTHENTICATION + "a:X:z" #endif #ifdef DIAGNOSTICS - 'D', ':', + "D:" #endif #ifdef _CRAY - 'r', ':', + "r:" #endif - 'L', ':', -#ifdef AUTHENTICATION - 'y', - 'z', -#endif - '\0' -}; + ; void doit(struct sockaddr_in*); @@ -308,9 +301,11 @@ int main(int argc, char **argv) */ auth_disable_name(optarg); break; +#endif case 'y': no_warn = 1; break; +#ifdef AUTHENTICATION case 'z': log_unauth = 1; break; @@ -670,8 +665,6 @@ char *hostname; char host_name[MaxHostNameLen]; char remote_host_name[MaxHostNameLen]; -extern void telnet (int, int); - /* * Get a pty, scan input lines. */ @@ -765,11 +758,6 @@ Please contact your net administrator"); level = getterminaltype(user_name); setenv("TERM", terminaltype ? terminaltype : "network", 1); - /* - * Start up the login process on the slave side of the terminal - */ - startslave(host, level, user_name); - #ifdef _SC_CRAY_SECURE_SYS if (secflag) { if (setulvl(dv.dv_actlvl) < 0) @@ -779,7 +767,7 @@ Please contact your net administrator"); } #endif /* _SC_CRAY_SECURE_SYS */ - telnet(net, ourpty); /* begin server processing */ + telnet(net, ourpty, host, level, user_name); /* begin server processing */ /*NOTREACHED*/ } /* end of doit */ @@ -788,7 +776,7 @@ Please contact your net administrator"); * hand data to telnet receiver finite state machine. */ void -telnet(int f, int p) +telnet(int f, int p, char *host, int level, char *autoname) { int on = 1; #define TABBUFSIZ 512 @@ -800,6 +788,8 @@ telnet(int f, int p) char *IM; void netflush(); int nfd; + int startslave_called = 0; + time_t timeout; /* * Initialize the slc mapping table. @@ -965,10 +955,18 @@ telnet(int f, int p) nfd = ((f > p) ? f : p) + 1; + timeout = time(NULL) + 5; for (;;) { fd_set ibits, obits, xbits; int c; + /* wait for encryption to be turned on, but don't wait + indefinitely */ + if(!startslave_called && (!encrypt_delay() || timeout > time(NULL))){ + startslave_called = 1; + startslave(host, level, autoname); + } + if (ncc < 0 && pcc < 0) break;