diff options
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 58 |
1 files changed, 7 insertions, 51 deletions
diff --git a/channels.c b/channels.c index 26741270a..7da46143f 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.166 2002/02/05 14:32:55 markus Exp $"); | 42 | RCSID("$OpenBSD: channels.c,v 1.167 2002/02/06 14:55:15 markus Exp $"); |
43 | 43 | ||
44 | #include "ssh.h" | 44 | #include "ssh.h" |
45 | #include "ssh1.h" | 45 | #include "ssh1.h" |
@@ -1004,11 +1004,6 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
1004 | SSH_CHANNEL_OPENING, newsock, newsock, -1, | 1004 | SSH_CHANNEL_OPENING, newsock, newsock, -1, |
1005 | c->local_window_max, c->local_maxpacket, | 1005 | c->local_window_max, c->local_maxpacket, |
1006 | 0, xstrdup(buf), 1); | 1006 | 0, xstrdup(buf), 1); |
1007 | if (nc == NULL) { | ||
1008 | close(newsock); | ||
1009 | xfree(remote_ipaddr); | ||
1010 | return; | ||
1011 | } | ||
1012 | if (compat20) { | 1007 | if (compat20) { |
1013 | packet_start(SSH2_MSG_CHANNEL_OPEN); | 1008 | packet_start(SSH2_MSG_CHANNEL_OPEN); |
1014 | packet_put_cstring("x11"); | 1009 | packet_put_cstring("x11"); |
@@ -1126,11 +1121,6 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
1126 | nextstate, newsock, newsock, -1, | 1121 | nextstate, newsock, newsock, -1, |
1127 | c->local_window_max, c->local_maxpacket, | 1122 | c->local_window_max, c->local_maxpacket, |
1128 | 0, xstrdup(rtype), 1); | 1123 | 0, xstrdup(rtype), 1); |
1129 | if (nc == NULL) { | ||
1130 | error("channel_post_port_listener: no new channel:"); | ||
1131 | close(newsock); | ||
1132 | return; | ||
1133 | } | ||
1134 | nc->listening_port = c->listening_port; | 1124 | nc->listening_port = c->listening_port; |
1135 | nc->host_port = c->host_port; | 1125 | nc->host_port = c->host_port; |
1136 | strlcpy(nc->path, c->path, sizeof(nc->path)); | 1126 | strlcpy(nc->path, c->path, sizeof(nc->path)); |
@@ -1173,11 +1163,6 @@ channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
1173 | SSH_CHANNEL_OPENING, newsock, newsock, -1, | 1163 | SSH_CHANNEL_OPENING, newsock, newsock, -1, |
1174 | c->local_window_max, c->local_maxpacket, | 1164 | c->local_window_max, c->local_maxpacket, |
1175 | 0, name, 1); | 1165 | 0, name, 1); |
1176 | if (nc == NULL) { | ||
1177 | error("channel_post_auth_listener: channel_new failed"); | ||
1178 | xfree(name); | ||
1179 | close(newsock); | ||
1180 | } | ||
1181 | if (compat20) { | 1166 | if (compat20) { |
1182 | packet_start(SSH2_MSG_CHANNEL_OPEN); | 1167 | packet_start(SSH2_MSG_CHANNEL_OPEN); |
1183 | packet_put_cstring("auth-agent@openssh.com"); | 1168 | packet_put_cstring("auth-agent@openssh.com"); |
@@ -1977,12 +1962,7 @@ channel_input_port_open(int type, u_int32_t seq, void *ctxt) | |||
1977 | c = channel_new("connected socket", | 1962 | c = channel_new("connected socket", |
1978 | SSH_CHANNEL_CONNECTING, sock, sock, -1, 0, 0, 0, | 1963 | SSH_CHANNEL_CONNECTING, sock, sock, -1, 0, 0, 0, |
1979 | originator_string, 1); | 1964 | originator_string, 1); |
1980 | if (c == NULL) { | 1965 | c->remote_id = remote_id; |
1981 | error("channel_input_port_open: channel_new failed"); | ||
1982 | close(sock); | ||
1983 | } else { | ||
1984 | c->remote_id = remote_id; | ||
1985 | } | ||
1986 | } | 1966 | } |
1987 | if (c == NULL) { | 1967 | if (c == NULL) { |
1988 | packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); | 1968 | packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
@@ -2083,11 +2063,6 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por | |||
2083 | c = channel_new("port listener", type, sock, sock, -1, | 2063 | c = channel_new("port listener", type, sock, sock, -1, |
2084 | CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, | 2064 | CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, |
2085 | 0, xstrdup("port listener"), 1); | 2065 | 0, xstrdup("port listener"), 1); |
2086 | if (c == NULL) { | ||
2087 | error("channel_setup_fwd_listener: channel_new failed"); | ||
2088 | close(sock); | ||
2089 | continue; | ||
2090 | } | ||
2091 | strlcpy(c->path, host, sizeof(c->path)); | 2066 | strlcpy(c->path, host, sizeof(c->path)); |
2092 | c->host_port = port_to_connect; | 2067 | c->host_port = port_to_connect; |
2093 | c->listening_port = listen_port; | 2068 | c->listening_port = listen_port; |
@@ -2427,8 +2402,7 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost, | |||
2427 | SSH_CHANNEL_X11_LISTENER, sock, sock, -1, | 2402 | SSH_CHANNEL_X11_LISTENER, sock, sock, -1, |
2428 | CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, | 2403 | CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, |
2429 | 0, xstrdup("X11 inet listener"), 1); | 2404 | 0, xstrdup("X11 inet listener"), 1); |
2430 | if (nc != NULL) | 2405 | nc->single_connection = single_connection; |
2431 | nc->single_connection = single_connection; | ||
2432 | } | 2406 | } |
2433 | 2407 | ||
2434 | /* Return the display number for the DISPLAY environment variable. */ | 2408 | /* Return the display number for the DISPLAY environment variable. */ |
@@ -2580,13 +2554,8 @@ x11_input_open(int type, u_int32_t seq, void *ctxt) | |||
2580 | c = channel_new("connected x11 socket", | 2554 | c = channel_new("connected x11 socket", |
2581 | SSH_CHANNEL_X11_OPEN, sock, sock, -1, 0, 0, 0, | 2555 | SSH_CHANNEL_X11_OPEN, sock, sock, -1, 0, 0, 0, |
2582 | remote_host, 1); | 2556 | remote_host, 1); |
2583 | if (c == NULL) { | 2557 | c->remote_id = remote_id; |
2584 | error("x11_input_open: channel_new failed"); | 2558 | c->force_drain = 1; |
2585 | close(sock); | ||
2586 | } else { | ||
2587 | c->remote_id = remote_id; | ||
2588 | c->force_drain = 1; | ||
2589 | } | ||
2590 | } | 2559 | } |
2591 | if (c == NULL) { | 2560 | if (c == NULL) { |
2592 | /* Send refusal to the remote host. */ | 2561 | /* Send refusal to the remote host. */ |
@@ -2800,13 +2769,6 @@ auth_input_request_forwarding(struct passwd * pw) | |||
2800 | SSH_CHANNEL_AUTH_SOCKET, sock, sock, -1, | 2769 | SSH_CHANNEL_AUTH_SOCKET, sock, sock, -1, |
2801 | CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, | 2770 | CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, |
2802 | 0, xstrdup("auth socket"), 1); | 2771 | 0, xstrdup("auth socket"), 1); |
2803 | if (nc == NULL) { | ||
2804 | error("auth_input_request_forwarding: channel_new failed"); | ||
2805 | auth_sock_cleanup_proc(pw); | ||
2806 | fatal_remove_cleanup(auth_sock_cleanup_proc, pw); | ||
2807 | close(sock); | ||
2808 | return 0; | ||
2809 | } | ||
2810 | strlcpy(nc->path, auth_sock_name, sizeof(nc->path)); | 2772 | strlcpy(nc->path, auth_sock_name, sizeof(nc->path)); |
2811 | return 1; | 2773 | return 1; |
2812 | } | 2774 | } |
@@ -2840,14 +2802,8 @@ auth_input_open_request(int type, u_int32_t seq, void *ctxt) | |||
2840 | name = xstrdup("authentication agent connection"); | 2802 | name = xstrdup("authentication agent connection"); |
2841 | c = channel_new("", SSH_CHANNEL_OPEN, sock, sock, | 2803 | c = channel_new("", SSH_CHANNEL_OPEN, sock, sock, |
2842 | -1, 0, 0, 0, name, 1); | 2804 | -1, 0, 0, 0, name, 1); |
2843 | if (c == NULL) { | 2805 | c->remote_id = remote_id; |
2844 | error("auth_input_open_request: channel_new failed"); | 2806 | c->force_drain = 1; |
2845 | xfree(name); | ||
2846 | close(sock); | ||
2847 | } else { | ||
2848 | c->remote_id = remote_id; | ||
2849 | c->force_drain = 1; | ||
2850 | } | ||
2851 | } | 2807 | } |
2852 | if (c == NULL) { | 2808 | if (c == NULL) { |
2853 | packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); | 2809 | packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |