[paramiko] patch for x11 forwarding

David Guerizec david at guerizec.net
Mon Oct 23 13:42:19 PDT 2006


Hello,

On Monday 23 October 2006 02:26, David Guerizec wrote:
> After some fiddling and RFC reading (RFC4254), I managed to implement x11
> forwarding, both for server and client side. I don't know if this is the
> proper way, but at least this is a good starting point.
>
> See the attached patch, to apply to the current bzr tree.

I just forgot to add the piece of code I'm using to make it work on the server 
(maybe this could be added in some form to paramiko):

class X11Channel(object):
    def __init__(self, channel, want_reply, m):
        self.channel = channel
        self.want_reply = want_reply
        self.single_connection = m.get_boolean()
        self.x11_auth_proto = m.get_string()
        self.x11_auth_cookie = m.get_string()
        self.x11_screen_number = m.get_int()


class Server(paramiko.ServerInterface):
    def check_x11_request(self, channel, want_reply, m):
        # from RFC4254, an x11-req message contains the following fields:
        #
        #       byte      SSH_MSG_CHANNEL_REQUEST
        #       uint32    recipient channel
        #       string    "x11-req"
        #       boolean   want reply
        # m->\
        #     | boolean   single connection
        #     | string    x11 authentication protocol
        #     | string    x11 authentication cookie
        #     | uint32    x11 screen number
        #
        # The first 4 fields have been consumed by Channel._handle_request()
        # The want_reply parameter is the 4th field, and m contains the rest

        self.x11 = X11Channel(channel, want_reply, m)
        return True


    def check_unhandled_channel_request(self, channel, kind, want_reply, m):
        if kind == 'x11-req':
            return self.check_x11_request(channel, want_reply, m)
        return False





Best regards,

David

-- 
http://penguin.fr/sshproxy/  "An ACL-driven proxy on SSH2"



More information about the paramiko mailing list