Hi there,
I recently submit a bug request in the auth_cookie generation.
In fact, i'm trying to make a ssh client with X11 forwarding, but i'm a
bit confused on how to do that.
What i'm doing is fairly simple :
I create a session and ask for a channel.
On this channel, i'm asking for :
- a x11 forwarding (thanks to x11_req)
- a pty (thanks to pty_ex)
- a shell.
I have a fonctional shell, but when i try to open a X11 program (xeyes),
on client side i have :
X connection to localhost:10.0 broken (explicit kill or server shutdown).
xauth list gives me
device.domain.lan:1 MIT-MAGIC-COOKIE-1 b981264da9614d52307ddf53be812b86
device/unix:1 MIT-MAGIC-COOKIE-1 b981264da9614d52307ddf53be812b86
device/unix:12 MIT-MAGIC-COOKIE-1 96506ef083dd9f35155158c683b3b13c
device/unix:11 MIT-MAGIC-COOKIE-1 851cf5c28e9ed7448d2c67f99703e935
device/unix:10 MIT-MAGIC-COOKIE-1 138f73c30366555759092662f38d3ac1
netstat gives me
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN
So everything seems to be ok.
When i put my ssh server in debug mode, on X11 request, i have :
debug1: channel 3: new [X11 connection from 127.0.0.1 port 44046]
channel 3: open failed: resource shortage:
debug1: channel 3: free: X11 connection from 127.0.0.1 port 44046,
nchannels 4
debug3: channel 3: status: The following connections are open:
#0 server-session (t4 r0 i0/0 o0/0 fd 11/10 cfd -1)
#3 X11 connection from 127.0.0.1 port 44046 (t3 r-1 i0/0 o0/0 fd 13/13
cfd -1)
debug3: channel 3: close_fds r 13 w 13 e -1 c -1
So what is wrong???
One more things in x11_req, we do not check the return code
SSH_MSG_CHANNEL_FAILURE
we have :
if (rc == PACKET_EAGAIN) {
return PACKET_EAGAIN;
} else if (rc) {
channel->reqX11_state = libssh2_NB_state_idle;
return -1;
}
if (data[0] == SSH_MSG_CHANNEL_SUCCESS) {
LIBSSH2_FREE(session, data);
channel->reqX11_state = libssh2_NB_state_idle;
return 0;
}
I think it would be better with somethings like this :
if (rc == PACKET_EAGAIN) {
return PACKET_EAGAIN;
} else if (rc) {
channel->reqX11_state = libssh2_NB_state_idle;
return -1;
}
if (data[0] == SSH_MSG_CHANNEL_SUCCESS) {
LIBSSH2_FREE(session, data);
channel->reqX11_state = libssh2_NB_state_idle;
return 0;
}
else if (data[0] == SSH_MSG_CHANNEL_FAILURE){
LIBSSH2_FREE(session,data);
channel->reqX11_state = libssh2_NB_state_idle;
return -1;
}
(in fact a switch case would be better :))
I'm sorry, i can't give you a code snippet, because i'm working with a
python wrapper...
Regards,
Olivier Hervieu.
------------------------------------------------------------------------------
_______________________________________________
libssh2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libssh2-devel