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,19 +44,25 @@ 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;
|
||||||
|
|
||||||
|
/* Parse provided arguments */
|
||||||
|
guac_rdp_settings* settings = guac_rdp_parse_args(user,
|
||||||
|
argc, (const char**) argv);
|
||||||
|
|
||||||
|
/* Fail if settings cannot be parsed */
|
||||||
|
if (settings == NULL) {
|
||||||
|
guac_user_log(user, GUAC_LOG_INFO,
|
||||||
|
"Badly formatted client arguments.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store settings at user level */
|
||||||
|
user->data = settings;
|
||||||
|
|
||||||
/* Connect via RDP if owner */
|
/* Connect via RDP if owner */
|
||||||
if (user->owner) {
|
if (user->owner) {
|
||||||
|
|
||||||
/* Parse arguments into client */
|
/* Store owner's settings at client level */
|
||||||
guac_rdp_settings* settings = rdp_client->settings =
|
rdp_client->settings = settings;
|
||||||
guac_rdp_parse_args(user, argc, (const char**) argv);
|
|
||||||
|
|
||||||
/* Fail if settings cannot be parsed */
|
|
||||||
if (settings == NULL) {
|
|
||||||
guac_user_log(user, GUAC_LOG_INFO,
|
|
||||||
"Badly formatted client arguments.");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start client thread */
|
/* Start client thread */
|
||||||
if (pthread_create(&rdp_client->client_thread, NULL,
|
if (pthread_create(&rdp_client->client_thread, NULL,
|
||||||
@ -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,19 +39,25 @@ 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;
|
||||||
|
|
||||||
|
/* Parse provided arguments */
|
||||||
|
guac_ssh_settings* settings = guac_ssh_parse_args(user,
|
||||||
|
argc, (const char**) argv);
|
||||||
|
|
||||||
|
/* Fail if settings cannot be parsed */
|
||||||
|
if (settings == NULL) {
|
||||||
|
guac_user_log(user, GUAC_LOG_INFO,
|
||||||
|
"Badly formatted client arguments.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store settings at user level */
|
||||||
|
user->data = settings;
|
||||||
|
|
||||||
/* Connect via SSH if owner */
|
/* Connect via SSH if owner */
|
||||||
if (user->owner) {
|
if (user->owner) {
|
||||||
|
|
||||||
/* Parse arguments into client */
|
/* Store owner's settings at client level */
|
||||||
guac_ssh_settings* settings = ssh_client->settings =
|
ssh_client->settings = settings;
|
||||||
guac_ssh_parse_args(user, argc, (const char**) argv);
|
|
||||||
|
|
||||||
/* Fail if settings cannot be parsed */
|
|
||||||
if (settings == NULL) {
|
|
||||||
guac_user_log(user, GUAC_LOG_INFO,
|
|
||||||
"Badly formatted client arguments.");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start client thread */
|
/* Start client thread */
|
||||||
if (pthread_create(&(ssh_client->client_thread), NULL,
|
if (pthread_create(&(ssh_client->client_thread), NULL,
|
||||||
@ -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,19 +38,25 @@ 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;
|
||||||
|
|
||||||
|
/* Parse provided arguments */
|
||||||
|
guac_telnet_settings* settings = guac_telnet_parse_args(user,
|
||||||
|
argc, (const char**) argv);
|
||||||
|
|
||||||
|
/* Fail if settings cannot be parsed */
|
||||||
|
if (settings == NULL) {
|
||||||
|
guac_user_log(user, GUAC_LOG_INFO,
|
||||||
|
"Badly formatted client arguments.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store settings at user level */
|
||||||
|
user->data = settings;
|
||||||
|
|
||||||
/* Connect via telnet if owner */
|
/* Connect via telnet if owner */
|
||||||
if (user->owner) {
|
if (user->owner) {
|
||||||
|
|
||||||
/* Parse arguments into client */
|
/* Store owner's settings at client level */
|
||||||
guac_telnet_settings* settings = telnet_client->settings =
|
telnet_client->settings = settings;
|
||||||
guac_telnet_parse_args(user, argc, (const char**) argv);
|
|
||||||
|
|
||||||
/* Fail if settings cannot be parsed */
|
|
||||||
if (settings == NULL) {
|
|
||||||
guac_user_log(user, GUAC_LOG_INFO,
|
|
||||||
"Badly formatted client arguments.");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start client thread */
|
/* Start client thread */
|
||||||
if (pthread_create(&(telnet_client->client_thread), NULL,
|
if (pthread_create(&(telnet_client->client_thread), NULL,
|
||||||
@ -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,19 +41,25 @@ 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;
|
||||||
|
|
||||||
|
/* Parse provided arguments */
|
||||||
|
guac_vnc_settings* settings = guac_vnc_parse_args(user,
|
||||||
|
argc, (const char**) argv);
|
||||||
|
|
||||||
|
/* Fail if settings cannot be parsed */
|
||||||
|
if (settings == NULL) {
|
||||||
|
guac_user_log(user, GUAC_LOG_INFO,
|
||||||
|
"Badly formatted client arguments.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store settings at user level */
|
||||||
|
user->data = settings;
|
||||||
|
|
||||||
/* Connect via VNC if owner */
|
/* Connect via VNC if owner */
|
||||||
if (user->owner) {
|
if (user->owner) {
|
||||||
|
|
||||||
/* Parse arguments into client */
|
/* Store owner's settings at client level */
|
||||||
guac_vnc_settings* settings = vnc_client->settings =
|
vnc_client->settings = settings;
|
||||||
guac_vnc_parse_args(user, argc, (const char**) argv);
|
|
||||||
|
|
||||||
/* Fail if settings cannot be parsed */
|
|
||||||
if (settings == NULL) {
|
|
||||||
guac_user_log(user, GUAC_LOG_INFO,
|
|
||||||
"Badly formatted client arguments.");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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)) {
|
||||||
@ -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