From 0c7898c55a44ed70e00944defec516eaba9b478a Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 30 Jul 2019 16:19:18 -0700 Subject: [PATCH 1/7] GUACAMOLE-630: Expose terminal font/color configuration changes to connected clients. --- src/protocols/kubernetes/argv.c | 6 ++++++ src/protocols/ssh/argv.c | 6 ++++++ src/protocols/telnet/argv.c | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/src/protocols/kubernetes/argv.c b/src/protocols/kubernetes/argv.c index 0bff3149..e46bb2fd 100644 --- a/src/protocols/kubernetes/argv.c +++ b/src/protocols/kubernetes/argv.c @@ -125,11 +125,15 @@ static int guac_kubernetes_argv_end_handler(guac_user* user, /* Update color scheme */ case GUAC_KUBERNETES_ARGV_SETTING_COLOR_SCHEME: guac_terminal_apply_color_scheme(terminal, argv->buffer); + guac_client_stream_argv(client, client->socket, "text/plain", + "color-scheme", argv->buffer); break; /* Update font name */ case GUAC_KUBERNETES_ARGV_SETTING_FONT_NAME: guac_terminal_apply_font(terminal, argv->buffer, -1, 0); + guac_client_stream_argv(client, client->socket, "text/plain", + "font-name", argv->buffer); break; /* Update font size */ @@ -140,6 +144,8 @@ static int guac_kubernetes_argv_end_handler(guac_user* user, if (size > 0) { guac_terminal_apply_font(terminal, NULL, size, kubernetes_client->settings->resolution); + guac_client_stream_argv(client, client->socket, "text/plain", + "font-size", argv->buffer); } break; diff --git a/src/protocols/ssh/argv.c b/src/protocols/ssh/argv.c index 8db2b242..0a4e6705 100644 --- a/src/protocols/ssh/argv.c +++ b/src/protocols/ssh/argv.c @@ -126,11 +126,15 @@ static int guac_ssh_argv_end_handler(guac_user* user, /* Update color scheme */ case GUAC_SSH_ARGV_SETTING_COLOR_SCHEME: guac_terminal_apply_color_scheme(terminal, argv->buffer); + guac_client_stream_argv(client, client->socket, "text/plain", + "color-scheme", argv->buffer); break; /* Update font name */ case GUAC_SSH_ARGV_SETTING_FONT_NAME: guac_terminal_apply_font(terminal, argv->buffer, -1, 0); + guac_client_stream_argv(client, client->socket, "text/plain", + "font-name", argv->buffer); break; /* Update font size */ @@ -141,6 +145,8 @@ static int guac_ssh_argv_end_handler(guac_user* user, if (size > 0) { guac_terminal_apply_font(terminal, NULL, size, ssh_client->settings->resolution); + guac_client_stream_argv(client, client->socket, "text/plain", + "font-size", argv->buffer); } break; diff --git a/src/protocols/telnet/argv.c b/src/protocols/telnet/argv.c index 450c7f35..5edf060a 100644 --- a/src/protocols/telnet/argv.c +++ b/src/protocols/telnet/argv.c @@ -125,11 +125,15 @@ static int guac_telnet_argv_end_handler(guac_user* user, /* Update color scheme */ case GUAC_TELNET_ARGV_SETTING_COLOR_SCHEME: guac_terminal_apply_color_scheme(terminal, argv->buffer); + guac_client_stream_argv(client, client->socket, "text/plain", + "color-scheme", argv->buffer); break; /* Update font name */ case GUAC_TELNET_ARGV_SETTING_FONT_NAME: guac_terminal_apply_font(terminal, argv->buffer, -1, 0); + guac_client_stream_argv(client, client->socket, "text/plain", + "font-name", argv->buffer); break; /* Update font size */ @@ -140,6 +144,8 @@ static int guac_telnet_argv_end_handler(guac_user* user, if (size > 0) { guac_terminal_apply_font(terminal, NULL, size, telnet_client->settings->resolution); + guac_client_stream_argv(client, client->socket, "text/plain", + "font-size", argv->buffer); } break; From b5191caddc188f151e8fc468261284a7bc7d1305 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 4 Aug 2019 11:37:42 -0700 Subject: [PATCH 2/7] GUACAMOLE-630: Accept pre-defined color schemes in all cases, not just during terminal creation. --- src/terminal/color-scheme.c | 17 +++++++++++++++++ src/terminal/terminal.c | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/terminal/color-scheme.c b/src/terminal/color-scheme.c index f4300196..7c8673ac 100644 --- a/src/terminal/color-scheme.c +++ b/src/terminal/color-scheme.c @@ -196,6 +196,23 @@ void guac_terminal_parse_color_scheme(guac_client* client, guac_terminal_color* background, guac_terminal_color (*palette)[256]) { + /* Special cases. */ + if (color_scheme == NULL || color_scheme[0] == '\0') { + /* guac_terminal_parse_color_scheme defaults to gray-black */ + } + else if (strcmp(color_scheme, GUAC_TERMINAL_SCHEME_GRAY_BLACK) == 0) { + color_scheme = "foreground:color7;background:color0"; + } + else if (strcmp(color_scheme, GUAC_TERMINAL_SCHEME_BLACK_WHITE) == 0) { + color_scheme = "foreground:color0;background:color15"; + } + else if (strcmp(color_scheme, GUAC_TERMINAL_SCHEME_GREEN_BLACK) == 0) { + color_scheme = "foreground:color2;background:color0"; + } + else if (strcmp(color_scheme, GUAC_TERMINAL_SCHEME_WHITE_BLACK) == 0) { + color_scheme = "foreground:color15;background:color0"; + } + /* Set default gray-black color scheme and initial palette. */ *foreground = GUAC_TERMINAL_INITIAL_PALETTE[GUAC_TERMINAL_COLOR_GRAY]; *background = GUAC_TERMINAL_INITIAL_PALETTE[GUAC_TERMINAL_COLOR_BLACK]; diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index cf70f92d..e502586a 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -327,23 +327,6 @@ guac_terminal* guac_terminal_create(guac_client* client, guac_terminal_color (*default_palette)[256] = (guac_terminal_color(*)[256]) malloc(sizeof(guac_terminal_color[256])); - /* Special cases. */ - if (color_scheme == NULL || color_scheme[0] == '\0') { - /* guac_terminal_parse_color_scheme defaults to gray-black */ - } - else if (strcmp(color_scheme, GUAC_TERMINAL_SCHEME_GRAY_BLACK) == 0) { - color_scheme = "foreground:color7;background:color0"; - } - else if (strcmp(color_scheme, GUAC_TERMINAL_SCHEME_BLACK_WHITE) == 0) { - color_scheme = "foreground:color0;background:color15"; - } - else if (strcmp(color_scheme, GUAC_TERMINAL_SCHEME_GREEN_BLACK) == 0) { - color_scheme = "foreground:color2;background:color0"; - } - else if (strcmp(color_scheme, GUAC_TERMINAL_SCHEME_WHITE_BLACK) == 0) { - color_scheme = "foreground:color15;background:color0"; - } - guac_terminal_parse_color_scheme(client, color_scheme, &default_char.attributes.foreground, &default_char.attributes.background, From 0516d599cffc04f0216f8fe444fad2208b2a2877 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 4 Aug 2019 11:45:29 -0700 Subject: [PATCH 3/7] GUACAMOLE-630: Disallow NULL color schemes. A color scheme string should always be provided, even if blank. Disallowing NULL allows assumptions to be made which simplifies the logic surrounding persisting provided configuration values. --- src/terminal/color-scheme.c | 2 +- src/terminal/terminal/terminal.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/terminal/color-scheme.c b/src/terminal/color-scheme.c index 7c8673ac..5df181fa 100644 --- a/src/terminal/color-scheme.c +++ b/src/terminal/color-scheme.c @@ -197,7 +197,7 @@ void guac_terminal_parse_color_scheme(guac_client* client, guac_terminal_color (*palette)[256]) { /* Special cases. */ - if (color_scheme == NULL || color_scheme[0] == '\0') { + if (color_scheme[0] == '\0') { /* guac_terminal_parse_color_scheme defaults to gray-black */ } else if (strcmp(color_scheme, GUAC_TERMINAL_SCHEME_GRAY_BLACK) == 0) { diff --git a/src/terminal/terminal/terminal.h b/src/terminal/terminal/terminal.h index ac1217eb..95a78d8b 100644 --- a/src/terminal/terminal/terminal.h +++ b/src/terminal/terminal/terminal.h @@ -561,8 +561,8 @@ struct guac_terminal { * * @param color_scheme * The name of the color scheme to use. This string must be one of the - * names defined by the GUAC_TERMINAL_SCHEME_* constants. If blank or NULL, - * the default scheme of GUAC_TERMINAL_SCHEME_GRAY_BLACK will be used. If + * names defined by the GUAC_TERMINAL_SCHEME_* constants. If blank, the + * default scheme of GUAC_TERMINAL_SCHEME_GRAY_BLACK will be used. If * invalid, a warning will be logged, and the terminal will fall back on * GUAC_TERMINAL_SCHEME_GRAY_BLACK. * From 4dabea37af81cc5a7152237c3db670df3a65566f Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 4 Aug 2019 11:55:45 -0700 Subject: [PATCH 4/7] GUACAMOLE-630: Allow guac_terminal_parse_color_scheme() to dictate color scheme format. --- src/terminal/terminal/color-scheme.h | 12 +++++++++--- src/terminal/terminal/terminal.h | 7 ++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/terminal/terminal/color-scheme.h b/src/terminal/terminal/color-scheme.h index 962d820d..5417ce1c 100644 --- a/src/terminal/terminal/color-scheme.h +++ b/src/terminal/terminal/color-scheme.h @@ -72,9 +72,15 @@ * The client that the terminal is connected to. * * @param color_scheme - * A semicolon-separated list of name-value pairs, i.e. - * ": [; : [; ...]]". - * For example, "color2: rgb:cc/33/22; background: color5". + * The name of a pre-defined color scheme (one of the + * names defined by the GUAC_TERMINAL_SCHEME_* constants), or + * semicolon-separated list of name-value pairs, i.e. ": [; + * : [; ...]]". For example, "color2: rgb:cc/33/22; + * background: color5". + * + * If blank, the default scheme of GUAC_TERMINAL_SCHEME_GRAY_BLACK will be + * used. If invalid, a warning will be logged, and + * GUAC_TERMINAL_SCHEME_GRAY_BLACK will be used. * * @param[out] foreground * Parsed foreground color. diff --git a/src/terminal/terminal/terminal.h b/src/terminal/terminal/terminal.h index 95a78d8b..c2fd456b 100644 --- a/src/terminal/terminal/terminal.h +++ b/src/terminal/terminal/terminal.h @@ -560,11 +560,8 @@ struct guac_terminal { * The height of the terminal, in pixels. * * @param color_scheme - * The name of the color scheme to use. This string must be one of the - * names defined by the GUAC_TERMINAL_SCHEME_* constants. If blank, the - * default scheme of GUAC_TERMINAL_SCHEME_GRAY_BLACK will be used. If - * invalid, a warning will be logged, and the terminal will fall back on - * GUAC_TERMINAL_SCHEME_GRAY_BLACK. + * The name of the color scheme to use. This string must be in the format + * accepted by guac_terminal_parse_color_scheme(). * * @param backspace * The integer ASCII code to send when backspace is pressed in From ccfcfb116d6dc9cb8881f04d5072796c91619d86 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 4 Aug 2019 12:44:43 -0700 Subject: [PATCH 5/7] GUACAMOLE-630: Persist details of color scheme and font changes. --- src/terminal/terminal.c | 33 ++++++++++++++++++++++++++++++++ src/terminal/terminal/terminal.h | 19 ++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index e502586a..05bf7209 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -343,6 +343,11 @@ guac_terminal* guac_terminal_create(guac_client* client, term->upload_path_handler = NULL; term->file_download_handler = NULL; + /* Copy initially-provided color scheme and font details */ + term->color_scheme = strdup(color_scheme); + term->font_name = strdup(font_name); + term->font_size = font_size; + /* Set size of available screen area */ term->outer_width = width; term->outer_height = height; @@ -511,6 +516,10 @@ void guac_terminal_free(guac_terminal* term) { /* Free scrollbar */ guac_terminal_scrollbar_free(term->scrollbar); + /* Free copies of font and color scheme information */ + free((char*) term->color_scheme); + free((char*) term->font_name); + /* Free the terminal itself */ free(term); @@ -1955,6 +1964,16 @@ void guac_terminal_apply_color_scheme(guac_terminal* terminal, terminal->term_height - 1, terminal->term_width - 1); + /* Acquire exclusive access to terminal */ + guac_terminal_lock(terminal); + + /* Update stored copy of color scheme */ + free((char*) terminal->color_scheme); + terminal->color_scheme = strdup(color_scheme); + + /* Release terminal */ + guac_terminal_unlock(terminal); + guac_terminal_notify(terminal); } @@ -1979,6 +1998,20 @@ void guac_terminal_apply_font(guac_terminal* terminal, const char* font_name, terminal->term_height - 1, terminal->term_width - 1); + /* Acquire exclusive access to terminal */ + guac_terminal_lock(terminal); + + /* Update stored copy of font name, if changed */ + if (font_name != NULL) + terminal->font_name = strdup(font_name); + + /* Update stored copy of font size, if changed */ + if (font_size != -1) + terminal->font_size = font_size; + + /* Release terminal */ + guac_terminal_unlock(terminal); + guac_terminal_notify(terminal); } diff --git a/src/terminal/terminal/terminal.h b/src/terminal/terminal/terminal.h index c2fd456b..e7746cba 100644 --- a/src/terminal/terminal/terminal.h +++ b/src/terminal/terminal/terminal.h @@ -506,6 +506,25 @@ struct guac_terminal { */ guac_common_clipboard* clipboard; + /** + * The name of the font to use when rendering glyphs, as requested at + * creation time or via guac_terminal_apply_font(). + */ + const char* font_name; + + /** + * The size of each glyph, in points, as requested at creation time or via + * guac_terminal_apply_font(). + */ + int font_size; + + /** + * The name of the color scheme to use, as requested at creation time or + * via guac_terminal_apply_color_scheme(). This string must be in the + * format accepted by guac_terminal_parse_color_scheme(). + */ + const char* color_scheme; + /** * ASCII character to send when backspace is pressed. */ From f56df8b8be9ca0f8afd4bec74f9040e03b4eea95 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 4 Aug 2019 12:52:00 -0700 Subject: [PATCH 6/7] GUACAMOLE-630: Automatically send current color scheme and font to users joining SSH, telnet, and Kubernetes connections. --- src/protocols/kubernetes/argv.c | 23 +++++++++++++++++++++++ src/protocols/kubernetes/argv.h | 21 +++++++++++++++++++++ src/protocols/kubernetes/kubernetes.c | 6 ++++++ src/protocols/kubernetes/user.c | 1 + src/protocols/ssh/argv.c | 23 +++++++++++++++++++++++ src/protocols/ssh/argv.h | 20 ++++++++++++++++++++ src/protocols/ssh/ssh.c | 4 ++++ src/protocols/ssh/user.c | 1 + src/protocols/telnet/argv.c | 23 +++++++++++++++++++++++ src/protocols/telnet/argv.h | 20 ++++++++++++++++++++ src/protocols/telnet/telnet.c | 6 ++++++ src/protocols/telnet/user.c | 1 + 12 files changed, 149 insertions(+) diff --git a/src/protocols/kubernetes/argv.c b/src/protocols/kubernetes/argv.c index e46bb2fd..c37595de 100644 --- a/src/protocols/kubernetes/argv.c +++ b/src/protocols/kubernetes/argv.c @@ -199,3 +199,26 @@ int guac_kubernetes_argv_handler(guac_user* user, guac_stream* stream, } +void* guac_kubernetes_send_current_argv(guac_user* user, void* data) { + + guac_kubernetes_client* kubernetes_client = (guac_kubernetes_client*) data; + guac_terminal* terminal = kubernetes_client->term; + + /* Send current color scheme */ + guac_user_stream_argv(user, user->socket, "text/plain", "color-scheme", + terminal->color_scheme); + + /* Send current font name */ + guac_user_stream_argv(user, user->socket, "text/plain", "font-name", + terminal->font_name); + + /* Send current font size */ + char font_size[64]; + sprintf(font_size, "%i", terminal->font_size); + guac_user_stream_argv(user, user->socket, "text/plain", "font-size", + font_size); + + return NULL; + +} + diff --git a/src/protocols/kubernetes/argv.h b/src/protocols/kubernetes/argv.h index da9e11b7..1a23df13 100644 --- a/src/protocols/kubernetes/argv.h +++ b/src/protocols/kubernetes/argv.h @@ -37,5 +37,26 @@ */ guac_user_argv_handler guac_kubernetes_argv_handler; +/** + * Sends the current values of all non-sensitive parameters which may be set + * while the connection is running to the given user. Note that the user + * receiving these values will not necessarily be able to set new values + * themselves if their connection is read-only. This function is provided for + * convenience, as it is can be used as the callback for + * guac_client_foreach_user() or guac_client_for_owner(). + * + * @param user + * The user that should receive the values of all non-sensitive parameters + * which may be set while the connection is running. + * + * @param data + * The guac_kubernetes_client instance associated with the current + * connection. + * + * @return + * Always NULL. + */ +void* guac_kubernetes_send_current_argv(guac_user* user, void* data); + #endif diff --git a/src/protocols/kubernetes/kubernetes.c b/src/protocols/kubernetes/kubernetes.c index 7c22c420..bd84f6ce 100644 --- a/src/protocols/kubernetes/kubernetes.c +++ b/src/protocols/kubernetes/kubernetes.c @@ -18,6 +18,8 @@ */ #include "config.h" + +#include "argv.h" #include "client.h" #include "common/recording.h" #include "io.h" @@ -249,6 +251,10 @@ void* guac_kubernetes_client_thread(void* data) { goto fail; } + /* Send current values of exposed arguments to owner only */ + guac_client_for_owner(client, guac_kubernetes_send_current_argv, + kubernetes_client); + /* Set up typescript, if requested */ if (settings->typescript_path != NULL) { guac_terminal_create_typescript(kubernetes_client->term, diff --git a/src/protocols/kubernetes/user.c b/src/protocols/kubernetes/user.c index a2fdd200..e7f6d8f9 100644 --- a/src/protocols/kubernetes/user.c +++ b/src/protocols/kubernetes/user.c @@ -74,6 +74,7 @@ int guac_kubernetes_user_join_handler(guac_user* user, int argc, char** argv) { /* If not owner, synchronize with current display */ else { guac_terminal_dup(kubernetes_client->term, user, user->socket); + guac_kubernetes_send_current_argv(user, kubernetes_client); guac_socket_flush(user->socket); } diff --git a/src/protocols/ssh/argv.c b/src/protocols/ssh/argv.c index 0a4e6705..d9ce1e75 100644 --- a/src/protocols/ssh/argv.c +++ b/src/protocols/ssh/argv.c @@ -204,3 +204,26 @@ int guac_ssh_argv_handler(guac_user* user, guac_stream* stream, } +void* guac_ssh_send_current_argv(guac_user* user, void* data) { + + guac_ssh_client* ssh_client = (guac_ssh_client*) data; + guac_terminal* terminal = ssh_client->term; + + /* Send current color scheme */ + guac_user_stream_argv(user, user->socket, "text/plain", "color-scheme", + terminal->color_scheme); + + /* Send current font name */ + guac_user_stream_argv(user, user->socket, "text/plain", "font-name", + terminal->font_name); + + /* Send current font size */ + char font_size[64]; + sprintf(font_size, "%i", terminal->font_size); + guac_user_stream_argv(user, user->socket, "text/plain", "font-size", + font_size); + + return NULL; + +} + diff --git a/src/protocols/ssh/argv.h b/src/protocols/ssh/argv.h index 88cf8e97..c7b8559b 100644 --- a/src/protocols/ssh/argv.h +++ b/src/protocols/ssh/argv.h @@ -37,5 +37,25 @@ */ guac_user_argv_handler guac_ssh_argv_handler; +/** + * Sends the current values of all non-sensitive parameters which may be set + * while the connection is running to the given user. Note that the user + * receiving these values will not necessarily be able to set new values + * themselves if their connection is read-only. This function is provided for + * convenience, as it is can be used as the callback for + * guac_client_foreach_user() or guac_client_for_owner(). + * + * @param user + * The user that should receive the values of all non-sensitive parameters + * which may be set while the connection is running. + * + * @param data + * The guac_ssh_client instance associated with the current connection. + * + * @return + * Always NULL. + */ +void* guac_ssh_send_current_argv(guac_user* user, void* data); + #endif diff --git a/src/protocols/ssh/ssh.c b/src/protocols/ssh/ssh.c index 8a18cf4d..456c2140 100644 --- a/src/protocols/ssh/ssh.c +++ b/src/protocols/ssh/ssh.c @@ -19,6 +19,7 @@ #include "config.h" +#include "argv.h" #include "common/recording.h" #include "common-ssh/sftp.h" #include "common-ssh/ssh.h" @@ -233,6 +234,9 @@ void* ssh_client_thread(void* data) { return NULL; } + /* Send current values of exposed arguments to owner only */ + guac_client_for_owner(client, guac_ssh_send_current_argv, ssh_client); + /* Set up typescript, if requested */ if (settings->typescript_path != NULL) { guac_terminal_create_typescript(ssh_client->term, diff --git a/src/protocols/ssh/user.c b/src/protocols/ssh/user.c index 97ed87c6..ccf2447c 100644 --- a/src/protocols/ssh/user.c +++ b/src/protocols/ssh/user.c @@ -74,6 +74,7 @@ int guac_ssh_user_join_handler(guac_user* user, int argc, char** argv) { /* If not owner, synchronize with current display */ else { guac_terminal_dup(ssh_client->term, user, user->socket); + guac_ssh_send_current_argv(user, ssh_client); guac_socket_flush(user->socket); } diff --git a/src/protocols/telnet/argv.c b/src/protocols/telnet/argv.c index 5edf060a..37564a60 100644 --- a/src/protocols/telnet/argv.c +++ b/src/protocols/telnet/argv.c @@ -200,3 +200,26 @@ int guac_telnet_argv_handler(guac_user* user, guac_stream* stream, } +void* guac_telnet_send_current_argv(guac_user* user, void* data) { + + guac_telnet_client* telnet_client = (guac_telnet_client*) data; + guac_terminal* terminal = telnet_client->term; + + /* Send current color scheme */ + guac_user_stream_argv(user, user->socket, "text/plain", "color-scheme", + terminal->color_scheme); + + /* Send current font name */ + guac_user_stream_argv(user, user->socket, "text/plain", "font-name", + terminal->font_name); + + /* Send current font size */ + char font_size[64]; + sprintf(font_size, "%i", terminal->font_size); + guac_user_stream_argv(user, user->socket, "text/plain", "font-size", + font_size); + + return NULL; + +} + diff --git a/src/protocols/telnet/argv.h b/src/protocols/telnet/argv.h index aa13dda9..4bbf8696 100644 --- a/src/protocols/telnet/argv.h +++ b/src/protocols/telnet/argv.h @@ -37,5 +37,25 @@ */ guac_user_argv_handler guac_telnet_argv_handler; +/** + * Sends the current values of all non-sensitive parameters which may be set + * while the connection is running to the given user. Note that the user + * receiving these values will not necessarily be able to set new values + * themselves if their connection is read-only. This function is provided for + * convenience, as it is can be used as the callback for + * guac_client_foreach_user() or guac_client_for_owner(). + * + * @param user + * The user that should receive the values of all non-sensitive parameters + * which may be set while the connection is running. + * + * @param data + * The guac_telnet_client instance associated with the current connection. + * + * @return + * Always NULL. + */ +void* guac_telnet_send_current_argv(guac_user* user, void* data); + #endif diff --git a/src/protocols/telnet/telnet.c b/src/protocols/telnet/telnet.c index 17abd681..e100fae9 100644 --- a/src/protocols/telnet/telnet.c +++ b/src/protocols/telnet/telnet.c @@ -18,6 +18,8 @@ */ #include "config.h" + +#include "argv.h" #include "common/recording.h" #include "telnet.h" #include "terminal/terminal.h" @@ -580,6 +582,10 @@ void* guac_telnet_client_thread(void* data) { return NULL; } + /* Send current values of exposed arguments to owner only */ + guac_client_for_owner(client, guac_telnet_send_current_argv, + telnet_client); + /* Set up typescript, if requested */ if (settings->typescript_path != NULL) { guac_terminal_create_typescript(telnet_client->term, diff --git a/src/protocols/telnet/user.c b/src/protocols/telnet/user.c index 44ef9b5e..08cfc6fe 100644 --- a/src/protocols/telnet/user.c +++ b/src/protocols/telnet/user.c @@ -73,6 +73,7 @@ int guac_telnet_user_join_handler(guac_user* user, int argc, char** argv) { /* If not owner, synchronize with current display */ else { guac_terminal_dup(telnet_client->term, user, user->socket); + guac_telnet_send_current_argv(user, telnet_client); guac_socket_flush(user->socket); } From 43269920dbe429542bd8a4ba9b37401da2839876 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 7 Aug 2019 20:16:01 -0700 Subject: [PATCH 7/7] GUACAMOLE-630: Clarify usage of argv-related guac_user_callback implementations. --- src/protocols/kubernetes/argv.h | 5 ++--- src/protocols/ssh/argv.h | 5 ++--- src/protocols/telnet/argv.h | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/protocols/kubernetes/argv.h b/src/protocols/kubernetes/argv.h index 1a23df13..2fc6c1ba 100644 --- a/src/protocols/kubernetes/argv.h +++ b/src/protocols/kubernetes/argv.h @@ -41,9 +41,8 @@ guac_user_argv_handler guac_kubernetes_argv_handler; * Sends the current values of all non-sensitive parameters which may be set * while the connection is running to the given user. Note that the user * receiving these values will not necessarily be able to set new values - * themselves if their connection is read-only. This function is provided for - * convenience, as it is can be used as the callback for - * guac_client_foreach_user() or guac_client_for_owner(). + * themselves if their connection is read-only. This function can be used as + * the callback for guac_client_foreach_user() and guac_client_for_owner() * * @param user * The user that should receive the values of all non-sensitive parameters diff --git a/src/protocols/ssh/argv.h b/src/protocols/ssh/argv.h index c7b8559b..186e0b5f 100644 --- a/src/protocols/ssh/argv.h +++ b/src/protocols/ssh/argv.h @@ -41,9 +41,8 @@ guac_user_argv_handler guac_ssh_argv_handler; * Sends the current values of all non-sensitive parameters which may be set * while the connection is running to the given user. Note that the user * receiving these values will not necessarily be able to set new values - * themselves if their connection is read-only. This function is provided for - * convenience, as it is can be used as the callback for - * guac_client_foreach_user() or guac_client_for_owner(). + * themselves if their connection is read-only. This function can be used as + * the callback for guac_client_foreach_user() and guac_client_for_owner() * * @param user * The user that should receive the values of all non-sensitive parameters diff --git a/src/protocols/telnet/argv.h b/src/protocols/telnet/argv.h index 4bbf8696..e362e14a 100644 --- a/src/protocols/telnet/argv.h +++ b/src/protocols/telnet/argv.h @@ -41,9 +41,8 @@ guac_user_argv_handler guac_telnet_argv_handler; * Sends the current values of all non-sensitive parameters which may be set * while the connection is running to the given user. Note that the user * receiving these values will not necessarily be able to set new values - * themselves if their connection is read-only. This function is provided for - * convenience, as it is can be used as the callback for - * guac_client_foreach_user() or guac_client_for_owner(). + * themselves if their connection is read-only. This function can be used as + * the callback for guac_client_foreach_user() and guac_client_for_owner() * * @param user * The user that should receive the values of all non-sensitive parameters