diff options
-rw-r--r-- | networking/telnet.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/networking/telnet.c b/networking/telnet.c index 09f75cc84..ec3db0c5e 100644 --- a/networking/telnet.c +++ b/networking/telnet.c | |||
@@ -299,7 +299,7 @@ static void put_iac_subopt(byte c, char *str) | |||
299 | static void put_iac_subopt_autologin(void) | 299 | static void put_iac_subopt_autologin(void) |
300 | { | 300 | { |
301 | int len = strlen(G.autologin) + 6; // (2 + 1 + 1 + strlen + 2) | 301 | int len = strlen(G.autologin) + 6; // (2 + 1 + 1 + strlen + 2) |
302 | const char *user = "USER"; | 302 | const char *p = "USER"; |
303 | 303 | ||
304 | if (G.iaclen + len > IACBUFSIZE) | 304 | if (G.iaclen + len > IACBUFSIZE) |
305 | iac_flush(); | 305 | iac_flush(); |
@@ -310,13 +310,14 @@ static void put_iac_subopt_autologin(void) | |||
310 | put_iac(TELQUAL_IS); | 310 | put_iac(TELQUAL_IS); |
311 | put_iac(NEW_ENV_VAR); | 311 | put_iac(NEW_ENV_VAR); |
312 | 312 | ||
313 | while (*user) | 313 | while (*p) |
314 | put_iac(*user++); | 314 | put_iac(*p++); |
315 | 315 | ||
316 | put_iac(NEW_ENV_VALUE); | 316 | put_iac(NEW_ENV_VALUE); |
317 | 317 | ||
318 | while (*G.autologin) | 318 | p = G.autologin; |
319 | put_iac(*G.autologin++); | 319 | while (*p) |
320 | put_iac(*p++); | ||
320 | 321 | ||
321 | put_iac(IAC); | 322 | put_iac(IAC); |
322 | put_iac(SE); | 323 | put_iac(SE); |
@@ -441,7 +442,6 @@ static void to_sga(void) | |||
441 | static void to_ttype(void) | 442 | static void to_ttype(void) |
442 | { | 443 | { |
443 | /* Tell server we will (or won't) do TTYPE */ | 444 | /* Tell server we will (or won't) do TTYPE */ |
444 | |||
445 | if (G.ttype) | 445 | if (G.ttype) |
446 | put_iac2(WILL, TELOPT_TTYPE); | 446 | put_iac2(WILL, TELOPT_TTYPE); |
447 | else | 447 | else |
@@ -453,7 +453,6 @@ static void to_ttype(void) | |||
453 | static void to_new_environ(void) | 453 | static void to_new_environ(void) |
454 | { | 454 | { |
455 | /* Tell server we will (or will not) do AUTOLOGIN */ | 455 | /* Tell server we will (or will not) do AUTOLOGIN */ |
456 | |||
457 | if (G.autologin) | 456 | if (G.autologin) |
458 | put_iac2(WILL, TELOPT_NEW_ENVIRON); | 457 | put_iac2(WILL, TELOPT_NEW_ENVIRON); |
459 | else | 458 | else |
@@ -505,12 +504,12 @@ static int subneg(byte c) | |||
505 | G.telstate = TS_SUB2; | 504 | G.telstate = TS_SUB2; |
506 | #if ENABLE_FEATURE_TELNET_TTYPE | 505 | #if ENABLE_FEATURE_TELNET_TTYPE |
507 | else | 506 | else |
508 | if (c == TELOPT_TTYPE) | 507 | if (c == TELOPT_TTYPE && G.ttype) |
509 | put_iac_subopt(TELOPT_TTYPE, G.ttype); | 508 | put_iac_subopt(TELOPT_TTYPE, G.ttype); |
510 | #endif | 509 | #endif |
511 | #if ENABLE_FEATURE_TELNET_AUTOLOGIN | 510 | #if ENABLE_FEATURE_TELNET_AUTOLOGIN |
512 | else | 511 | else |
513 | if (c == TELOPT_NEW_ENVIRON) | 512 | if (c == TELOPT_NEW_ENVIRON && G.autologin) |
514 | put_iac_subopt_autologin(); | 513 | put_iac_subopt_autologin(); |
515 | #endif | 514 | #endif |
516 | break; | 515 | break; |