+Thu Nov 14 14:25:51 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * sys_bsd.c(intr): Added checks to intr_waiting and intr_happened
+ to handle ^C while waiting for encryption negotiation.
+
+ * telnet.c (telnet): Allow ^C to work while waiting for encryption
+ negotiation to finish. [telnet/64]
+
Sun Nov 10 17:34:40 1996 Sam Hartman <hartmans@mit.edu>
* commands.c (tn): Reverse resolve address to deal with dialup
termdata, /* Print out terminal data flow */
debug; /* Debug level */
+extern int intr_happened, intr_waiting; /* for interrupt handling */
+
extern cc_t escape; /* Escape to command mode */
extern cc_t rlogin; /* Rlogin mode escape character */
#ifdef KLUDGELINEMODE
telnet(user)
char *user;
{
+ int printed_encrypt = 0;
+
sys_telnet_init();
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
send_will(TELOPT_ENCRYPT, 1);
while (1) {
if (my_want_state_is_wont(TELOPT_AUTHENTICATION)) {
- printf("Server refused to negotiation authentication, which is required\n");
+ printf("\nServer refused to negotiation authentication, which is required\n");
printf("for encryption. Good bye.\n\r");
Exit(1);
}
if (auth_has_failed) {
- printf("Authentication negotation has failed, which is required for\n");
+ printf("\nAuthentication negotation has failed, which is required for\n");
printf("encryption. Good bye.\n\r");
Exit(1);
}
if (my_want_state_is_dont(TELOPT_ENCRYPT) ||
my_want_state_is_wont(TELOPT_ENCRYPT)) {
- printf("Server refused to negotiate encryption. Good bye.\n\r");
+ printf("\nServer refused to negotiate encryption. Good bye.\n\r");
Exit(1);
}
if (encrypt_is_encrypting())
break;
if (time(0) > timeout) {
- printf("Encryption could not be enabled. Goodbye.\n\r");
+ printf("\nEncryption could not be enabled. Goodbye.\n\r");
Exit(1);
}
+ if (printed_encrypt == 0) {
+ printed_encrypt = 1;
+ printf("Waiting for encryption to be negotiated...");
+ /*
+ * Turn on MODE_TRAPSIG and then turn off localchars
+ * so that ^C will cause telnet to exit.
+ */
+ TerminalNewMode(getconnmode()|MODE_TRAPSIG);
+ intr_waiting = 1;
+ }
+ if (intr_happened) {
+ printf("\nUser requested an interrupt. Goodbye.\n\r");
+ Exit(1);
+ }
telnet_spin();
}
+ if (printed_encrypt) {
+ printf("done.\n");
+ intr_waiting = 0;
+ setconnmode(0);
+ }
}
#endif