mike-jumper commented on a change in pull request #219: GUACAMOLE-422: Add
timezone to client handshake
URL: https://github.com/apache/guacamole-server/pull/219#discussion_r270507864
##########
File path: src/libguac/user-handshake.c
##########
@@ -171,6 +171,80 @@ static void guac_free_mimetypes(char** mimetypes) {
}
+/* Guacamole handshake handler functions. */
+
+int __guac_handshake_size_handler(guac_user* user, int argc, char** argv) {
+
+ /* Validate size of instruction. */
+ if (argc < 2) {
+ guac_user_log(user, GUAC_LOG_ERROR, "Received \"size\" "
+ "instruction lacked required arguments.");
+ return 1;
+ }
+
+ /* Parse optimal screen dimensions from size instruction */
+ user->info.optimal_width = atoi(argv[0]);
+ user->info.optimal_height = atoi(argv[1]);
+
+ /* If DPI given, set the user resolution */
+ if (argc >= 3)
+ user->info.optimal_resolution = atoi(argv[2]);
+
+ /* Otherwise, use a safe default for rough backwards compatibility */
+ else
+ user->info.optimal_resolution = 96;
+
+ return 0;
+
+}
+
+int __guac_handshake_audio_handler(guac_user* user, int argc, char** argv) {
+
+ /* Store audio mimetypes */
+ user->info.audio_mimetypes = (const char**) guac_copy_mimetypes(argv,
argc);
+
+ return 0;
+
+}
+
+int __guac_handshake_video_handler(guac_user* user, int argc, char** argv) {
+
+ /* Store video mimetypes */
+ user->info.video_mimetypes = (const char**) guac_copy_mimetypes(argv,
argc);
Review comment:
If `video` is received twice, this will leak memory. The previous value, if
any, will need to be freed before assigning a new value.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services