[rtems commit] telnetd: Inform client that we will echo

Sebastian Huber sebh at rtems.org
Fri Sep 28 13:41:49 UTC 2012


Module:    rtems
Branch:    master
Commit:    e652e5f8db08ac4240cc3f5779b3439e02bff40f
Changeset: http://git.rtems.org/rtems/commit/?id=e652e5f8db08ac4240cc3f5779b3439e02bff40f

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Aug 20 12:10:03 2012 +0200

telnetd: Inform client that we will echo

The standard line editor rtems_shell_line_editor() produces an echo.

---

 cpukit/telnetd/pty.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/cpukit/telnetd/pty.c b/cpukit/telnetd/pty.c
index e73f0e5..9d3e48f 100644
--- a/cpukit/telnetd/pty.c
+++ b/cpukit/telnetd/pty.c
@@ -88,6 +88,16 @@ static pty_t *telnet_ptys;
 
 static rtems_device_major_number pty_major;
 
+static
+int send_iac(int minor,unsigned char mode,unsigned char option)
+{
+  unsigned char buf[3];
+
+  buf[0]=IAC_ESC;
+  buf[1]=mode;
+  buf[2]=option;
+  return write(telnet_ptys[minor].socket,buf,sizeof(buf));
+}
 
 /* This procedure returns the devname for a pty slot free.
  * If not slot availiable (field socket>=0)
@@ -118,6 +128,10 @@ char *  telnet_get_pty(int socket)
         t.tv_usec=00000;
         setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(t));
         telnet_ptys[ndx].socket=socket;
+
+        /* inform the client that we will echo */
+        send_iac(ndx, IAC_WILL, 1);
+
         return telnet_ptys[ndx].devname;
       };
     };
@@ -138,17 +152,6 @@ static const char IAC_AYT_RSP[]="\r\nAYT? Yes, RTEMS-SHELL is here\r\n";
 static const char IAC_BRK_RSP[]="<*Break*>";
 static const char IAC_IP_RSP []="<*Interrupt*>";
 
-static
-int send_iac(int minor,unsigned char mode,unsigned char option)
-{
-  unsigned char buf[3];
-
-  buf[0]=IAC_ESC;
-  buf[1]=mode;
-  buf[2]=option;
-  return write(telnet_ptys[minor].socket,buf,sizeof(buf));
-}
-
 static int
 handleSB(pty_t *pty)
 {
@@ -284,7 +287,7 @@ static int read_pty(int minor)
            if (value==3) {
               send_iac(minor,IAC_WILL,    3);  /* GO AHEAD*/
            } else  if (value==1) {
-              /* ECHO */
+              send_iac(minor,IAC_WILL,    1);  /* ECHO */
            } else {
               send_iac(minor,IAC_WONT,value);
            };




More information about the vc mailing list