Stuart Henderson wrote:
On 2015/03/24 21:52, Stanislav Brabec wrote:
Fred wrote:
      <Loging into to a Cisco IP Phone - I believe the issue here:
http://marc.info/?l=openbsd-bugs&m=142654566814793 might be related.>

Stanislav, your patch was committed to OpenBSD and that is what is
causing the problem Fred is now seeing.

I tried a transposition of this new OpenBSD patch to the
third-generation clone of this code called telnet-bsd-1.2, which is used in all SUSE products in last 15 years.

The code diverged here a bit over the time. telnet-bsd-1.2 has a different code here, but it also includes ~ICRNL:

  if (f & MODE_ECHO)
    {
      tmp_tc.c_lflag |= ECHO;
      tmp_tc.c_oflag |= ONLCR;
      if (crlf)
        tmp_tc.c_iflag |= ICRNL;
    }
  else
    {
      tmp_tc.c_lflag &= ~ECHO;
      tmp_tc.c_oflag &= ~ONLCR;
      if (crlf)
        tmp_tc.c_iflag &= ~ICRNL;
    }

  if ((f & MODE_FLOW) == 0)

This code has just a negation of "if" in the "else" part.


Backport to OpenBSD would look:

Index: sys_bsd.c
===================================================================
RCS file: /cvs/src/usr.bin/telnet/sys_bsd.c,v
retrieving revision 1.29
diff -u -p -u -r1.29 sys_bsd.c
--- sys_bsd.c   12 Feb 2015 09:50:50 -0000      1.29
+++ sys_bsd.c   24 Mar 2015 21:32:07 -0000
@@ -283,6 +283,8 @@ TerminalNewMode(int f)
     } else {
        tmp_tc.c_lflag &= ~ECHO;
        tmp_tc.c_oflag &= ~ONLCR;
+       if (crlf)
+         tmp_tc.c_iflag &= ~ICRNL;
     }

     if ((f&MODE_FLOW) == 0) {



I have been thinking about my previous patch. The whole code here is trying to set the local terminal emulator mode to the mode that corresponds to the requested telnet mode as much as possible.

But because terminal emulator does not support everything what telnet would need, a part of the conversion is done in the telnet client itself.

Any change here is a bit fragile.

--
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: [email protected]
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                 fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76

Reply via email to