Skip to content
Snippets Groups Projects
Commit aa026a45 authored by Niels Möller's avatar Niels Möller
Browse files

* src/client_session.c (client_read_stdin): New function, for

installing the escape-char handler on stdin.
(do_client_io): Use client_read_stdin.
(make_client_session_channel): Added argument escape.

Rev: src/client_session.c:1.10
parent f68e20a7
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "channel_commands.h" #include "channel_commands.h"
#include "client.h" #include "client.h"
#include "io.h" #include "io.h"
#include "read_data.h"
#include "ssh.h" #include "ssh.h"
#include "werror.h" #include "werror.h"
#include "xalloc.h" #include "xalloc.h"
...@@ -46,6 +47,8 @@ ...@@ -46,6 +47,8 @@
(out object lsh_fd) (out object lsh_fd)
(err object lsh_fd) (err object lsh_fd)
; Escape char handling
(escape object escape_info)
; Where to save the exit code. ; Where to save the exit code.
(exit_status . "int *"))) (exit_status . "int *")))
*/ */
...@@ -106,20 +109,16 @@ do_send_adjust(struct ssh_channel *s, ...@@ -106,20 +109,16 @@ do_send_adjust(struct ssh_channel *s,
/* Escape char handling */ /* Escape char handling */
#if 0
static struct io_callback * static struct io_callback *
make_channel_read_stdin(struct ssh_channel *channel) client_read_stdin(struct client_session_channel *session)
{ {
/* byte SSH_MSG_CHANNEL_DATA struct abstract_write *write = make_channel_write(&session->super);
* uint32 recipient channel
* string data if (session->escape)
* write = make_handle_escape(session->escape, write);
* gives 9 bytes of overhead, including the length field. */
return make_read_data(channel, return make_read_data(&session->super, write);
make_handle_escape(make_channel_write(channel)));
} }
#endif
/* We have a remote shell */ /* We have a remote shell */
static void static void
...@@ -156,9 +155,8 @@ do_client_io(struct command *s UNUSED, ...@@ -156,9 +155,8 @@ do_client_io(struct command *s UNUSED,
/* Set up the fd we read from. */ /* Set up the fd we read from. */
channel->send_adjust = do_send_adjust; channel->send_adjust = do_send_adjust;
/* FIXME: This is probably the right place to insert a /* Setup escape char handler, if appropriate. */
* escape-character handler. */ session->in->read = client_read_stdin(session);
session->in->read = make_channel_read_data(channel);
/* FIXME: Perhaps there is some way to arrange that channel.c calls /* FIXME: Perhaps there is some way to arrange that channel.c calls
* the CHANNEL_SEND_ADJUST method instead? */ * the CHANNEL_SEND_ADJUST method instead? */
...@@ -191,6 +189,7 @@ struct ssh_channel * ...@@ -191,6 +189,7 @@ struct ssh_channel *
make_client_session_channel(struct lsh_fd *in, make_client_session_channel(struct lsh_fd *in,
struct lsh_fd *out, struct lsh_fd *out,
struct lsh_fd *err, struct lsh_fd *err,
struct escape_info *escape,
UINT32 initial_window, UINT32 initial_window,
int *exit_status) int *exit_status)
{ {
...@@ -213,6 +212,7 @@ make_client_session_channel(struct lsh_fd *in, ...@@ -213,6 +212,7 @@ make_client_session_channel(struct lsh_fd *in,
self->in = in; self->in = in;
self->out = out; self->out = out;
self->err = err; self->err = err;
self->escape = escape;
REMEMBER_RESOURCE(self->super.resources, &in->super); REMEMBER_RESOURCE(self->super.resources, &in->super);
REMEMBER_RESOURCE(self->super.resources, &out->super); REMEMBER_RESOURCE(self->super.resources, &out->super);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment