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

[ale] Implementing Minimum Telnet Protocol



I've written a program that uses the telnet protocol as a pass through to
another program on
Linux.  Currently I this program requires the client to operate in raw
mode.  I'm trying to take that requirement away and only wish to support the
telnet options that are needed for an interactive session.  I've determined
those to
be:

ECHO (on the server), LINEMODE (Disabled), SUPPRESS GO AHEAD (ENABLED)

When my server starts I send a 10 character packet that looks like this
IAC, WILL,ECHO, IAC, DONT, LINEMODE, IAC, WILL, SGA, NULL

After that packet is sent I ignore all IAC messages from the client.  I have
made an assumption that the client supports those options.  I do not want
the
client to echo, I do not want the client to use line mode, I have no need
for the GA
signal.

I'm working from a tutorial that seem to have fallacies through the text.  I
believe I
have got it right.  In Linux It appears to work great.  In putty a win32 on
winbloze telnet
client it appears I have went wrong.  Every time I press enter on a command
line I get 2 back.

Here is an example of a telnet session using winbloze telnet.  I used od on
the remote system to
capture what was going across

[root at skylab /root]# od -a << EOF
>
> l
>
> l
>
> EOF
0000000  nl   l  nl  nl   l  nl  nl
0000007
[root at skylab /root]#
[root at skylab /root]#

Here is using the linux telent client


[root at skylab /root]# od -a << EOF
> l
> l
> EOF
0000000   l  nl   l  nl
0000004
[root at skylab /root]#


Somewhere here I have double nl when using the putty or telnet on windows
client

stty output on the tty that is attached to my telnetd "like" program
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^X; eof = ^D; eol = <undef>;
eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb -cread clocal -crtscts
-ignbrk -brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
ixon -ixoff
-iuclc ixany -imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
isig icanon -iexten echo -echoe -echok -echonl -noflsh -xcase -tostop
echoprt
echoctl echoke
[root at skylab /root]#
[root at skylab /root]#


Maybe you guys will see something I'm not.



Putty (Win32) Event Log:

client:	WILL NAWS
client:	WILL TSPEED
client:	WILL TTYPE
client:	WILL NEW_ENVIRON
client:	DO ECHO
client:	WILL SGA
client:	DO SGA
server:	WILL ECHO
server:	DONT LINEMODE
client:	WONT LINEMODE
server:	WILL SGA


Linux telnet Log:

RCVD WILL ECHO
SENT DO ECHO
RCVD DONT LINEMODE
RCVD WILL SUPPRESS GO AHEAD
SENT DO SUPPRESS GO AHEAD

Thanks,
Chris Fowler


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.