Bug 2416

Summary: [PATCH] Allow forwarding of stdio to streamlocal end points
Product: Portable OpenSSH Reporter: Salvador Fandiño <sfandino>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: NEW ---    
Severity: enhancement CC: djm, dtucker, todd.miller
Priority: P5    
Version: -current   
Hardware: All   
OS: All   
Attachments:
Description Flags
the patch
none
revised streamlocal -W patch
none
revised revised streamlocal -W patch none

Description Salvador Fandiño 2015-06-24 17:51:44 AEST
Created attachment 2654 [details]
the patch

Later versions of OpenSSH allow the user to forward connections also
to/from Unix sockets.

This patch allows to use Unix sockets as the target when forwarding the
local stdio using the -W feature.
Comment 1 Salvador Fandiño 2015-06-24 18:12:02 AEST
Some comments about the patch before I forget about them:

The same variables that were hosting the hostname now also can host the socket path. The magic port number PORT_STREAMLOCAL (-2) is used to indicate that it is a socket path.

I have to promote a couple of function argument from u_short to u_int to let the PORT_STREAMLOCAL pass unmangled (as (u_short)PORT_STREAMLOCAL results in a valid TCP port number).

I have done a s/host/path/ in some variable names. That's consistent with the naming of the hostname/path slot in the Channel structure.
Comment 2 Darren Tucker 2015-07-17 13:25:23 AEST
Comment on attachment 2654 [details]
the patch

>-channel_connect_stdio_fwd(const char *host_to_connect, u_short port_to_connect,
>+channel_connect_stdio_fwd(const char *path_to_connect, u_int port_to_connect,

any reason to keep port_to_connect as unsigned?  PORT_STREAMLOCAL is negative and a signed int can cover that as well as the entire port range without casts.

Also, I think I'd rather not rename host_to_connect: path_to_connect isn't correct for the common case either and it makes the change a long more invasive.

Still looking at rest of patch.
Comment 3 Darren Tucker 2015-07-17 13:58:17 AEST
Created attachment 2675 [details]
revised streamlocal -W patch

Revised patch as per comments.  Currently untested.
Comment 4 Darren Tucker 2015-07-17 14:02:24 AEST
Created attachment 2676 [details]
revised revised streamlocal -W patch

Same again with a couple of style nits fixed too.
Comment 5 Todd C. Miller 2015-08-18 05:00:38 AEST
I have an equivalent diff in my own tree that I've tested.  I think this should go in.
Comment 6 Damien Miller 2015-10-30 13:13:22 AEDT
Todd, do you mean the attached diff or the one in your tree? (or that they are basically the same?)