GUACAMOLE-5: Store connection parameters at user level. Maintain reference to owner's connection parameters at client level.
This commit is contained in:
parent
425f7baa2b
commit
0641ccf601
@ -44,12 +44,9 @@ int guac_rdp_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
|
|
||||||
guac_rdp_client* rdp_client = (guac_rdp_client*) user->client->data;
|
guac_rdp_client* rdp_client = (guac_rdp_client*) user->client->data;
|
||||||
|
|
||||||
/* Connect via RDP if owner */
|
/* Parse provided arguments */
|
||||||
if (user->owner) {
|
guac_rdp_settings* settings = guac_rdp_parse_args(user,
|
||||||
|
argc, (const char**) argv);
|
||||||
/* Parse arguments into client */
|
|
||||||
guac_rdp_settings* settings = rdp_client->settings =
|
|
||||||
guac_rdp_parse_args(user, argc, (const char**) argv);
|
|
||||||
|
|
||||||
/* Fail if settings cannot be parsed */
|
/* Fail if settings cannot be parsed */
|
||||||
if (settings == NULL) {
|
if (settings == NULL) {
|
||||||
@ -58,6 +55,15 @@ int guac_rdp_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Store settings at user level */
|
||||||
|
user->data = settings;
|
||||||
|
|
||||||
|
/* Connect via RDP if owner */
|
||||||
|
if (user->owner) {
|
||||||
|
|
||||||
|
/* Store owner's settings at client level */
|
||||||
|
rdp_client->settings = settings;
|
||||||
|
|
||||||
/* Start client thread */
|
/* Start client thread */
|
||||||
if (pthread_create(&rdp_client->client_thread, NULL,
|
if (pthread_create(&rdp_client->client_thread, NULL,
|
||||||
guac_rdp_client_thread, user->client)) {
|
guac_rdp_client_thread, user->client)) {
|
||||||
@ -131,8 +137,15 @@ int guac_rdp_user_leave_handler(guac_user* user) {
|
|||||||
|
|
||||||
guac_rdp_client* rdp_client = (guac_rdp_client*) user->client->data;
|
guac_rdp_client* rdp_client = (guac_rdp_client*) user->client->data;
|
||||||
|
|
||||||
|
/* Update shared cursor state */
|
||||||
guac_common_cursor_remove_user(rdp_client->display->cursor, user);
|
guac_common_cursor_remove_user(rdp_client->display->cursor, user);
|
||||||
|
|
||||||
|
/* Free settings if not owner (owner settings will be freed with client) */
|
||||||
|
if (!user->owner) {
|
||||||
|
guac_rdp_settings* settings = (guac_rdp_settings*) user->data;
|
||||||
|
guac_rdp_settings_free(settings);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,12 +39,9 @@ int guac_ssh_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
guac_client* client = user->client;
|
guac_client* client = user->client;
|
||||||
guac_ssh_client* ssh_client = (guac_ssh_client*) client->data;
|
guac_ssh_client* ssh_client = (guac_ssh_client*) client->data;
|
||||||
|
|
||||||
/* Connect via SSH if owner */
|
/* Parse provided arguments */
|
||||||
if (user->owner) {
|
guac_ssh_settings* settings = guac_ssh_parse_args(user,
|
||||||
|
argc, (const char**) argv);
|
||||||
/* Parse arguments into client */
|
|
||||||
guac_ssh_settings* settings = ssh_client->settings =
|
|
||||||
guac_ssh_parse_args(user, argc, (const char**) argv);
|
|
||||||
|
|
||||||
/* Fail if settings cannot be parsed */
|
/* Fail if settings cannot be parsed */
|
||||||
if (settings == NULL) {
|
if (settings == NULL) {
|
||||||
@ -53,6 +50,15 @@ int guac_ssh_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Store settings at user level */
|
||||||
|
user->data = settings;
|
||||||
|
|
||||||
|
/* Connect via SSH if owner */
|
||||||
|
if (user->owner) {
|
||||||
|
|
||||||
|
/* Store owner's settings at client level */
|
||||||
|
ssh_client->settings = settings;
|
||||||
|
|
||||||
/* Start client thread */
|
/* Start client thread */
|
||||||
if (pthread_create(&(ssh_client->client_thread), NULL,
|
if (pthread_create(&(ssh_client->client_thread), NULL,
|
||||||
ssh_client_thread, (void*) client)) {
|
ssh_client_thread, (void*) client)) {
|
||||||
@ -86,8 +92,15 @@ int guac_ssh_user_leave_handler(guac_user* user) {
|
|||||||
|
|
||||||
guac_ssh_client* ssh_client = (guac_ssh_client*) user->client->data;
|
guac_ssh_client* ssh_client = (guac_ssh_client*) user->client->data;
|
||||||
|
|
||||||
|
/* Update shared cursor state */
|
||||||
guac_common_cursor_remove_user(ssh_client->term->cursor, user);
|
guac_common_cursor_remove_user(ssh_client->term->cursor, user);
|
||||||
|
|
||||||
|
/* Free settings if not owner (owner settings will be freed with client) */
|
||||||
|
if (!user->owner) {
|
||||||
|
guac_ssh_settings* settings = (guac_ssh_settings*) user->data;
|
||||||
|
guac_ssh_settings_free(settings);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,12 +38,9 @@ int guac_telnet_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
guac_client* client = user->client;
|
guac_client* client = user->client;
|
||||||
guac_telnet_client* telnet_client = (guac_telnet_client*) client->data;
|
guac_telnet_client* telnet_client = (guac_telnet_client*) client->data;
|
||||||
|
|
||||||
/* Connect via telnet if owner */
|
/* Parse provided arguments */
|
||||||
if (user->owner) {
|
guac_telnet_settings* settings = guac_telnet_parse_args(user,
|
||||||
|
argc, (const char**) argv);
|
||||||
/* Parse arguments into client */
|
|
||||||
guac_telnet_settings* settings = telnet_client->settings =
|
|
||||||
guac_telnet_parse_args(user, argc, (const char**) argv);
|
|
||||||
|
|
||||||
/* Fail if settings cannot be parsed */
|
/* Fail if settings cannot be parsed */
|
||||||
if (settings == NULL) {
|
if (settings == NULL) {
|
||||||
@ -52,6 +49,15 @@ int guac_telnet_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Store settings at user level */
|
||||||
|
user->data = settings;
|
||||||
|
|
||||||
|
/* Connect via telnet if owner */
|
||||||
|
if (user->owner) {
|
||||||
|
|
||||||
|
/* Store owner's settings at client level */
|
||||||
|
telnet_client->settings = settings;
|
||||||
|
|
||||||
/* Start client thread */
|
/* Start client thread */
|
||||||
if (pthread_create(&(telnet_client->client_thread), NULL,
|
if (pthread_create(&(telnet_client->client_thread), NULL,
|
||||||
guac_telnet_client_thread, (void*) client)) {
|
guac_telnet_client_thread, (void*) client)) {
|
||||||
@ -83,8 +89,15 @@ int guac_telnet_user_leave_handler(guac_user* user) {
|
|||||||
guac_telnet_client* telnet_client =
|
guac_telnet_client* telnet_client =
|
||||||
(guac_telnet_client*) user->client->data;
|
(guac_telnet_client*) user->client->data;
|
||||||
|
|
||||||
|
/* Update shared cursor state */
|
||||||
guac_common_cursor_remove_user(telnet_client->term->cursor, user);
|
guac_common_cursor_remove_user(telnet_client->term->cursor, user);
|
||||||
|
|
||||||
|
/* Free settings if not owner (owner settings will be freed with client) */
|
||||||
|
if (!user->owner) {
|
||||||
|
guac_telnet_settings* settings = (guac_telnet_settings*) user->data;
|
||||||
|
guac_telnet_settings_free(settings);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,12 +41,9 @@ int guac_vnc_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
|
|
||||||
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
|
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
|
||||||
|
|
||||||
/* Connect via VNC if owner */
|
/* Parse provided arguments */
|
||||||
if (user->owner) {
|
guac_vnc_settings* settings = guac_vnc_parse_args(user,
|
||||||
|
argc, (const char**) argv);
|
||||||
/* Parse arguments into client */
|
|
||||||
guac_vnc_settings* settings = vnc_client->settings =
|
|
||||||
guac_vnc_parse_args(user, argc, (const char**) argv);
|
|
||||||
|
|
||||||
/* Fail if settings cannot be parsed */
|
/* Fail if settings cannot be parsed */
|
||||||
if (settings == NULL) {
|
if (settings == NULL) {
|
||||||
@ -55,6 +52,15 @@ int guac_vnc_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Store settings at user level */
|
||||||
|
user->data = settings;
|
||||||
|
|
||||||
|
/* Connect via VNC if owner */
|
||||||
|
if (user->owner) {
|
||||||
|
|
||||||
|
/* Store owner's settings at client level */
|
||||||
|
vnc_client->settings = settings;
|
||||||
|
|
||||||
/* Start client thread */
|
/* Start client thread */
|
||||||
if (pthread_create(&vnc_client->client_thread, NULL, guac_vnc_client_thread, user->client)) {
|
if (pthread_create(&vnc_client->client_thread, NULL, guac_vnc_client_thread, user->client)) {
|
||||||
guac_user_log(user, GUAC_LOG_ERROR, "Unable to start VNC client thread.");
|
guac_user_log(user, GUAC_LOG_ERROR, "Unable to start VNC client thread.");
|
||||||
@ -101,8 +107,15 @@ int guac_vnc_user_leave_handler(guac_user* user) {
|
|||||||
|
|
||||||
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
|
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
|
||||||
|
|
||||||
|
/* Update shared cursor state */
|
||||||
guac_common_cursor_remove_user(vnc_client->display->cursor, user);
|
guac_common_cursor_remove_user(vnc_client->display->cursor, user);
|
||||||
|
|
||||||
|
/* Free settings if not owner (owner settings will be freed with client) */
|
||||||
|
if (!user->owner) {
|
||||||
|
guac_vnc_settings* settings = (guac_vnc_settings*) user->data;
|
||||||
|
guac_vnc_settings_free(settings);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user