summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2002-02-06 14:55:17 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2002-02-06 14:55:17 +0000
commitbaad33b3fa533fb5f377050449ddf405733e7693 (patch)
treec14fa004f716b11f237bef4453af25d93bed94e9 /usr.bin
parent5ee62c8b71b9e656ebc7c8d99367142fb8359dc0 (diff)
channel_new never returns NULL, mouring@; ok djm@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/channels.c58
-rw-r--r--usr.bin/ssh/clientloop.c14
-rw-r--r--usr.bin/ssh/serverloop.c10
-rw-r--r--usr.bin/ssh/ssh.c4
4 files changed, 10 insertions, 76 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c
index 8847785d582..babb9c47b40 100644
--- a/usr.bin/ssh/channels.c
+++ b/usr.bin/ssh/channels.c
@@ -39,7 +39,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.166 2002/02/05 14:32:55 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.167 2002/02/06 14:55:15 markus Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -1004,11 +1004,6 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
SSH_CHANNEL_OPENING, newsock, newsock, -1,
c->local_window_max, c->local_maxpacket,
0, xstrdup(buf), 1);
- if (nc == NULL) {
- close(newsock);
- xfree(remote_ipaddr);
- return;
- }
if (compat20) {
packet_start(SSH2_MSG_CHANNEL_OPEN);
packet_put_cstring("x11");
@@ -1126,11 +1121,6 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset)
nextstate, newsock, newsock, -1,
c->local_window_max, c->local_maxpacket,
0, xstrdup(rtype), 1);
- if (nc == NULL) {
- error("channel_post_port_listener: no new channel:");
- close(newsock);
- return;
- }
nc->listening_port = c->listening_port;
nc->host_port = c->host_port;
strlcpy(nc->path, c->path, sizeof(nc->path));
@@ -1173,11 +1163,6 @@ channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset)
SSH_CHANNEL_OPENING, newsock, newsock, -1,
c->local_window_max, c->local_maxpacket,
0, name, 1);
- if (nc == NULL) {
- error("channel_post_auth_listener: channel_new failed");
- xfree(name);
- close(newsock);
- }
if (compat20) {
packet_start(SSH2_MSG_CHANNEL_OPEN);
packet_put_cstring("auth-agent@openssh.com");
@@ -1977,12 +1962,7 @@ channel_input_port_open(int type, u_int32_t seq, void *ctxt)
c = channel_new("connected socket",
SSH_CHANNEL_CONNECTING, sock, sock, -1, 0, 0, 0,
originator_string, 1);
- if (c == NULL) {
- error("channel_input_port_open: channel_new failed");
- close(sock);
- } else {
- c->remote_id = remote_id;
- }
+ c->remote_id = remote_id;
}
if (c == NULL) {
packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE);
@@ -2079,11 +2059,6 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
c = channel_new("port listener", type, sock, sock, -1,
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
0, xstrdup("port listener"), 1);
- if (c == NULL) {
- error("channel_setup_fwd_listener: channel_new failed");
- close(sock);
- continue;
- }
strlcpy(c->path, host, sizeof(c->path));
c->host_port = port_to_connect;
c->listening_port = listen_port;
@@ -2407,8 +2382,7 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
0, xstrdup("X11 inet listener"), 1);
- if (nc != NULL)
- nc->single_connection = single_connection;
+ nc->single_connection = single_connection;
}
/* Return the display number for the DISPLAY environment variable. */
@@ -2560,13 +2534,8 @@ x11_input_open(int type, u_int32_t seq, void *ctxt)
c = channel_new("connected x11 socket",
SSH_CHANNEL_X11_OPEN, sock, sock, -1, 0, 0, 0,
remote_host, 1);
- if (c == NULL) {
- error("x11_input_open: channel_new failed");
- close(sock);
- } else {
- c->remote_id = remote_id;
- c->force_drain = 1;
- }
+ c->remote_id = remote_id;
+ c->force_drain = 1;
}
if (c == NULL) {
/* Send refusal to the remote host. */
@@ -2780,13 +2749,6 @@ auth_input_request_forwarding(struct passwd * pw)
SSH_CHANNEL_AUTH_SOCKET, sock, sock, -1,
CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
0, xstrdup("auth socket"), 1);
- if (nc == NULL) {
- error("auth_input_request_forwarding: channel_new failed");
- auth_sock_cleanup_proc(pw);
- fatal_remove_cleanup(auth_sock_cleanup_proc, pw);
- close(sock);
- return 0;
- }
strlcpy(nc->path, auth_sock_name, sizeof(nc->path));
return 1;
}
@@ -2820,14 +2782,8 @@ auth_input_open_request(int type, u_int32_t seq, void *ctxt)
name = xstrdup("authentication agent connection");
c = channel_new("", SSH_CHANNEL_OPEN, sock, sock,
-1, 0, 0, 0, name, 1);
- if (c == NULL) {
- error("auth_input_open_request: channel_new failed");
- xfree(name);
- close(sock);
- } else {
- c->remote_id = remote_id;
- c->force_drain = 1;
- }
+ c->remote_id = remote_id;
+ c->force_drain = 1;
}
if (c == NULL) {
packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE);
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c
index 1b9c28e9d46..65a6682a68e 100644
--- a/usr.bin/ssh/clientloop.c
+++ b/usr.bin/ssh/clientloop.c
@@ -59,7 +59,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: clientloop.c,v 1.95 2002/01/10 11:24:04 markus Exp $");
+RCSID("$OpenBSD: clientloop.c,v 1.96 2002/02/06 14:55:15 markus Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -1072,10 +1072,6 @@ client_request_forwarded_tcpip(const char *request_type, int rchan)
SSH_CHANNEL_CONNECTING, sock, sock, -1,
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0,
xstrdup(originator_address), 1);
- if (c == NULL) {
- error("client_request_forwarded_tcpip: channel_new failed");
- close(sock);
- }
xfree(originator_address);
xfree(listen_address);
return c;
@@ -1113,10 +1109,6 @@ client_request_x11(const char *request_type, int rchan)
SSH_CHANNEL_X11_OPEN, sock, sock, -1,
CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0,
xstrdup("x11"), 1);
- if (c == NULL) {
- error("client_request_x11: channel_new failed");
- close(sock);
- }
c->force_drain = 1;
return c;
}
@@ -1139,10 +1131,6 @@ client_request_agent(const char *request_type, int rchan)
SSH_CHANNEL_OPEN, sock, sock, -1,
CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0,
xstrdup("authentication agent connection"), 1);
- if (c == NULL) {
- error("client_request_agent: channel_new failed");
- close(sock);
- }
c->force_drain = 1;
return c;
}
diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c
index db2e29f5bc0..5dd8a715ca9 100644
--- a/usr.bin/ssh/serverloop.c
+++ b/usr.bin/ssh/serverloop.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: serverloop.c,v 1.97 2002/02/03 17:53:25 markus Exp $");
+RCSID("$OpenBSD: serverloop.c,v 1.98 2002/02/06 14:55:16 markus Exp $");
#include "xmalloc.h"
#include "packet.h"
@@ -870,10 +870,6 @@ server_request_direct_tcpip(char *ctype)
c = channel_new(ctype, SSH_CHANNEL_CONNECTING,
sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT,
CHAN_TCP_PACKET_DEFAULT, 0, xstrdup("direct-tcpip"), 1);
- if (c == NULL) {
- error("server_request_direct_tcpip: channel_new failed");
- close(sock);
- }
return c;
}
@@ -893,10 +889,6 @@ server_request_session(char *ctype)
c = channel_new(ctype, SSH_CHANNEL_LARVAL,
-1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT,
0, xstrdup("server-session"), 1);
- if (c == NULL) {
- error("server_request_session: channel_new failed");
- return NULL;
- }
if (session_open(xxx_authctxt, c->self) != 1) {
debug("session open failed, free channel %d", c->self);
channel_free(c);
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index 1e9d2c8070b..84f53f8a5ba 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -39,7 +39,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.161 2002/02/05 14:32:55 markus Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.162 2002/02/06 14:55:16 markus Exp $");
#include <openssl/evp.h>
#include <openssl/err.h>
@@ -1135,8 +1135,6 @@ ssh_session2_open(void)
"session", SSH_CHANNEL_OPENING, in, out, err,
window, packetmax, CHAN_EXTENDED_WRITE,
xstrdup("client-session"), /*nonblock*/0);
- if (c == NULL)
- fatal("ssh_session2_open: channel_new failed");
debug3("ssh_session2_open: channel_new: %d", c->self);