diff --git a/tmate-auth-keys.c b/tmate-auth-keys.c index 5f81dde2..f390b837 100644 --- a/tmate-auth-keys.c +++ b/tmate-auth-keys.c @@ -80,7 +80,7 @@ static void tmate_set(char *key, char *value) append_authorized_key(value); } -void tmate_hook_set_option(const char *name, const char *val) +void tmate_hook_set_option_auth(const char *name, const char *val) { if (!strcmp(name, "tmate-authorized-keys")) { reset_and_enable_authorized_keys(); diff --git a/tmate-ssh-daemon.c b/tmate-ssh-daemon.c index 5cde64a3..77ecd1fe 100644 --- a/tmate-ssh-daemon.c +++ b/tmate-ssh-daemon.c @@ -185,3 +185,27 @@ void tmate_spawn_daemon(struct tmate_session *session) server_start(session->ev_base, -1, NULL); /* never reached */ } + +static void handle_session_name_options(const char *name, __unused const char *val) +{ + if (tmate_has_websocket()) + return; + + if (!strcmp(name, "tmate-account-key") || + !strcmp(name, "tmate-session-name") || + !strcmp(name, "tmate-session-name-ro")) { + static bool warned; + if (!warned) { + tmate_warn("/!\\ Named sessions are not supported without the websocket server"); + tmate_notify("/!\\ Named sessions are not supported without the websocket server"); + } + warned = true; + } +} + +void tmate_hook_set_option(const char *name, const char *val) +{ + tmate_hook_set_option_auth(name, val); + handle_session_name_options(name, val); + +} diff --git a/tmate.h b/tmate.h index 67bf714d..71bdcdd6 100644 --- a/tmate.h +++ b/tmate.h @@ -34,7 +34,7 @@ extern void printflike(2, 3) tmate_log(int level, const char *msg, ...); }) /* tmate-auth-keys.c */ -extern void tmate_hook_set_option(const char *name, const char *val); +extern void tmate_hook_set_option_auth(const char *name, const char *val); extern bool tmate_allow_auth(const char *pubkey); extern bool would_tmate_session_allow_auth(const char *token, const char *pubkey); extern int get_num_authorized_keys(ssh_key *keys); @@ -134,6 +134,7 @@ extern void tmate_dispatch_daemon_message(struct tmate_session *session, #define TMATE_KEYFRAME_MAX_SIZE 1024*1024 extern void tmate_spawn_daemon(struct tmate_session *session); +extern void tmate_hook_set_option(const char *name, const char *val); /* tmate-ssh-exec.c */ extern void tmate_spawn_exec(struct tmate_session *session);