diff options
author | Damien Miller <djm@mindrot.org> | 2002-02-08 22:07:16 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2002-02-08 22:07:16 +1100 |
commit | 699d003e3a7cddaa1dddc4c1a35428066316748e (patch) | |
tree | c6b2ebee5588be70e0b3f12a3be7b4eec621ea02 | |
parent | f3dcf1fc88a55a916ace325e252c6f75ff53b71b (diff) |
- markus@cvs.openbsd.org 2002/02/06 14:55:16
[channels.c clientloop.c serverloop.c ssh.c]
channel_new never returns NULL, mouring@; ok djm@
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | channels.c | 58 | ||||
-rw-r--r-- | clientloop.c | 14 | ||||
-rw-r--r-- | serverloop.c | 10 | ||||
-rw-r--r-- | ssh.c | 4 |
5 files changed, 14 insertions, 77 deletions
@@ -22,6 +22,9 @@ | |||
22 | - markus@cvs.openbsd.org 2002/02/06 14:37:22 | 22 | - markus@cvs.openbsd.org 2002/02/06 14:37:22 |
23 | [session.c] | 23 | [session.c] |
24 | minor KNF | 24 | minor KNF |
25 | - markus@cvs.openbsd.org 2002/02/06 14:55:16 | ||
26 | [channels.c clientloop.c serverloop.c ssh.c] | ||
27 | channel_new never returns NULL, mouring@; ok djm@ | ||
25 | 28 | ||
26 | 20020205 | 29 | 20020205 |
27 | - (djm) Cleanup after sync: | 30 | - (djm) Cleanup after sync: |
@@ -7528,4 +7531,4 @@ | |||
7528 | - Wrote replacements for strlcpy and mkdtemp | 7531 | - Wrote replacements for strlcpy and mkdtemp |
7529 | - Released 1.0pre1 | 7532 | - Released 1.0pre1 |
7530 | 7533 | ||
7531 | $Id: ChangeLog,v 1.1834 2002/02/08 11:06:48 djm Exp $ | 7534 | $Id: ChangeLog,v 1.1835 2002/02/08 11:07:16 djm Exp $ |
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); |
diff --git a/clientloop.c b/clientloop.c index 1b9c28e9d..65a6682a6 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -59,7 +59,7 @@ | |||
59 | */ | 59 | */ |
60 | 60 | ||
61 | #include "includes.h" | 61 | #include "includes.h" |
62 | RCSID("$OpenBSD: clientloop.c,v 1.95 2002/01/10 11:24:04 markus Exp $"); | 62 | RCSID("$OpenBSD: clientloop.c,v 1.96 2002/02/06 14:55:15 markus Exp $"); |
63 | 63 | ||
64 | #include "ssh.h" | 64 | #include "ssh.h" |
65 | #include "ssh1.h" | 65 | #include "ssh1.h" |
@@ -1072,10 +1072,6 @@ client_request_forwarded_tcpip(const char *request_type, int rchan) | |||
1072 | SSH_CHANNEL_CONNECTING, sock, sock, -1, | 1072 | SSH_CHANNEL_CONNECTING, sock, sock, -1, |
1073 | CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, | 1073 | CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, |
1074 | xstrdup(originator_address), 1); | 1074 | xstrdup(originator_address), 1); |
1075 | if (c == NULL) { | ||
1076 | error("client_request_forwarded_tcpip: channel_new failed"); | ||
1077 | close(sock); | ||
1078 | } | ||
1079 | xfree(originator_address); | 1075 | xfree(originator_address); |
1080 | xfree(listen_address); | 1076 | xfree(listen_address); |
1081 | return c; | 1077 | return c; |
@@ -1113,10 +1109,6 @@ client_request_x11(const char *request_type, int rchan) | |||
1113 | SSH_CHANNEL_X11_OPEN, sock, sock, -1, | 1109 | SSH_CHANNEL_X11_OPEN, sock, sock, -1, |
1114 | CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, | 1110 | CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, |
1115 | xstrdup("x11"), 1); | 1111 | xstrdup("x11"), 1); |
1116 | if (c == NULL) { | ||
1117 | error("client_request_x11: channel_new failed"); | ||
1118 | close(sock); | ||
1119 | } | ||
1120 | c->force_drain = 1; | 1112 | c->force_drain = 1; |
1121 | return c; | 1113 | return c; |
1122 | } | 1114 | } |
@@ -1139,10 +1131,6 @@ client_request_agent(const char *request_type, int rchan) | |||
1139 | SSH_CHANNEL_OPEN, sock, sock, -1, | 1131 | SSH_CHANNEL_OPEN, sock, sock, -1, |
1140 | CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, | 1132 | CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, |
1141 | xstrdup("authentication agent connection"), 1); | 1133 | xstrdup("authentication agent connection"), 1); |
1142 | if (c == NULL) { | ||
1143 | error("client_request_agent: channel_new failed"); | ||
1144 | close(sock); | ||
1145 | } | ||
1146 | c->force_drain = 1; | 1134 | c->force_drain = 1; |
1147 | return c; | 1135 | return c; |
1148 | } | 1136 | } |
diff --git a/serverloop.c b/serverloop.c index b8a5f1608..46b12ee3d 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: serverloop.c,v 1.97 2002/02/03 17:53:25 markus Exp $"); | 38 | RCSID("$OpenBSD: serverloop.c,v 1.98 2002/02/06 14:55:16 markus Exp $"); |
39 | 39 | ||
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
41 | #include "packet.h" | 41 | #include "packet.h" |
@@ -870,10 +870,6 @@ server_request_direct_tcpip(char *ctype) | |||
870 | c = channel_new(ctype, SSH_CHANNEL_CONNECTING, | 870 | c = channel_new(ctype, SSH_CHANNEL_CONNECTING, |
871 | sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT, | 871 | sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT, |
872 | CHAN_TCP_PACKET_DEFAULT, 0, xstrdup("direct-tcpip"), 1); | 872 | CHAN_TCP_PACKET_DEFAULT, 0, xstrdup("direct-tcpip"), 1); |
873 | if (c == NULL) { | ||
874 | error("server_request_direct_tcpip: channel_new failed"); | ||
875 | close(sock); | ||
876 | } | ||
877 | return c; | 873 | return c; |
878 | } | 874 | } |
879 | 875 | ||
@@ -893,10 +889,6 @@ server_request_session(char *ctype) | |||
893 | c = channel_new(ctype, SSH_CHANNEL_LARVAL, | 889 | c = channel_new(ctype, SSH_CHANNEL_LARVAL, |
894 | -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT, | 890 | -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT, |
895 | 0, xstrdup("server-session"), 1); | 891 | 0, xstrdup("server-session"), 1); |
896 | if (c == NULL) { | ||
897 | error("server_request_session: channel_new failed"); | ||
898 | return NULL; | ||
899 | } | ||
900 | if (session_open(xxx_authctxt, c->self) != 1) { | 892 | if (session_open(xxx_authctxt, c->self) != 1) { |
901 | debug("session open failed, free channel %d", c->self); | 893 | debug("session open failed, free channel %d", c->self); |
902 | channel_free(c); | 894 | channel_free(c); |
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "includes.h" | 41 | #include "includes.h" |
42 | RCSID("$OpenBSD: ssh.c,v 1.161 2002/02/05 14:32:55 markus Exp $"); | 42 | RCSID("$OpenBSD: ssh.c,v 1.162 2002/02/06 14:55:16 markus Exp $"); |
43 | 43 | ||
44 | #include <openssl/evp.h> | 44 | #include <openssl/evp.h> |
45 | #include <openssl/err.h> | 45 | #include <openssl/err.h> |
@@ -1155,8 +1155,6 @@ ssh_session2_open(void) | |||
1155 | "session", SSH_CHANNEL_OPENING, in, out, err, | 1155 | "session", SSH_CHANNEL_OPENING, in, out, err, |
1156 | window, packetmax, CHAN_EXTENDED_WRITE, | 1156 | window, packetmax, CHAN_EXTENDED_WRITE, |
1157 | xstrdup("client-session"), /*nonblock*/0); | 1157 | xstrdup("client-session"), /*nonblock*/0); |
1158 | if (c == NULL) | ||
1159 | fatal("ssh_session2_open: channel_new failed"); | ||
1160 | 1158 | ||
1161 | debug3("ssh_session2_open: channel_new: %d", c->self); | 1159 | debug3("ssh_session2_open: channel_new: %d", c->self); |
1162 | 1160 | ||