GUACAMOLE-422: Use timezone from handshake when parameter does not exist.
diff --git a/src/libguac/guacamole/user.h b/src/libguac/guacamole/user.h
index 75accdb..adc4c4e 100644
--- a/src/libguac/guacamole/user.h
+++ b/src/libguac/guacamole/user.h
@@ -94,7 +94,7 @@
* a specific timezone then this will be NULL. The format of the timezone
* is the standard tzdata naming convention.
*/
- const char** timezone;
+ const char* timezone;
};
diff --git a/src/libguac/user-handshake.c b/src/libguac/user-handshake.c
index 8735405..b0a9b2f 100644
--- a/src/libguac/user-handshake.c
+++ b/src/libguac/user-handshake.c
@@ -406,9 +406,10 @@
return 1;
}
- /* Store timezone */
- char** timezone = parser->argv[0];
- user->info.timezone = (const char**) timezone;
+ /* Store timezone, if present */
+ char* timezone = parser->argv[0];
+ if (timezone != NULL && !strcmp(timezone, ""))
+ user->info.timezone = (const char*) timezone;
/* Get args from connect instruction */
if (guac_parser_expect(parser, socket, usec_timeout, "connect")) {
@@ -452,6 +453,10 @@
guac_free_mimetypes(audio_mimetypes);
guac_free_mimetypes(video_mimetypes);
guac_free_mimetypes(image_mimetypes);
+
+ /* Free timezone */
+ if (timezone != NULL)
+ free(timezone);
guac_parser_free(parser);
diff --git a/src/protocols/rdp/rdp_settings.c b/src/protocols/rdp/rdp_settings.c
index d322a48..e5aa85d 100644
--- a/src/protocols/rdp/rdp_settings.c
+++ b/src/protocols/rdp/rdp_settings.c
@@ -851,10 +851,10 @@
if (settings->server_layout == NULL)
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 =
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
- IDX_TIMEZONE, NULL);
+ IDX_TIMEZONE, user->info.timezone);
#ifdef ENABLE_COMMON_SSH
/* SFTP enable/disable */
diff --git a/src/protocols/ssh/settings.c b/src/protocols/ssh/settings.c
index 962524c..74706e0 100644
--- a/src/protocols/ssh/settings.c
+++ b/src/protocols/ssh/settings.c
@@ -425,6 +425,10 @@
settings->timezone =
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
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 */
return settings;