GUACAMOLE-422: Use timezone from handshake when parameter does not exist.

This commit is contained in:
Nick Couchman 2019-03-24 21:55:45 -04:00
parent f70aa4939f
commit 6fae0b4b23
4 changed files with 15 additions and 6 deletions

View File

@ -94,7 +94,7 @@ struct guac_user_info {
* a specific timezone then this will be NULL. The format of the timezone * a specific timezone then this will be NULL. The format of the timezone
* is the standard tzdata naming convention. * is the standard tzdata naming convention.
*/ */
const char** timezone; const char* timezone;
}; };

View File

@ -406,9 +406,10 @@ int guac_user_handle_connection(guac_user* user, int usec_timeout) {
return 1; return 1;
} }
/* Store timezone */ /* Store timezone, if present */
char** timezone = parser->argv[0]; char* timezone = parser->argv[0];
user->info.timezone = (const char**) timezone; if (timezone != NULL && !strcmp(timezone, ""))
user->info.timezone = (const char*) timezone;
/* Get args from connect instruction */ /* Get args from connect instruction */
if (guac_parser_expect(parser, socket, usec_timeout, "connect")) { if (guac_parser_expect(parser, socket, usec_timeout, "connect")) {
@ -452,6 +453,10 @@ int guac_user_handle_connection(guac_user* user, int usec_timeout) {
guac_free_mimetypes(audio_mimetypes); guac_free_mimetypes(audio_mimetypes);
guac_free_mimetypes(video_mimetypes); guac_free_mimetypes(video_mimetypes);
guac_free_mimetypes(image_mimetypes); guac_free_mimetypes(image_mimetypes);
/* Free timezone */
if (timezone != NULL)
free(timezone);
guac_parser_free(parser); guac_parser_free(parser);

View File

@ -851,10 +851,10 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
if (settings->server_layout == NULL) if (settings->server_layout == NULL)
settings->server_layout = guac_rdp_keymap_find(GUAC_DEFAULT_KEYMAP); settings->server_layout = guac_rdp_keymap_find(GUAC_DEFAULT_KEYMAP);
/* Timezone if provied by client */ /* Timezone if provided by client, or use handshake version */
settings->timezone = settings->timezone =
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv, guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_TIMEZONE, NULL); IDX_TIMEZONE, user->info.timezone);
#ifdef ENABLE_COMMON_SSH #ifdef ENABLE_COMMON_SSH
/* SFTP enable/disable */ /* SFTP enable/disable */

View File

@ -425,6 +425,10 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user,
settings->timezone = settings->timezone =
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv, guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
IDX_TIMEZONE, NULL); IDX_TIMEZONE, NULL);
/* If timezone not explicitly set, try to pull from tunnel */
if (settings->timezone == NULL)
settings->timezone = user->info.timezone;
/* Parsing was successful */ /* Parsing was successful */
return settings; return settings;