version 1.14, 2002/02/17 17:20:49 |
version 1.15, 2002/03/22 13:49:28 |
|
|
askedSGA = 0, /* We have talked about suppress go ahead */ |
askedSGA = 0, /* We have talked about suppress go ahead */ |
#endif /* defined(TN3270) */ |
#endif /* defined(TN3270) */ |
telnetport, |
telnetport, |
|
wantencryption = 0, |
SYNCHing, /* we are in TELNET SYNCH mode */ |
SYNCHing, /* we are in TELNET SYNCH mode */ |
flushout, /* flush output */ |
flushout, /* flush output */ |
autoflush = 0, /* flush output when interrupting? */ |
autoflush = 0, /* flush output when interrupting? */ |
|
|
|
|
char *prompt = 0; |
char *prompt = 0; |
|
|
|
int scheduler_lockout_tty = 0; |
|
|
cc_t escape; |
cc_t escape; |
cc_t rlogin; |
cc_t rlogin; |
#ifdef KLUDGELINEMODE |
#ifdef KLUDGELINEMODE |
|
|
netex = !SYNCHing; |
netex = !SYNCHing; |
|
|
/* If we have seen a signal recently, reset things */ |
/* If we have seen a signal recently, reset things */ |
|
|
|
if (scheduler_lockout_tty) { |
|
ttyin = ttyout = 0; |
|
} |
|
|
# if defined(TN3270) && defined(unix) |
# if defined(TN3270) && defined(unix) |
if (HaveInput) { |
if (HaveInput) { |
HaveInput = 0; |
HaveInput = 0; |
|
|
telnet(user) |
telnet(user) |
char *user; |
char *user; |
{ |
{ |
|
int printed_encrypt = 0; |
|
|
sys_telnet_init(); |
sys_telnet_init(); |
|
|
#if defined(AUTHENTICATION) || defined(ENCRYPTION) |
#if defined(AUTHENTICATION) || defined(ENCRYPTION) |
|
|
} |
} |
# endif /* !defined(TN3270) */ |
# endif /* !defined(TN3270) */ |
|
|
|
#ifdef ENCRYPTION |
|
/* |
|
* Note: we assume a tie to the authentication option here. This |
|
* is necessary so that authentication fails, we don't spin |
|
* forever. |
|
*/ |
|
if (wantencryption) { |
|
extern int auth_has_failed; |
|
time_t timeout = time(0) + 60; |
|
|
|
send_do(TELOPT_ENCRYPT, 1); |
|
send_will(TELOPT_ENCRYPT, 1); |
|
while (1) { |
|
if (my_want_state_is_wont(TELOPT_AUTHENTICATION)) { |
|
if (wantencryption == -1) { |
|
break; |
|
} else { |
|
printf("\nServer refused to negotiate authentication,"); |
|
printf(" which is required for encryption.\n"); |
|
Exit(1); |
|
} |
|
} |
|
if (auth_has_failed) { |
|
printf("\nAuthentication negotation has failed,"); |
|
printf(" which is required for encryption.\n"); |
|
Exit(1); |
|
} |
|
if (my_want_state_is_dont(TELOPT_ENCRYPT) || |
|
my_want_state_is_wont(TELOPT_ENCRYPT)) { |
|
printf("\nServer refused to negotiate encryption.\n"); |
|
Exit(1); |
|
} |
|
if (encrypt_is_encrypting()) |
|
break; |
|
if (time(0) > timeout) { |
|
printf("\nEncryption could not be enabled.\n"); |
|
Exit(1); |
|
} |
|
if (printed_encrypt == 0) { |
|
printed_encrypt = 1; |
|
printf("Waiting for encryption to be negotiated...\n"); |
|
/* |
|
* 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 interrupt.\n"); |
|
Exit(1); |
|
} |
|
telnet_spin(); |
|
} |
|
if (printed_encrypt) { |
|
printf("Encryption negotiated.\n"); |
|
intr_waiting = 0; |
|
setconnmode(0); |
|
} |
|
} |
|
#endif |
|
|
# if !defined(TN3270) |
# if !defined(TN3270) |
for (;;) { |
for (;;) { |
int schedValue; |
int schedValue; |