[12776] in Athena Bugs

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

Re: telnet -safe or -x behaves DANGEROUSLY

daemon@ATHENA.MIT.EDU (brlewis@MIT.EDU)
Sat Oct 22 14:39:29 1994

From: brlewis@MIT.EDU
Date: Sat, 22 Oct 94 14:39:21 -0400
To: bugs@MIT.EDU
Cc: John Hawkinson <jhawk@MIT.EDU>
In-Reply-To: "[12706] in Athena Bugs"

Athena bugs person:  Please assign an someone to audit my patch.  I'm
not 100% certain it guarantees the terminal will always be restored to a
sane state.

*** /tmp/,RCSt1a01424	Sat Oct 22 14:37:47 1994
--- utilities.c	Sat Oct 22 14:29:20 1994
***************
*** 937,939 ****
--- 937,964 ----
      fwrite(string, 1, strlen(string), stderr);
      exit(returnCode);
  }
+ 
+ /*
+  * Exit without flushing incoming data to the terminal.
+  * This is useful if exit is desired before the initial
+  * option negotiation is finished.  ExitString() prints garbage
+  * which is probably the remaining incoming option stuff.
+  */
+ 
+     void
+ ExitWithoutFlushing(returnCode)
+     int returnCode;
+ {
+   setcommandmode();
+   exit(returnCode);
+ }
+ 
+     void
+ ExitStringWithoutFlushing(string, returnCode)
+     char *string;
+     int returnCode;
+ {
+     setcommandmode();
+     fwrite(string, 1, strlen(string), stderr);
+     exit(returnCode);
+ }


*** /tmp/,RCSt1a01429	Sat Oct 22 14:38:03 1994
--- telnet.c	Sat Oct 22 14:31:06 1994
***************
*** 595,600 ****
--- 595,620 ----
  		telopt_environ = TELOPT_OLD_ENVIRON;
  		break;
  #endif
+ #ifdef KANNAN
+ 		/*
+ 		 *  We requested authentication or encryption.  Server refused.
+ 		 *  Therefore, exit on client end.
+ 		 */
+ #ifdef AUTHENTICATION
+ 	    case TELOPT_AUTHENTICATION:
+ 		ExitStringWithoutFlushing
+ 		  ("telnet: Server does not support authentication.\n", 1);
+ 		/*NOTREACHED*/
+ 		break;
+ #endif /* AUTHENTICATION */
+ #ifdef ENCRYPTION
+ 	    case TELOPT_ENCRYPT:
+ 		ExitStringWithoutFlushing
+ 		  ("telnet: Server does not support encryption.\n", 1);
+ 		/*NOTREACHED*/
+ 		break;
+ #endif /* ENCRYPTION */
+ #endif /* KANNAN */
  	    }
  	    /* we always accept a DONT */
  	    set_my_want_state_wont(option);

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