GUACAMOLE-649: Merge add support for setting LANG environment variable via SSH.
This commit is contained in:
commit
e132c79348
@ -60,6 +60,7 @@ const char* GUAC_SSH_CLIENT_ARGS[] = {
|
||||
"backspace",
|
||||
"terminal-type",
|
||||
"scrollback",
|
||||
"locale",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -238,6 +239,14 @@ enum SSH_ARGS_IDX {
|
||||
*/
|
||||
IDX_SCROLLBACK,
|
||||
|
||||
/**
|
||||
* The locale that should be forwarded to the remote system via the LANG
|
||||
* environment variable. By default, no locale is forwarded. This setting
|
||||
* will only have an effect if the SSH server allows the LANG environment
|
||||
* variable to be set.
|
||||
*/
|
||||
IDX_LOCALE,
|
||||
|
||||
SSH_ARGS_COUNT
|
||||
};
|
||||
|
||||
@ -396,6 +405,11 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user,
|
||||
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
|
||||
IDX_TERMINAL_TYPE, "linux");
|
||||
|
||||
/* Read locale */
|
||||
settings->locale =
|
||||
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
|
||||
IDX_LOCALE, NULL);
|
||||
|
||||
/* Parsing was successful */
|
||||
return settings;
|
||||
|
||||
@ -435,6 +449,9 @@ void guac_ssh_settings_free(guac_ssh_settings* settings) {
|
||||
/* Free terminal emulator type. */
|
||||
free(settings->terminal_type);
|
||||
|
||||
/* Free locale */
|
||||
free(settings->locale);
|
||||
|
||||
/* Free overall structure */
|
||||
free(settings);
|
||||
|
||||
|
@ -248,6 +248,12 @@ typedef struct guac_ssh_settings {
|
||||
*/
|
||||
char* terminal_type;
|
||||
|
||||
/**
|
||||
* The locale that should be forwarded to the remote system via the LANG
|
||||
* environment variable.
|
||||
*/
|
||||
char* locale;
|
||||
|
||||
} guac_ssh_settings;
|
||||
|
||||
/**
|
||||
|
@ -320,6 +320,16 @@ void* ssh_client_thread(void* data) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Forward specified locale */
|
||||
if (settings->locale != NULL) {
|
||||
if (libssh2_channel_setenv(ssh_client->term_channel, "LANG",
|
||||
settings->locale)) {
|
||||
guac_client_log(client, GUAC_LOG_WARNING,
|
||||
"Unable to forward locale: SSH server refused to set "
|
||||
"\"LANG\" environment variable.");
|
||||
}
|
||||
}
|
||||
|
||||
/* If a command is specified, run that instead of a shell */
|
||||
if (settings->command != NULL) {
|
||||
if (libssh2_channel_exec(ssh_client->term_channel, settings->command)) {
|
||||
|
Loading…
Reference in New Issue
Block a user