From 4661f432f00a61ca24c800f9469c9354db11c59b Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 27 Jan 2016 12:40:35 -0800 Subject: [PATCH] GUAC-1452: Parse and handle typescript parameters within SSH and telnet. --- src/protocols/ssh/client.c | 19 +++++++++++++++++++ src/protocols/telnet/client.c | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/protocols/ssh/client.c b/src/protocols/ssh/client.c index 813857dd..5e9edaaa 100644 --- a/src/protocols/ssh/client.c +++ b/src/protocols/ssh/client.c @@ -224,6 +224,25 @@ int guac_client_init(guac_client* client, int argc, char** argv) { return -1; } + /* Set up typescript, if requested */ + const char* typescript_path = argv[IDX_TYPESCRIPT_PATH]; + if (typescript_path[0] != 0) { + + /* Default to "typescript" if no name provided */ + const char* typescript_name = argv[IDX_TYPESCRIPT_NAME]; + if (typescript_name[0] == 0) + typescript_name = "typescript"; + + /* Parse path creation flag */ + int create_path = + strcmp(argv[IDX_CREATE_TYPESCRIPT_PATH], "true") == 0; + + /* Create typescript */ + guac_terminal_create_typescript(client_data->term, typescript_path, + typescript_name, create_path); + + } + /* Ensure main socket is threadsafe */ guac_socket_require_threadsafe(socket); diff --git a/src/protocols/telnet/client.c b/src/protocols/telnet/client.c index 9bdb6912..e4f18cd6 100644 --- a/src/protocols/telnet/client.c +++ b/src/protocols/telnet/client.c @@ -240,6 +240,25 @@ int guac_client_init(guac_client* client, int argc, char** argv) { return -1; } + /* Set up typescript, if requested */ + const char* typescript_path = argv[IDX_TYPESCRIPT_PATH]; + if (typescript_path[0] != 0) { + + /* Default to "typescript" if no name provided */ + const char* typescript_name = argv[IDX_TYPESCRIPT_NAME]; + if (typescript_name[0] == 0) + typescript_name = "typescript"; + + /* Parse path creation flag */ + int create_path = + strcmp(argv[IDX_CREATE_TYPESCRIPT_PATH], "true") == 0; + + /* Create typescript */ + guac_terminal_create_typescript(client_data->term, typescript_path, + typescript_name, create_path); + + } + /* Send initial name */ guac_protocol_send_name(socket, client_data->hostname);