GUACAMOLE-422: Add support for passing through TZ in SSH.

This commit is contained in:
Nick Couchman 2018-06-02 12:00:22 -04:00
parent ffdc98d024
commit 5536b836ad
3 changed files with 26 additions and 0 deletions

View File

@ -61,6 +61,7 @@ const char* GUAC_SSH_CLIENT_ARGS[] = {
"terminal-type",
"scrollback",
"locale",
"timezone",
NULL
};
@ -247,6 +248,15 @@ enum SSH_ARGS_IDX {
*/
IDX_LOCALE,
/**
* The timezone that is passed from the client system to the
* remote server, or null if not specified. If set, and allowed
* by the remote SSH server, the TZ environment variable will be
* set on the remote session, causing the session to be localized
* to the specified timezone.
*/
IDX_TIMEZONE,
SSH_ARGS_COUNT
};
@ -410,6 +420,11 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user,
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
IDX_LOCALE, NULL);
/* Read the client timezone. */
settings->timezone =
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
IDX_TIMEZONE, NULL);
/* Parsing was successful */
return settings;
@ -452,6 +467,9 @@ void guac_ssh_settings_free(guac_ssh_settings* settings) {
/* Free locale */
free(settings->locale);
/* Free the client timezone. */
free(settings->timezone);
/* Free overall structure */
free(settings);

View File

@ -253,6 +253,10 @@ typedef struct guac_ssh_settings {
* environment variable.
*/
char* locale;
/**
* The client timezone to pass to the remote system.
*/
char* timezone;
} guac_ssh_settings;

View File

@ -256,6 +256,10 @@ void* ssh_client_thread(void* data) {
return NULL;
}
/* Set the client timezone */
if (settings->timezone != NULL)
libssh2_channel_setenv(ssh_client->term_channel, "TZ", settings->timezone);
#ifdef ENABLE_SSH_AGENT
/* Start SSH agent forwarding, if enabled */
if (ssh_client->enable_agent) {