Commit 3f09492a authored by Niels Möller's avatar Niels Möller
Browse files

(shell_request_handler,

exec_request_handler): Defined as static objects using
DEFINE_CHANNEL_REQUEST. Updated users.

Rev: src/lshd.c:1.126
Rev: src/server_session.c:1.69
Rev: src/server_session.h:1.17
parent d953fbad
...@@ -855,8 +855,8 @@ int main(int argc, char **argv) ...@@ -855,8 +855,8 @@ int main(int argc, char **argv)
/* Supported channel requests */ /* Supported channel requests */
struct alist *supported_channel_requests struct alist *supported_channel_requests
= make_alist(2, = make_alist(2,
ATOM_SHELL, make_shell_handler(), ATOM_SHELL, &shell_request_handler,
ATOM_EXEC, make_exec_handler(), ATOM_EXEC, &exec_request_handler,
-1); -1);
#if WITH_PTY_SUPPORT #if WITH_PTY_SUPPORT
......
...@@ -296,13 +296,6 @@ make_exit_shell(struct server_session *session) ...@@ -296,13 +296,6 @@ make_exit_shell(struct server_session *session)
return &self->super; return &self->super;
} }
/* FIXME: Delete class */
/* GABA:
(class
(name shell_request)
(super channel_request)
(vars ))
*/
static int static int
make_pipes(int *in, int *out, int *err) make_pipes(int *in, int *out, int *err)
...@@ -598,15 +591,14 @@ spawn_process(struct server_session *session, ...@@ -598,15 +591,14 @@ spawn_process(struct server_session *session,
return -1; return -1;
} }
static void DEFINE_CHANNEL_REQUEST(shell_request_handler)
do_spawn_shell(struct channel_request *s, (struct channel_request *s UNUSED,
struct ssh_channel *channel, struct ssh_channel *channel,
struct channel_request_info *info UNUSED, struct channel_request_info *info UNUSED,
struct simple_buffer *args, struct simple_buffer *args,
struct command_continuation *c, struct command_continuation *c,
struct exception_handler *e) struct exception_handler *e)
{ {
CAST(shell_request, closure, s);
CAST(server_session, session, channel); CAST(server_session, session, channel);
static struct exception shell_request_failed = static struct exception shell_request_failed =
...@@ -681,26 +673,14 @@ do_spawn_shell(struct channel_request *s, ...@@ -681,26 +673,14 @@ do_spawn_shell(struct channel_request *s,
EXCEPTION_RAISE(e, &shell_request_failed); EXCEPTION_RAISE(e, &shell_request_failed);
} }
struct channel_request * DEFINE_CHANNEL_REQUEST(exec_request_handler)
make_shell_handler(void) (struct channel_request *s UNUSED,
struct ssh_channel *channel,
struct channel_request_info *info UNUSED,
struct simple_buffer *args,
struct command_continuation *c,
struct exception_handler *e)
{ {
NEW(shell_request, closure);
closure->super.handler = do_spawn_shell;
return &closure->super;
}
static void
do_spawn_exec(struct channel_request *s,
struct ssh_channel *channel,
struct channel_request_info *info UNUSED,
struct simple_buffer *args,
struct command_continuation *c,
struct exception_handler *e)
{
CAST(shell_request, closure, s);
CAST(server_session, session, channel); CAST(server_session, session, channel);
static struct exception exec_request_failed = static struct exception exec_request_failed =
...@@ -787,23 +767,13 @@ do_spawn_exec(struct channel_request *s, ...@@ -787,23 +767,13 @@ do_spawn_exec(struct channel_request *s,
} }
} }
struct channel_request *
make_exec_handler(void)
{
NEW(shell_request, closure);
closure->super.handler = do_spawn_exec;
return &closure->super;
}
/* For simplicity, represent a subsystem simply as a name of the /* For simplicity, represent a subsystem simply as a name of the
* executable. */ * executable. */
/* GABA: /* GABA:
(class (class
(name subsystem_request) (name subsystem_request)
(super shell_request) (super channel_request)
(vars (vars
;(subsystems object alist) ;(subsystems object alist)
; A list { name, program, name, program, NULL } ; A list { name, program, name, program, NULL }
...@@ -908,10 +878,10 @@ make_subsystem_handler(const char **subsystems) ...@@ -908,10 +878,10 @@ make_subsystem_handler(const char **subsystems)
{ {
NEW(subsystem_request, self); NEW(subsystem_request, self);
self->super.super.handler = do_spawn_subsystem; self->super.handler = do_spawn_subsystem;
self->subsystems = subsystems; self->subsystems = subsystems;
return &self->super.super; return &self->super;
} }
......
...@@ -39,12 +39,11 @@ make_server_session(UINT32 initial_window, ...@@ -39,12 +39,11 @@ make_server_session(UINT32 initial_window,
struct channel_open * struct channel_open *
make_open_session(struct alist *session_requests); make_open_session(struct alist *session_requests);
/* FIXME: Use static object? */ extern struct channel_request
struct channel_request * shell_request_handler;
make_shell_handler(void);
struct channel_request * extern struct channel_request
make_exec_handler(void); exec_request_handler;
struct channel_request * struct channel_request *
make_subsystem_handler(const char **subsystems); make_subsystem_handler(const char **subsystems);
......
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