version 1.189, 2003/04/14 14:17:50 |
version 1.190, 2003/05/11 20:30:24 |
|
|
c->local_consumed = 0; |
c->local_consumed = 0; |
c->local_maxpacket = maxpack; |
c->local_maxpacket = maxpack; |
c->remote_id = -1; |
c->remote_id = -1; |
c->remote_name = remote_name; |
c->remote_name = xstrdup(remote_name); |
c->remote_window = 0; |
c->remote_window = 0; |
c->remote_maxpacket = 0; |
c->remote_maxpacket = 0; |
c->force_drain = 0; |
c->force_drain = 0; |
|
|
|
|
nc = channel_new("accepted x11 socket", |
nc = channel_new("accepted x11 socket", |
SSH_CHANNEL_OPENING, newsock, newsock, -1, |
SSH_CHANNEL_OPENING, newsock, newsock, -1, |
c->local_window_max, c->local_maxpacket, |
c->local_window_max, c->local_maxpacket, 0, buf, 1); |
0, xstrdup(buf), 1); |
|
if (compat20) { |
if (compat20) { |
packet_start(SSH2_MSG_CHANNEL_OPEN); |
packet_start(SSH2_MSG_CHANNEL_OPEN); |
packet_put_cstring("x11"); |
packet_put_cstring("x11"); |
|
|
return; |
return; |
} |
} |
set_nodelay(newsock); |
set_nodelay(newsock); |
nc = channel_new(rtype, |
nc = channel_new(rtype, nextstate, newsock, newsock, -1, |
nextstate, newsock, newsock, -1, |
c->local_window_max, c->local_maxpacket, 0, rtype, 1); |
c->local_window_max, c->local_maxpacket, |
|
0, xstrdup(rtype), 1); |
|
nc->listening_port = c->listening_port; |
nc->listening_port = c->listening_port; |
nc->host_port = c->host_port; |
nc->host_port = c->host_port; |
strlcpy(nc->path, c->path, sizeof(nc->path)); |
strlcpy(nc->path, c->path, sizeof(nc->path)); |
|
|
channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) |
channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) |
{ |
{ |
Channel *nc; |
Channel *nc; |
char *name; |
|
int newsock; |
int newsock; |
struct sockaddr addr; |
struct sockaddr addr; |
socklen_t addrlen; |
socklen_t addrlen; |
|
|
error("accept from auth socket: %.100s", strerror(errno)); |
error("accept from auth socket: %.100s", strerror(errno)); |
return; |
return; |
} |
} |
name = xstrdup("accepted auth socket"); |
|
nc = channel_new("accepted auth socket", |
nc = channel_new("accepted auth socket", |
SSH_CHANNEL_OPENING, newsock, newsock, -1, |
SSH_CHANNEL_OPENING, newsock, newsock, -1, |
c->local_window_max, c->local_maxpacket, |
c->local_window_max, c->local_maxpacket, |
0, name, 1); |
0, "accepted auth socket", 1); |
if (compat20) { |
if (compat20) { |
packet_start(SSH2_MSG_CHANNEL_OPEN); |
packet_start(SSH2_MSG_CHANNEL_OPEN); |
packet_put_cstring("auth-agent@openssh.com"); |
packet_put_cstring("auth-agent@openssh.com"); |
|
|
originator_string, 1); |
originator_string, 1); |
c->remote_id = remote_id; |
c->remote_id = remote_id; |
} |
} |
|
xfree(originator_string); |
if (c == NULL) { |
if (c == NULL) { |
xfree(originator_string); |
|
packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
packet_put_int(remote_id); |
packet_put_int(remote_id); |
packet_send(); |
packet_send(); |
|
|
/* Allocate a channel number for the socket. */ |
/* Allocate a channel number for the socket. */ |
c = channel_new("port listener", type, sock, sock, -1, |
c = channel_new("port listener", type, sock, sock, -1, |
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, |
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, |
0, xstrdup("port listener"), 1); |
0, "port listener", 1); |
strlcpy(c->path, host, sizeof(c->path)); |
strlcpy(c->path, host, sizeof(c->path)); |
c->host_port = port_to_connect; |
c->host_port = port_to_connect; |
c->listening_port = listen_port; |
c->listening_port = listen_port; |
|
|
nc = channel_new("x11 listener", |
nc = channel_new("x11 listener", |
SSH_CHANNEL_X11_LISTENER, sock, sock, -1, |
SSH_CHANNEL_X11_LISTENER, sock, sock, -1, |
CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, |
CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, |
0, xstrdup("X11 inet listener"), 1); |
0, "X11 inet listener", 1); |
nc->single_connection = single_connection; |
nc->single_connection = single_connection; |
} |
} |
|
|
|
|
c->remote_id = remote_id; |
c->remote_id = remote_id; |
c->force_drain = 1; |
c->force_drain = 1; |
} |
} |
|
xfree(remote_host); |
if (c == NULL) { |
if (c == NULL) { |
/* Send refusal to the remote host. */ |
/* Send refusal to the remote host. */ |
packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
packet_put_int(remote_id); |
packet_put_int(remote_id); |
xfree(remote_host); |
|
} else { |
} else { |
/* Send a confirmation to the remote host. */ |
/* Send a confirmation to the remote host. */ |
packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION); |
packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION); |
|
|
{ |
{ |
Channel *c = NULL; |
Channel *c = NULL; |
int remote_id, sock; |
int remote_id, sock; |
char *name; |
|
|
|
/* Read the remote channel number from the message. */ |
/* Read the remote channel number from the message. */ |
remote_id = packet_get_int(); |
remote_id = packet_get_int(); |
|
|
* agent. |
* agent. |
*/ |
*/ |
if (sock >= 0) { |
if (sock >= 0) { |
name = xstrdup("authentication agent connection"); |
|
c = channel_new("", SSH_CHANNEL_OPEN, sock, sock, |
c = channel_new("", SSH_CHANNEL_OPEN, sock, sock, |
-1, 0, 0, 0, name, 1); |
-1, 0, 0, 0, "authentication agent connection", 1); |
c->remote_id = remote_id; |
c->remote_id = remote_id; |
c->force_drain = 1; |
c->force_drain = 1; |
} |
} |