Commit 509c8a5f authored by Niels Möller's avatar Niels Möller
Browse files

* src/io.c (kill_io_fd_resource): New function, replacing

kill_io_connect_state and kill_io_listen_port.
(init_io_connect_state): Updated for new super class
io_fd_resource.
(oop_io_connect): Likewise.
(io_connect): Likewise.
(init_io_listen_port): Likewise.
(oop_io_accept): Likewise.
(io_listen): Likewise.
* src/client_tcpforward.c (do_forward_local_port): Likewise.
* src/client_x11.c (x11_connect): Likewise.
* src/gateway.c (do_gateway_port_accept): Likewise.
(make_gateway_port): Likewise.
* src/server_session.c (do_kill_server_session): Likewise.
* src/server_tcpforward.c (make_server_forward): Likewise.
* src/server_x11.c (do_kill_x11_listen_port): Likewise.
(do_x11_listen_port_accept): Likewise.
(make_x11_listen_port): Likewise.
(server_x11_setup): Likewise.
* src/socks.c (do_make_socks_server): Likewise.
* src/tcpforward.c (tcpforward_connect): Likewise.

Rev: src/server_tcpforward.c:1.9
Rev: src/server_x11.c:1.26
Rev: src/socks.c:1.10
Rev: src/tcpforward.c:1.75
parent 0ebe1df5
...@@ -64,7 +64,7 @@ make_server_forward(struct ssh_connection *connection, ...@@ -64,7 +64,7 @@ make_server_forward(struct ssh_connection *connection,
if (!io_listen(port)) if (!io_listen(port))
{ {
KILL_RESOURCE(&port->super); KILL_RESOURCE(&port->super.super);
return NULL; return NULL;
} }
else else
...@@ -72,7 +72,7 @@ make_server_forward(struct ssh_connection *connection, ...@@ -72,7 +72,7 @@ make_server_forward(struct ssh_connection *connection,
NEW(server_forward, self); NEW(server_forward, self);
self->super.address = address; self->super.address = address;
self->port = &port->super; self->port = &port->super.super;
remember_resource(connection->resources, self->port); remember_resource(connection->resources, self->port);
......
...@@ -82,10 +82,10 @@ do_kill_x11_listen_port(struct resource *s) ...@@ -82,10 +82,10 @@ do_kill_x11_listen_port(struct resource *s)
CAST(x11_listen_port, self, s); CAST(x11_listen_port, self, s);
int old_cd; int old_cd;
if (self->super.super.alive) if (self->super.super.super.alive)
{ {
self->super.super.alive = 0; self->super.super.super.alive = 0;
io_close_fd(self->super.fd); io_close_fd(self->super.super.fd);
assert(self->dir >= 0); assert(self->dir >= 0);
...@@ -118,7 +118,7 @@ do_x11_listen_port_accept(struct io_listen_port *s, ...@@ -118,7 +118,7 @@ do_x11_listen_port_accept(struct io_listen_port *s,
io_register_fd(fd, "forwarded X11 socket"); io_register_fd(fd, "forwarded X11 socket");
if (self->single) if (self->single)
KILL_RESOURCE(&self->super.super); KILL_RESOURCE(&self->super.super.super);
channel = &make_channel_forward(fd, X11_WINDOW_SIZE)->super; channel = &make_channel_forward(fd, X11_WINDOW_SIZE)->super;
...@@ -144,7 +144,7 @@ make_x11_listen_port(int dir, const struct lsh_string *name, ...@@ -144,7 +144,7 @@ make_x11_listen_port(int dir, const struct lsh_string *name,
{ {
NEW(x11_listen_port, self); NEW(x11_listen_port, self);
init_io_listen_port(&self->super, fd, do_x11_listen_port_accept); init_io_listen_port(&self->super, fd, do_x11_listen_port_accept);
self->super.super.kill = do_kill_x11_listen_port; self->super.super.super.kill = do_kill_x11_listen_port;
self->display = NULL; self->display = NULL;
self->xauthority = NULL; self->xauthority = NULL;
...@@ -315,12 +315,12 @@ server_x11_setup(struct ssh_channel *channel, ...@@ -315,12 +315,12 @@ server_x11_setup(struct ssh_channel *channel,
if (!create_xauth(lsh_get_cstring(port->xauthority), &xa)) if (!create_xauth(lsh_get_cstring(port->xauthority), &xa))
{ {
KILL_RESOURCE(&port->super.super); KILL_RESOURCE(&port->super.super.super);
return NULL; return NULL;
} }
else if (!io_listen(&port->super)) else if (!io_listen(&port->super))
{ {
KILL_RESOURCE(&port->super.super); KILL_RESOURCE(&port->super.super.super);
return NULL; return NULL;
} }
else else
......
...@@ -718,11 +718,11 @@ do_make_socks_server(struct client_connection_action *s, ...@@ -718,11 +718,11 @@ do_make_socks_server(struct client_connection_action *s,
{ {
werror("Listening on local port %S:%i failed: %e\n", werror("Listening on local port %S:%i failed: %e\n",
self->local->ip, self->local->port, errno); self->local->ip, self->local->port, errno);
KILL_RESOURCE(&port->super); KILL_RESOURCE(&port->super.super);
} }
else else
{ {
remember_resource(connection->resources, &port->super); remember_resource(connection->resources, &port->super.super);
} }
} }
......
...@@ -224,6 +224,6 @@ tcpforward_connect(const struct address_info *a, ...@@ -224,6 +224,6 @@ tcpforward_connect(const struct address_info *a,
channel_open_deny(info, SSH_OPEN_CONNECT_FAILED, STRERROR(res)); channel_open_deny(info, SSH_OPEN_CONNECT_FAILED, STRERROR(res));
return NULL; return NULL;
} }
return &self->super.super; return &self->super.super.super;
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment