This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  0b7e8687494ed8522e0243b5e6390fbd4e5e54c9 (commit)
      from  236256e897e51ea4993d2e70f77f23a085ac115e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=0b7e8687494ed8522e0243b5e6390fbd4e5e54c9


commit 0b7e8687494ed8522e0243b5e6390fbd4e5e54c9
Author: Mats Erik Andersson <[email protected]>
Date:   Sun Mar 15 02:54:03 2015 +0100

    telnetd: Suppress PTY packet data.
    
    The data preamble from PTY in packet mode was not pruned
    sufficiently before transferring the payload to client.

diff --git a/ChangeLog b/ChangeLog
index f4f3ef7..0310c61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2015-03-15  Mats Erik Andersson  <[email protected]>
+
+       telnetd: Suppress PTY packet data.
+       The server is receiving PTY input in packet mode, but is not
+       properly discarding PIOCPKT_DATA before handing over input
+       to the network socket.  Do this correctly.
+
+       * telnetd/telnetd.c (telnet_run) <input from pty>: Break the
+       loop also if pty_read() returns zero.  Add a final call to
+       pty_get_char() before ending FD_ISSET(pty, &ibits).  This call
+       was mistakenly located within the subcase where TIOCPKT_NOSTOP
+       or TIOCPKT_DOSTOP is handled.
+
 2015-03-14  Mats Erik Andersson  <[email protected]>
 
        Complaints during IPv6-less testing.
diff --git a/telnetd/telnetd.c b/telnetd/telnetd.c
index eb825e5..fff4432 100644
--- a/telnetd/telnetd.c
+++ b/telnetd/telnetd.c
@@ -662,14 +662,17 @@ telnetd_run (void)
       if (FD_ISSET (pty, &ibits))
        {
          /* Something to read from the pty... */
-         if (pty_read () < 0)
+         if (pty_read () <= 0)
            break;
+
+         /* The first byte is now TIOCPKT data.  Peek at it.  */
          c = pty_get_char (1);
+
 #if defined TIOCPKT_IOCTL
          if (c & TIOCPKT_IOCTL)
            {
              pty_get_char (0);
-             copy_termbuf ();
+             copy_termbuf ();  /* Pty buffer is now emptied.  */
              localstat ();
            }
 #endif
@@ -686,16 +689,16 @@ telnetd_run (void)
          if (his_state_is_will (TELOPT_LFLOW)
              && (c & (TIOCPKT_NOSTOP | TIOCPKT_DOSTOP)))
            {
-             int newflow = c & TIOCPKT_DOSTOP ? 1 : 0;
+             int newflow = (c & TIOCPKT_DOSTOP) ? 1 : 0;
              if (newflow != flowmode)
                {
                  net_output_data ("%c%c%c%c%c%c",
                                   IAC, SB, TELOPT_LFLOW,
                                   flowmode ? LFLOW_ON : LFLOW_OFF, IAC, SE);
                }
-             pty_get_char (0);
            }
 
+         pty_get_char (0);     /* Discard the TIOCPKT preamble.  */
        }
 
       while (pty_input_level () > 0)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |   13 +++++++++++++
 telnetd/telnetd.c |   11 +++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 

_______________________________________________
Commit-inetutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/commit-inetutils

Reply via email to