[14124] in Athena Bugs

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

telnetd: spurious "You must use the encryption option"

daemon@ATHENA.MIT.EDU (brlewis@MIT.EDU)
Thu Jan 18 10:34:44 1996

From: brlewis@MIT.EDU
Date: Thu, 18 Jan 96 10:34:38 -0500
To: bugs@MIT.EDU

Sometimes users of NCSA telnet for Mac find that their windows disappear
mysteriously.  Setting an option that makes the window stay up shows
that there's a "You must use the encryption option" message even though
they have the encryption option turned on.  What happens is that telnetd
gets to the password prompt before NCSA telnet starts encryption.

The following patches to telnetd make it wait for a slow client to go
ahead and start encryption if encryption is required.

*** 1.1	1995/04/26 19:25:51
--- state.c	1995/04/27 00:50:31
***************
*** 1480,1485 ****
--- 1480,1486 ----
  		break;
  	case ENCRYPT_START:
  		encrypt_start(subpointer, SB_LEN());
+ 		did_encrypt_start = 1;
  		break;
  	case ENCRYPT_END:
  		encrypt_end();
*** 1.4	1995/03/16 20:04:03
--- telnetd.c	1995/04/27 00:18:15
***************
*** 79,84 ****
--- 79,88 ----
  int	require_SecurID = 0;
  #endif
  
+ #if	defined(ENCRYPTION)
+ int	did_encrypt_start = 0;
+ #endif
+ 
  extern	int utmp_len;
  int	registered_host_only = 0;
  
***************
*** 126,131 ****
--- 130,139 ----
  int	lowpty = 0, highpty;	/* low, high pty numbers */
  #endif /* CRAY */
  
+ #ifdef ATHENA_LOGIN
+ #include <unistd.h>		/* for POSIX alarm() */
+ #endif
+ 
  int debug = 0;
  int keepalive = 1;
  char *progname;
***************
*** 590,595 ****
--- 598,614 ----
  	IAC, SB, TELOPT_TTYPE, TELQUAL_SEND, IAC, SE
  };
  
+ 
+ #ifdef ATHENA_LOGIN
+ int alarm_caught;
+     void
+ alarm_catcher(int sig)
+ {
+   if (sig == SIGALRM) alarm_caught++;
+   return;
+ }
+ #endif
+ 
      int
  getterminaltype(name)
      char *name;
***************
*** 622,627 ****
--- 641,647 ----
      while (
  #ifdef	ENCRYPTION
  	   his_do_dont_is_changing(TELOPT_ENCRYPT) ||
+ 	   his_will_wont_is_changing(TELOPT_ENCRYPT) ||
  #endif	/* ENCRYPTION */
  	   his_will_wont_is_changing(TELOPT_TTYPE) ||
  	   his_will_wont_is_changing(TELOPT_TSPEED) ||
***************
*** 637,642 ****
--- 657,686 ----
       */
      if (his_state_is_will(TELOPT_ENCRYPT)) {
  	encrypt_wait();
+ #ifdef	ATHENA_LOGIN
+ 	if (auth_level < 0)	/* asking for password regardless of krb auth */
+ 	  {
+ 	    struct sigaction alarm_action, old_action;
+ 
+ 	    alarm_action.sa_handler=alarm_catcher;
+ 	    sigemptyset(&alarm_action.sa_mask);
+ 	    alarm_action.sa_flags=0;
+ 	    sigaction(SIGALRM, &alarm_action, &old_action);
+ 	    /*
+ 	     * Wait for encryption to actually start.
+ 	     */
+ 	    alarm_caught=0;
+ 	    while (!did_encrypt_start)
+ 	      {
+ 		alarm(5);	/* wait 5 seconds for more input */
+ 		ttloop();	/* hopefully receive ENCRYPT REQUEST-START */
+ 		if (alarm_caught) break; /* give up */
+ 	      }
+ 	    alarm(0);
+ 	    sigaction(SIGALRM, &old_action, NULL);
+ 	  }
+ 
+ #endif	/* ATHENA_LOGIN */
      }
  #endif	/* ENCRYPTION */
      if (his_state_is_will(TELOPT_TSPEED)) {
*** 1.3	1995/02/02 16:09:52
--- utility.c	1995/04/27 00:14:02
***************
*** 36,41 ****
--- 36,42 ----
  #endif /* not lint */
  
  #define PRINTOPTIONS
+ #include <errno.h>
  #include "telnetd.h"
  
  /*
***************
*** 63,68 ****
--- 64,70 ----
      }
      ncc = read(net, netibuf, sizeof netibuf);
      if (ncc < 0) {
+         if (errno == EINTR) return; /* interrupt from alarm() */
  	syslog(LOG_INFO, "ttloop:  read: %m\n");
  	exit(1);
      } else if (ncc == 0) {
*** 1.1	1995/04/26 19:21:50
--- ext.h	1995/04/27 00:51:20
***************
*** 63,68 ****
--- 63,71 ----
  #if	defined(AUTHENTICATION)
  extern int	auth_level;
  #endif
+ #if	defined(ENCRYPTION)
+ extern int	did_encrypt_start;
+ #endif
  
  extern slcfun	slctab[NSLC + 1];	/* slc mapping table */
  

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