On 03/24/15 21:37, Stanislav Brabec wrote:
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.


In my testing crlf was always 0, and so the bitwise change to ICRNL was never tiggered - I tried that approach in my testing.

cheers

Fred

Reply via email to