Skip to content

Commit

Permalink
GUACAMOLE-1846: Check for NULLs before attempting to sync state in jo…
Browse files Browse the repository at this point in the history
…in pending handlers.
  • Loading branch information
jmuehlner committed Sep 29, 2023
1 parent 125e33c commit cf6d80b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 17 deletions.
10 changes: 6 additions & 4 deletions src/protocols/kubernetes/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ static int guac_kubernetes_join_pending_handler(guac_client* client) {
(guac_kubernetes_client*) client->data;

/* Synchronize the terminal state to all pending users */
guac_socket* broadcast_socket = client->pending_socket;
guac_terminal_sync_users(kubernetes_client->term, client, broadcast_socket);
guac_kubernetes_send_current_argv_batch(client, broadcast_socket);
guac_socket_flush(broadcast_socket);
if (kubernetes_client->term != NULL) {
guac_socket* broadcast_socket = client->pending_socket;
guac_terminal_sync_users(kubernetes_client->term, client, broadcast_socket);
guac_kubernetes_send_current_argv_batch(client, broadcast_socket);
guac_socket_flush(broadcast_socket);
}

return 0;

Expand Down
7 changes: 4 additions & 3 deletions src/protocols/rdp/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ static int guac_rdp_join_pending_handler(guac_client* client) {
guac_rdp_pipe_svc_send_pipes(client, broadcast_socket);

/* Synchronize with current display */
guac_common_display_dup(rdp_client->display, client, broadcast_socket);

guac_socket_flush(broadcast_socket);
if (rdp_client->display != NULL) {
guac_common_display_dup(rdp_client->display, client, broadcast_socket);
guac_socket_flush(broadcast_socket);
}

return 0;

Expand Down
10 changes: 6 additions & 4 deletions src/protocols/ssh/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ static int guac_ssh_join_pending_handler(guac_client* client) {
guac_ssh_client* ssh_client = (guac_ssh_client*) client->data;

/* Synchronize the terminal state to all pending users */
guac_socket* broadcast_socket = client->pending_socket;
guac_terminal_sync_users(ssh_client->term, client, broadcast_socket);
guac_ssh_send_current_argv_batch(client, broadcast_socket);
guac_socket_flush(broadcast_socket);
if (ssh_client->term != NULL) {
guac_socket* broadcast_socket = client->pending_socket;
guac_terminal_sync_users(ssh_client->term, client, broadcast_socket);
guac_ssh_send_current_argv_batch(client, broadcast_socket);
guac_socket_flush(broadcast_socket);
}

return 0;

Expand Down
10 changes: 6 additions & 4 deletions src/protocols/telnet/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ static int guac_telnet_join_pending_handler(guac_client* client) {
guac_telnet_client* telnet_client = (guac_telnet_client*) client->data;

/* Synchronize the terminal state to all pending users */
guac_socket* broadcast_socket = client->pending_socket;
guac_terminal_sync_users(telnet_client->term, client, broadcast_socket);
guac_telnet_send_current_argv_batch(client, broadcast_socket);
guac_socket_flush(broadcast_socket);
if (telnet_client->term != NULL) {
guac_socket* broadcast_socket = client->pending_socket;
guac_terminal_sync_users(telnet_client->term, client, broadcast_socket);
guac_telnet_send_current_argv_batch(client, broadcast_socket);
guac_socket_flush(broadcast_socket);
}

return 0;

Expand Down
6 changes: 4 additions & 2 deletions src/protocols/vnc/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ static int guac_vnc_join_pending_handler(guac_client* client) {
#endif

/* Synchronize with current display */
guac_common_display_dup(vnc_client->display, client, broadcast_socket);
guac_socket_flush(broadcast_socket);
if (vnc_client->display != NULL) {
guac_common_display_dup(vnc_client->display, client, broadcast_socket);
guac_socket_flush(broadcast_socket);
}

return 0;

Expand Down

0 comments on commit cf6d80b

Please sign in to comment.