GUACAMOLE-422: Support timezone redirection in RDP via TZ variable.
diff --git a/src/protocols/rdp/rdp_settings.c b/src/protocols/rdp/rdp_settings.c
index a3bd348..21114d4 100644
--- a/src/protocols/rdp/rdp_settings.c
+++ b/src/protocols/rdp/rdp_settings.c
@@ -79,6 +79,7 @@
     "disable-glyph-caching",
     "preconnection-id",
     "preconnection-blob",
+    "timezone",
 
 #ifdef ENABLE_COMMON_SSH
     "enable-sftp",
@@ -356,6 +357,11 @@
      */
     IDX_PRECONNECTION_BLOB,
 
+    /**
+     * The timezone to pass through to the RDP connection.
+     */
+    IDX_TIMEZONE,
+
 #ifdef ENABLE_COMMON_SSH
     /**
      * "true" if SFTP should be enabled for the RDP connection, "false" or
@@ -840,6 +846,11 @@
     if (settings->server_layout == NULL)
         settings->server_layout = guac_rdp_keymap_find(GUAC_DEFAULT_KEYMAP);
 
+    /* Timezone if provied by client */
+    settings->timezone =
+        guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
+                IDX_TIMEZONE, NULL);
+
 #ifdef ENABLE_COMMON_SSH
     /* SFTP enable/disable */
     settings->enable_sftp =
@@ -1013,6 +1024,7 @@
     free(settings->remote_app);
     free(settings->remote_app_args);
     free(settings->remote_app_dir);
+    free(settings->timezone);
     free(settings->username);
     free(settings->printer_name);
 
@@ -1265,6 +1277,9 @@
 #endif
 
     /* Device redirection */
+    if (guac_settings->timezone)
+        setenv("TZ", guac_settings->timezone, 1);
+
 #ifdef LEGACY_RDPSETTINGS
 #ifdef HAVE_RDPSETTINGS_DEVICEREDIRECTION
     rdp_settings->device_redirection =  guac_settings->audio_enabled
diff --git a/src/protocols/rdp/rdp_settings.h b/src/protocols/rdp/rdp_settings.h
index d521a87..ece399d 100644
--- a/src/protocols/rdp/rdp_settings.h
+++ b/src/protocols/rdp/rdp_settings.h
@@ -341,6 +341,11 @@
      */
     char* preconnection_blob;
 
+    /**
+     * The timezone to pass through to the RDP connection.
+     */
+    char* timezone;
+
 #ifdef ENABLE_COMMON_SSH
     /**
      * Whether SFTP should be enabled for the VNC connection.