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

Re: X11 Forwarding


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>
Archive administrator: postmaster@lists.cynapses.org