Specifying a port in telnetrc is not working

Bug #1891021 reported by Dongho Chang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
netkit-telnet (Debian)
New
Unknown
netkit-telnet (Ubuntu)
New
Medium
Unassigned

Bug Description

1) Ubuntu release
 Description: Ubuntu 18.04.3 LTS
 Release: 18.04
2) Package version
 telnet:
  Installed: 0.17-41
  Candidate: 0.17-41
  Version table:
 *** 0.17-41 500
        500 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

3) What expected to happen

 - 1. Specify a port in telnetrc ( $HOME/.telnetrc) as follows
     * DEFAUT:8023 mode character
 - 2. telnet a host with specific port
     * telnet 192.168.1.1 8023
 - The expected is that "mode character" command is executed as soon as server is connected, according to "man telnet"

4) What happened instead
  - The command in telnetrc specifying a port is not executed
  - But If not specifying a port, the command is executed as expected

5) Cause of Bug
  - telnetrc parsing routine ( readrc() function in telnet/command.cc ) has a flaw in comparing the port number of command-line with that of telnetrc
  - To proceed command processing, the result of string compare MUST not negated
  - The patch is as follows
--- a/telnet/commands.cc
+++ b/telnet/commands.cc
@@ -2135,7 +2135,7 @@ static void readrc(const char *m1, const char *m2, const char *port,
                continue;
     while (fgets(line, sizeof(line), rcfile)) {
        ...
        if (gotmachine == 0) {
            ...

            if (line[0] == ':') {
- if (!strncasecmp(&line[1], port, lport))
+ if (strncasecmp(&line[1], port, lport))
                    continue;
                strncpy(line, &line[lport + 1], sizeof(line) - lport - 1);
            }
           ...
        }
        ...
        process_command(&cmdtab, margc, margv);

Tags: impish
Revision history for this message
Dongho Chang (dong579) wrote :
Mathew Hodson (mhodson)
Changed in netkit-telnet (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Brian Murray (brian-murray) wrote :

Thank you for providing a patch for this bug report. This particular package is synchronized with Debian so it would be quite helpful if you were to forward the patch to the Debian bug tracker. You can learn more about how to use the Debian bug tracker at https://wiki.ubuntu.com/Debian/Bugs. After you've forwarded the bug report and patch please add a bug watch, following the procedure at http://wiki.ubuntu.com/Bugs/Watches, so we can track the progress of the upstream bug report.

Revision history for this message
Brian Murray (brian-murray) wrote :

Looking at the source code for netkit-telnet this is still an issue with the version of the pacakge in Impish.

tags: added: impish
Revision history for this message
Dongho Chang (dong579) wrote :

debian bug url updated

Changed in debian:
importance: Undecided → Unknown
status: New → Unknown
affects: debian → netkit-telnet (Debian)
Revision history for this message
Dongho Chang (dong579) wrote :

Brian Murray Thanks for your comment #2.

According to your comment, I reported bug and submitted patch to debian

Changed in netkit-telnet (Debian):
status: Unknown → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.