diff options
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/channels.c b/channels.c index 27707a128..ad879cc61 100644 --- a/channels.c +++ b/channels.c | |||
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "includes.h" | 41 | #include "includes.h" |
42 | RCSID("$OpenBSD: channels.c,v 1.189 2003/04/14 14:17:50 markus Exp $"); | 42 | RCSID("$OpenBSD: channels.c,v 1.190 2003/05/11 20:30:24 markus Exp $"); |
43 | 43 | ||
44 | #include "ssh.h" | 44 | #include "ssh.h" |
45 | #include "ssh1.h" | 45 | #include "ssh1.h" |
@@ -256,7 +256,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
256 | c->local_consumed = 0; | 256 | c->local_consumed = 0; |
257 | c->local_maxpacket = maxpack; | 257 | c->local_maxpacket = maxpack; |
258 | c->remote_id = -1; | 258 | c->remote_id = -1; |
259 | c->remote_name = remote_name; | 259 | c->remote_name = xstrdup(remote_name); |
260 | c->remote_window = 0; | 260 | c->remote_window = 0; |
261 | c->remote_maxpacket = 0; | 261 | c->remote_maxpacket = 0; |
262 | c->force_drain = 0; | 262 | c->force_drain = 0; |
@@ -1013,8 +1013,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
1013 | 1013 | ||
1014 | nc = channel_new("accepted x11 socket", | 1014 | nc = channel_new("accepted x11 socket", |
1015 | SSH_CHANNEL_OPENING, newsock, newsock, -1, | 1015 | SSH_CHANNEL_OPENING, newsock, newsock, -1, |
1016 | c->local_window_max, c->local_maxpacket, | 1016 | c->local_window_max, c->local_maxpacket, 0, buf, 1); |
1017 | 0, xstrdup(buf), 1); | ||
1018 | if (compat20) { | 1017 | if (compat20) { |
1019 | packet_start(SSH2_MSG_CHANNEL_OPEN); | 1018 | packet_start(SSH2_MSG_CHANNEL_OPEN); |
1020 | packet_put_cstring("x11"); | 1019 | packet_put_cstring("x11"); |
@@ -1129,10 +1128,8 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
1129 | return; | 1128 | return; |
1130 | } | 1129 | } |
1131 | set_nodelay(newsock); | 1130 | set_nodelay(newsock); |
1132 | nc = channel_new(rtype, | 1131 | nc = channel_new(rtype, nextstate, newsock, newsock, -1, |
1133 | nextstate, newsock, newsock, -1, | 1132 | c->local_window_max, c->local_maxpacket, 0, rtype, 1); |
1134 | c->local_window_max, c->local_maxpacket, | ||
1135 | 0, xstrdup(rtype), 1); | ||
1136 | nc->listening_port = c->listening_port; | 1133 | nc->listening_port = c->listening_port; |
1137 | nc->host_port = c->host_port; | 1134 | nc->host_port = c->host_port; |
1138 | strlcpy(nc->path, c->path, sizeof(nc->path)); | 1135 | strlcpy(nc->path, c->path, sizeof(nc->path)); |
@@ -1158,7 +1155,6 @@ static void | |||
1158 | channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) | 1155 | channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) |
1159 | { | 1156 | { |
1160 | Channel *nc; | 1157 | Channel *nc; |
1161 | char *name; | ||
1162 | int newsock; | 1158 | int newsock; |
1163 | struct sockaddr addr; | 1159 | struct sockaddr addr; |
1164 | socklen_t addrlen; | 1160 | socklen_t addrlen; |
@@ -1170,11 +1166,10 @@ channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
1170 | error("accept from auth socket: %.100s", strerror(errno)); | 1166 | error("accept from auth socket: %.100s", strerror(errno)); |
1171 | return; | 1167 | return; |
1172 | } | 1168 | } |
1173 | name = xstrdup("accepted auth socket"); | ||
1174 | nc = channel_new("accepted auth socket", | 1169 | nc = channel_new("accepted auth socket", |
1175 | SSH_CHANNEL_OPENING, newsock, newsock, -1, | 1170 | SSH_CHANNEL_OPENING, newsock, newsock, -1, |
1176 | c->local_window_max, c->local_maxpacket, | 1171 | c->local_window_max, c->local_maxpacket, |
1177 | 0, name, 1); | 1172 | 0, "accepted auth socket", 1); |
1178 | if (compat20) { | 1173 | if (compat20) { |
1179 | packet_start(SSH2_MSG_CHANNEL_OPEN); | 1174 | packet_start(SSH2_MSG_CHANNEL_OPEN); |
1180 | packet_put_cstring("auth-agent@openssh.com"); | 1175 | packet_put_cstring("auth-agent@openssh.com"); |
@@ -1996,8 +1991,8 @@ channel_input_port_open(int type, u_int32_t seq, void *ctxt) | |||
1996 | originator_string, 1); | 1991 | originator_string, 1); |
1997 | c->remote_id = remote_id; | 1992 | c->remote_id = remote_id; |
1998 | } | 1993 | } |
1994 | xfree(originator_string); | ||
1999 | if (c == NULL) { | 1995 | if (c == NULL) { |
2000 | xfree(originator_string); | ||
2001 | packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); | 1996 | packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
2002 | packet_put_int(remote_id); | 1997 | packet_put_int(remote_id); |
2003 | packet_send(); | 1998 | packet_send(); |
@@ -2094,7 +2089,7 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por | |||
2094 | /* Allocate a channel number for the socket. */ | 2089 | /* Allocate a channel number for the socket. */ |
2095 | c = channel_new("port listener", type, sock, sock, -1, | 2090 | c = channel_new("port listener", type, sock, sock, -1, |
2096 | CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, | 2091 | CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, |
2097 | 0, xstrdup("port listener"), 1); | 2092 | 0, "port listener", 1); |
2098 | strlcpy(c->path, host, sizeof(c->path)); | 2093 | strlcpy(c->path, host, sizeof(c->path)); |
2099 | c->host_port = port_to_connect; | 2094 | c->host_port = port_to_connect; |
2100 | c->listening_port = listen_port; | 2095 | c->listening_port = listen_port; |
@@ -2450,7 +2445,7 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost, | |||
2450 | nc = channel_new("x11 listener", | 2445 | nc = channel_new("x11 listener", |
2451 | SSH_CHANNEL_X11_LISTENER, sock, sock, -1, | 2446 | SSH_CHANNEL_X11_LISTENER, sock, sock, -1, |
2452 | CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, | 2447 | CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, |
2453 | 0, xstrdup("X11 inet listener"), 1); | 2448 | 0, "X11 inet listener", 1); |
2454 | nc->single_connection = single_connection; | 2449 | nc->single_connection = single_connection; |
2455 | } | 2450 | } |
2456 | 2451 | ||
@@ -2607,11 +2602,11 @@ x11_input_open(int type, u_int32_t seq, void *ctxt) | |||
2607 | c->remote_id = remote_id; | 2602 | c->remote_id = remote_id; |
2608 | c->force_drain = 1; | 2603 | c->force_drain = 1; |
2609 | } | 2604 | } |
2605 | xfree(remote_host); | ||
2610 | if (c == NULL) { | 2606 | if (c == NULL) { |
2611 | /* Send refusal to the remote host. */ | 2607 | /* Send refusal to the remote host. */ |
2612 | packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); | 2608 | packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
2613 | packet_put_int(remote_id); | 2609 | packet_put_int(remote_id); |
2614 | xfree(remote_host); | ||
2615 | } else { | 2610 | } else { |
2616 | /* Send a confirmation to the remote host. */ | 2611 | /* Send a confirmation to the remote host. */ |
2617 | packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION); | 2612 | packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION); |
@@ -2733,7 +2728,6 @@ auth_input_open_request(int type, u_int32_t seq, void *ctxt) | |||
2733 | { | 2728 | { |
2734 | Channel *c = NULL; | 2729 | Channel *c = NULL; |
2735 | int remote_id, sock; | 2730 | int remote_id, sock; |
2736 | char *name; | ||
2737 | 2731 | ||
2738 | /* Read the remote channel number from the message. */ | 2732 | /* Read the remote channel number from the message. */ |
2739 | remote_id = packet_get_int(); | 2733 | remote_id = packet_get_int(); |
@@ -2752,9 +2746,8 @@ auth_input_open_request(int type, u_int32_t seq, void *ctxt) | |||
2752 | * agent. | 2746 | * agent. |
2753 | */ | 2747 | */ |
2754 | if (sock >= 0) { | 2748 | if (sock >= 0) { |
2755 | name = xstrdup("authentication agent connection"); | ||
2756 | c = channel_new("", SSH_CHANNEL_OPEN, sock, sock, | 2749 | c = channel_new("", SSH_CHANNEL_OPEN, sock, sock, |
2757 | -1, 0, 0, 0, name, 1); | 2750 | -1, 0, 0, 0, "authentication agent connection", 1); |
2758 | c->remote_id = remote_id; | 2751 | c->remote_id = remote_id; |
2759 | c->force_drain = 1; | 2752 | c->force_drain = 1; |
2760 | } | 2753 | } |