cooked mode sessions

Howard Chu hyc at
Tue Jun 15 09:10:10 EST 2010

Picking up on a couple really old threads (e.g. ) I've finally gotten 
around to this. The EXTPROC support on Linux is missing, but you can find 
kernel patches for that here

I've also fixed up the netkit telnet / telnetd code to work with EXTPROC / 
LINEMODE on Linux, those patches are here

These ssh patches are still not even half-baked, just a proof of concept to 
get feedback and guidance on what the right approach actually is. To get an 
idea of where it's coming from you should read RFC1184 which gives the Telnet 
LINEMODE spec. Since the ssh protocol doesn't have the Do/Dont/Will/Wont 
option negotiation of Telnet things are of course a bit different here.

Instead of explicit negotiation, the server assumes the client supports 
linemode if it includes an EXTPROC bit in its tty modes. I've added a new 
"tty-changed" channel message as well, for the server to send tty mode changes 
back to the client. The client will assume the server supports linemode if it 
sends tty-changed messages.

If the server reports that the session tty is in cooked mode (ICANON|ECHO) 
then the client will use the readline library to process input. This opens the 
possibility of doing full local editing with command history on the client. 
(Though I haven't enabled history yet in this patch.)

So far this is only working as expected for dumb programs that don't try to 
manipulate the tty modes. I'm working on some patches to the readline library 
so that it will leave the tty in cooked mode if it detects that EXTPROC is set 
on the tty. So a remote bash shell will defer all input processing to the 
local client. Will also be able to support command completion, if the tty 
session has VEOL set to <TAB>.

Right now the tty mode handling on the client is a mess, it will need to be 
rationalized somehow to work cleanly with older raw-mode-only servers along 
with the linemode servers.

Feedback and help would be greatly welcomed.
   -- Howard Chu
   CTO, Symas Corp. 
   Director, Highland Sun
   Chief Architect, OpenLDAP
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dif1.txt
URL: <>

More information about the openssh-unix-dev mailing list