Bug 56679
Summary: | telnet-0.17-18 does not work correctly with some servers | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Juan Jose Amor <juanjose.amor> |
Component: | telnet | Assignee: | Harald Hoyer <harald> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Ben Levenson <benl> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.1 | ||
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2002-02-15 11:11:41 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Juan Jose Amor
2001-11-24 12:08:07 UTC
This is almost certainly the same bug as something I've found on some RedHat 6.2 servers with the latest RH6.2 telnet security patch for telnet applied. The bug is that the "telnetport" variable is not set to "1" under the default conditions of talking to port 23. Having hunted down the broken bit of code, I've managed to repair the source and hence provide a fresh RPM for my use locally. The variable which was formally ( confusingly ) called "telnetport" is now called "initiaiteoptionneg" to more accurately reflect its function. The essential part of commands.c fixed is the bit of code below, with the full diff from previous release shown below. BEFORE: if (portp == NULL) { portp = "telnet"; } else if (*portp == '-') { portp++; telnetport = 1; } h_errno = 0; error = getaddrinfo(hostp, portp, &hints, &res0); AFTER: if (portp == NULL) { portp = "telnet"; initiateoptionneg = 1; } else if (*portp == '-') { portp++; initiateoptionneg = 1; } h_errno = 0; error = getaddrinfo(hostp, portp, &hints, &res0); with the full diff from previous release below. $ cat telnet-0.17-optionneg.patch diff -uNr netkit-telnet-0.17.orig/telnet/commands.c netkit-telnet- 0.17/telnet/commands.c --- netkit-telnet-0.17.orig/telnet/commands.c Mon Feb 11 14:15:36 2002 +++ netkit-telnet-0.17/telnet/commands.c Mon Feb 11 14:24:51 2002 @@ -2379,9 +2379,10 @@ hints.ai_flags = AI_CANONNAME; if (portp == NULL) { portp = "telnet"; + initiateoptionneg = 1; } else if (*portp == '-') { portp++; - telnetport = 1; + initiateoptionneg = 1; } h_errno = 0; error = getaddrinfo(hostp, portp, &hints, &res0); diff -uNr netkit-telnet-0.17.orig/telnet/externs.h netkit-telnet- 0.17/telnet/externs.h --- netkit-telnet-0.17.orig/telnet/externs.h Mon Feb 11 14:13:44 2002 +++ netkit-telnet-0.17/telnet/externs.h Mon Feb 11 14:28:45 2002 @@ -61,7 +61,7 @@ flushout, /* flush output */ connected, /* Are we connected to the other side? */ globalmode, /* Mode tty should be in */ - telnetport, /* Are we connected to the telnet port? */ + initiateoptionneg, /* Do we initiate option negotiation? */ In3270, /* Are we in 3270 mode? */ localflow, /* Flow control handled locally */ restartany, /* If flow control, restart output on any charac ter */ diff -uNr netkit-telnet-0.17.orig/telnet/telnet.c netkit-telnet- 0.17/telnet/telnet.c --- netkit-telnet-0.17.orig/telnet/telnet.c Mon Feb 11 14:13:44 2002 +++ netkit-telnet-0.17/telnet/telnet.c Mon Feb 11 14:29:45 2002 @@ -75,7 +75,15 @@ noasynchnet = 0,/* User specified "-noasynch" on command line */ askedSGA = 0, /* We have talked about suppress go ahead */ #endif /* defined(TN3270) */ - telnetport, + + initiateoptionneg = 0, + /* Do we initiate option negotiation? - default no */ + /* If we are connected to the default telnet port, */ + /* we initiate option negotiation, else we only act */ + /* passively and allow the server end to initiate */ + /* option negotiation */ + /* CLI params determine current behaviour */ + SYNCHing, /* we are in TELNET SYNCH mode */ flushout, /* flush output */ autoflush = 0, /* flush output when interrupting? */ @@ -2144,7 +2152,7 @@ } #endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */ # if !defined(TN3270) - if (telnetport) { + if (initiateoptionneg) { #if defined(AUTHENTICATION) if (autologin) send_will(TELOPT_AUTHENTICATION, 1); $ Note that one may be able to work round the situation ( slightly knunkily )with: bash$ telnet telnet> open hostname -23 where the "-" sign in command-mode telnet command mode forces the telnet options to be neogiated correctly. ( See telnet man page for an explanation. ) It transpires that this bit of code: } else if (*portp == '-') { portp++; telnetport = 1; } means that telnet command-mode open obeys "inititate option negotiation" under these circs, whereas the command line doesn't work. You can't use -23 on the command line to get the same effect, as the command-line parsing is 'broken' and assumes "-23" is some sort of unknown option rather than " try port 23 with options enabled". You can workaround on this one using the command line, too.
Do this:
>telnet foo -- -23
already fixed in 0.17-20 *** Bug 53551 has been marked as a duplicate of this bug. *** Please, note that telnet-0.17-20 is not available as a update of Redhat Linux 7.1. you may rpm --rebuild on your 7.1, but I consider making an update errata.. thx This was basically a dup of #52224. |