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

Re: X11 Forwarding


Hi,

request_x11 is still required because that's how you tell the server you
wish to use X11.
The callback you implement should return a new ssh channel from
ssh_channel_new. This in order to keep object ownership (ssh_channel) to
the application.

Kr,

Aris
Le 13/09/13 06:02, Dustin Oprea a écrit :
> Does that mean that the request_x11() and/or accept_x11() no longer need
> to be called?
> 
> What am I doing inside the callback.. Just do ssh_channel_new(), or do I
> do an accept_x11() and return the ssh_channel from that?
> 
> I always appreciate your help, Aris.
> 
> 
> On Thu, Sep 12, 2013 at 1:36 PM, Aris Adamantiadis <aris@xxxxxxxxxxxx
> <mailto:aris@xxxxxxxxxxxx>> wrote:
> 
>     Hi Dustin,
> 
>     ssh_channel_accept_x11() is called shortly after request_x11 when you
>     know that you're going to receive an X11 socket. However since 0.6rc
>     there's a session-defined callback to handle new X11 connections:
> 
>     /**
>      * @brief Handles an SSH new channel open X11 request. This happens when
>     the server
>      * sends back an X11 connection attempt. This is a client-side API
>      * @param session current session handler
>      * @param userdata Userdata to be passed to the callback function.
>      * @returns a valid ssh_channel handle if the request is to be allowed
>      * @returns NULL if the request should not be allowed
>      * @warning The channel pointer returned by this callback must be closed
>     by the application.
>      */
>     typedef ssh_channel (*ssh_channel_open_request_x11_callback)
>     (ssh_session session,
>           const char * originator_address, int originator_port, void
>     *userdata);
> 
>     struct ssh_callbacks_struct {
>     /* ... */
>       /** This function will be called when an incoming X11 request is
>     received.
>        */
>       ssh_channel_open_request_x11_callback
>     channel_open_request_x11_function;
>     };
> 
>     I tested this in an application for a client but unfortunately don't
>     have any example around. However it's pretty simple if you look at the
>     other callback-based examples (like proxy.c or samplesshd-cb.c)
> 
>     Kr,
> 
>     Aris
> 
>     Le 12/09/13 12:58, Dustin Oprea a écrit :
>     > Does someone have experience with X11 forwarding? I'm current fixing
>     > another anomaly, but I wanted to get my thoughts straight on this.
>     This
>     > is the theoretical process as it makes sense to me:
>     >
>     > 1) ssh_channel_accept_x11(). Is this done between reads on the client,
>     > on a separate thread,.. or where?
>     > 2) At this point, we should have a X11 channel, returned from the
>     accept
>     > call.
>     > 3) ssh_channel_request_pty()
>     > 4) ssh_channel_change_pty_size()
>     > 5) ssh_channel_request_x11()
>     > 6) ssh_channel_request_shell()
>     >
>     > What now? Loop over communication on the shell channel -as well
>     as- the
>     > X11 channel?
>     >
>     > Are there any unnecessary steps, above (like the pty_size() call)?
>     >
>     >
>     > Thanks. This is just about the only principal function that isn't
>     > clearly covered by the tutorials.
>     >
>     > Dustin
>     >
> 
> 
> 


Follow-Ups:
Re: X11 ForwardingDustin Oprea <myselfasunder@xxxxxxxxx>
References:
X11 ForwardingDustin Oprea <myselfasunder@xxxxxxxxx>
Re: X11 ForwardingAris Adamantiadis <aris@xxxxxxxxxxxx>
Re: X11 ForwardingDustin Oprea <myselfasunder@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org