commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-26-g9db2d3


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-26-g9db2d39
Date: Tue, 21 Feb 2017 12:53:33 -0500 (EST)

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  9db2d39777f8d37496265fc732e640a2ea0c9a29 (commit)
      from  3d64a8c7280e7d218c4b607aa25352be1d6c4ded (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=9db2d39777f8d37496265fc732e640a2ea0c9a29


commit 9db2d39777f8d37496265fc732e640a2ea0c9a29
Author: Mats Erik Andersson <address@hidden>
Date:   Tue Feb 21 18:50:30 2017 +0100

    telnetd: Debugging of line mode options.

diff --git a/ChangeLog b/ChangeLog
index 10888f8..661b76a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2017-02-21  Mats Erik Andersson  <address@hidden>
+
+       telnetd: Debugging of mainly line mode options.
+
+       * telnetd/telnetd.c (telnetd_run): Assemble flow control data
+       in new string variable DATA, then send it and include for debug
+       reporting in category 'options'.
+       * telnetd/termstat.c (localstat, flowstat, clientstat): Likewise,
+       also for line mode data.
+
+       * telnetd/utility.c (printsub) <LM_MODE>: Test TBUF[0]
+       to calculate replacement string, since TBUF[1] is not
+       guaranteed to be initialized by the preceding snprintf().
+
 2016-05-23  Mats Erik Andersson  <address@hidden>
 
        hostname: Avoid a trailing space.
diff --git a/telnetd/telnetd.c b/telnetd/telnetd.c
index c059b65..1dcd980 100644
--- a/telnetd/telnetd.c
+++ b/telnetd/telnetd.c
@@ -698,9 +698,15 @@ telnetd_run (void)
              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);
+                 char data[6];
+
+                 sprintf (data, "%c%c%c%c%c%c",
+                          IAC, SB, TELOPT_LFLOW,
+                          flowmode ? LFLOW_ON : LFLOW_OFF,
+                          IAC, SE);
+                 net_output_datalen (data, sizeof (data));
+                 DEBUG (debug_options, 1,
+                        printsub ('>', data + 2, sizeof (data) - 2));
                }
            }
 
diff --git a/telnetd/termstat.c b/telnetd/termstat.c
index cb80daa..5f9e2ef 100644
--- a/telnetd/termstat.c
+++ b/telnetd/termstat.c
@@ -304,10 +304,18 @@ localstat (void)
        }
       else if (lmodetype == REAL_LINEMODE)
        {
+         char data[7];
+
          send_do (TELOPT_LINEMODE, 1);
          /* send along edit modes */
-         net_output_data ("%c%c%c%c%c%c%c", IAC, SB,
-                          TELOPT_LINEMODE, LM_MODE, useeditmode, IAC, SE);
+         sprintf (data, "%c%c%c%c%c%c%c",
+                  IAC, SB, TELOPT_LINEMODE,
+                  LM_MODE, useeditmode,
+                  IAC, SE);
+         net_output_datalen (data, sizeof (data));
+         DEBUG (debug_options, 1,
+                printsub ('>', data + 2, sizeof (data) - 2));
+
          editmode = useeditmode;
        }
       linemode = uselinemode;
@@ -331,8 +339,16 @@ localstat (void)
          /*
           * Send along appropriate edit mode mask.
           */
-         net_output_data ("%c%c%c%c%c%c%c", IAC, SB,
-                          TELOPT_LINEMODE, LM_MODE, useeditmode, IAC, SE);
+         char data[7];
+
+         sprintf (data, "%c%c%c%c%c%c%c",
+                  IAC, SB, TELOPT_LINEMODE,
+                  LM_MODE, useeditmode,
+                  IAC, SE);
+         net_output_datalen (data, sizeof (data));
+         DEBUG (debug_options, 1,
+                printsub ('>', data + 2, sizeof (data) - 2));
+
          editmode = useeditmode;
        }
 
@@ -375,20 +391,29 @@ flowstat (void)
 {
   if (his_state_is_will (TELOPT_LFLOW))
     {
+      char data[6];
+
       if (tty_flowmode () != flowmode)
        {
          flowmode = tty_flowmode ();
-         net_output_data ("%c%c%c%c%c%c",
-                          IAC, SB, TELOPT_LFLOW,
-                          flowmode ? LFLOW_ON : LFLOW_OFF, IAC, SE);
+         sprintf (data, "%c%c%c%c%c%c",
+                  IAC, SB, TELOPT_LFLOW,
+                  flowmode ? LFLOW_ON : LFLOW_OFF,
+                  IAC, SE);
+         net_output_datalen (data, sizeof (data));
+         DEBUG (debug_options, 1,
+                printsub ('>', data + 2, sizeof (data) - 2));
        }
       if (tty_restartany () != restartany)
        {
          restartany = tty_restartany ();
-         net_output_data ("%c%c%c%c%c%c",
-                          IAC, SB, TELOPT_LFLOW,
-                          restartany ? LFLOW_RESTART_ANY
-                          : LFLOW_RESTART_XON, IAC, SE);
+         sprintf (data, "%c%c%c%c%c%c",
+                  IAC, SB, TELOPT_LFLOW,
+                  restartany ? LFLOW_RESTART_ANY : LFLOW_RESTART_XON,
+                  IAC, SE);
+         net_output_datalen (data, sizeof (data));
+         DEBUG (debug_options, 1,
+                printsub ('>', data + 2, sizeof (data) - 2));
        }
     }
 }
@@ -451,6 +476,8 @@ clientstat (register int code, register int parm1, register 
int parm2)
          if (lmodetype == REAL_LINEMODE && uselinemode)
            if (uselinemode)
              {
+               char data[7];
+
                useeditmode = 0;
                if (tty_isediting ())
                  useeditmode |= MODE_EDIT;
@@ -460,9 +487,15 @@ clientstat (register int code, register int parm1, 
register int parm2)
                  useeditmode |= MODE_SOFT_TAB;
                if (tty_islitecho ())
                  useeditmode |= MODE_LIT_ECHO;
-               net_output_data ("%c%c%c%c%c%c%c", IAC,
-                                SB, TELOPT_LINEMODE, LM_MODE,
-                                useeditmode, IAC, SE);
+
+               sprintf (data, "%c%c%c%c%c%c%c",
+                        IAC, SB, TELOPT_LINEMODE,
+                        LM_MODE, useeditmode,
+                        IAC, SE);
+               net_output_datalen (data, sizeof (data));
+               DEBUG (debug_options, 1,
+                      printsub ('>', data + 2, sizeof (data) - 2));
+
                editmode = useeditmode;
              }
 
@@ -520,9 +553,15 @@ clientstat (register int code, register int parm1, 
register int parm2)
 
            if (!ack)
              {
-               net_output_data ("%c%c%c%c%c%c%c", IAC,
-                                SB, TELOPT_LINEMODE, LM_MODE,
-                                useeditmode | MODE_ACK, IAC, SE);
+               char data[7];
+
+               sprintf (data, "%c%c%c%c%c%c%c",
+                        IAC, SB, TELOPT_LINEMODE,
+                        LM_MODE, useeditmode | MODE_ACK,
+                        IAC, SE);
+               net_output_datalen (data, sizeof (data));
+               DEBUG (debug_options, 1,
+                      printsub ('>', data + 2, sizeof (data) - 2));
              }
 
            editmode = useeditmode;
diff --git a/telnetd/utility.c b/telnetd/utility.c
index 44a2fe2..69faf7d 100644
--- a/telnetd/utility.c
+++ b/telnetd/utility.c
@@ -1220,7 +1220,7 @@ printsub (int direction, unsigned char *pointer, int 
length)
                      pointer[2] & MODE_SOFT_TAB ? "|SOFT_TAB" : "",
                      pointer[2] & MODE_LIT_ECHO ? "|LIT_ECHO" : "",
                      pointer[2] & MODE_ACK ? "|ACK" : "");
-           debug_output_data ("%s", tbuf[1] ? &tbuf[1] : "0");
+           debug_output_data ("%s", tbuf[0] ? &tbuf[1] : "0");
          }
 
          if (pointer[2] & ~(MODE_EDIT | MODE_TRAPSIG | MODE_ACK))

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

Summary of changes:
 ChangeLog          | 14 +++++++++++
 telnetd/telnetd.c  | 12 ++++++---
 telnetd/termstat.c | 73 +++++++++++++++++++++++++++++++++++++++++-------------
 telnetd/utility.c  |  2 +-
 4 files changed, 80 insertions(+), 21 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]