You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/05/27 11:20:19 UTC

[1/2] guacamole-server git commit: GUACAMOLE-565: Add terminal-type parameter for SSH and Telnet.

Repository: guacamole-server
Updated Branches:
  refs/heads/master b61a6ab75 -> 4eae5d2e6


GUACAMOLE-565: Add terminal-type parameter for SSH and Telnet.

Add a terminal-type parameter for SSH and Telnet connections, to specify
the terminal emulator type that is passed to programs. If not specified,
the default type of "linux" is used in keep with existing behavior.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/87df9731
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/87df9731
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/87df9731

Branch: refs/heads/master
Commit: 87df97317fa1b345ad9465accd15900b90ceb0b3
Parents: b61a6ab
Author: Jim Chen <nc...@mozilla.com>
Authored: Tue Jan 9 23:11:12 2018 -0500
Committer: Jim Chen <nc...@mozilla.com>
Committed: Sat May 26 23:30:22 2018 -0400

----------------------------------------------------------------------
 src/protocols/ssh/settings.c    | 15 +++++++++++++++
 src/protocols/ssh/settings.h    |  5 +++++
 src/protocols/ssh/ssh.c         |  3 ++-
 src/protocols/telnet/settings.c | 15 +++++++++++++++
 src/protocols/telnet/settings.h |  5 +++++
 src/protocols/telnet/telnet.c   |  2 +-
 6 files changed, 43 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/87df9731/src/protocols/ssh/settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/settings.c b/src/protocols/ssh/settings.c
index 983f7f0..6f71d86 100644
--- a/src/protocols/ssh/settings.c
+++ b/src/protocols/ssh/settings.c
@@ -57,6 +57,7 @@ const char* GUAC_SSH_CLIENT_ARGS[] = {
     "read-only",
     "server-alive-interval",
     "backspace",
+    "terminal-type",
     NULL
 };
 
@@ -217,6 +218,12 @@ enum SSH_ARGS_IDX {
      */
     IDX_BACKSPACE,
 
+    /**
+     * The terminal emulator type that is passed to the remote system (e.g.
+     * "xterm" or "xterm-256color"). "linux" is used if unspecified.
+     */
+    IDX_TERMINAL_TYPE,
+
     SSH_ARGS_COUNT
 };
 
@@ -361,6 +368,11 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user,
         guac_user_parse_args_int(user, GUAC_SSH_CLIENT_ARGS, argv,
                 IDX_BACKSPACE, 127);
 
+    /* Read terminal emulator type. */
+    settings->terminal_type =
+        guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
+                IDX_TERMINAL_TYPE, "linux");
+
     /* Parsing was successful */
     return settings;
 
@@ -396,6 +408,9 @@ void guac_ssh_settings_free(guac_ssh_settings* settings) {
     free(settings->recording_name);
     free(settings->recording_path);
 
+    /* Free terminal emulator type. */
+    free(settings->terminal_type);
+
     /* Free overall structure */
     free(settings);
 

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/87df9731/src/protocols/ssh/settings.h
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/settings.h b/src/protocols/ssh/settings.h
index 175ece9..393cfc0 100644
--- a/src/protocols/ssh/settings.h
+++ b/src/protocols/ssh/settings.h
@@ -228,6 +228,11 @@ typedef struct guac_ssh_settings {
      */
     int backspace;
 
+    /**
+     * The terminal emulator type that is passed to the remote system.
+     */
+    char* terminal_type;
+
 } guac_ssh_settings;
 
 /**

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/87df9731/src/protocols/ssh/ssh.c
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/ssh.c b/src/protocols/ssh/ssh.c
index 7c76037..a614f81 100644
--- a/src/protocols/ssh/ssh.c
+++ b/src/protocols/ssh/ssh.c
@@ -307,7 +307,8 @@ void* ssh_client_thread(void* data) {
                 "  Backspace may not work as expected.");
 
     /* Request PTY */
-    if (libssh2_channel_request_pty_ex(ssh_client->term_channel, "linux", sizeof("linux")-1,
+    if (libssh2_channel_request_pty_ex(ssh_client->term_channel,
+            settings->terminal_type, strlen(settings->terminal_type),
             ssh_ttymodes, ttymodeBytes, ssh_client->term->term_width,
             ssh_client->term->term_height, 0, 0)) {
         guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR, "Unable to allocate PTY.");

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/87df9731/src/protocols/telnet/settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/telnet/settings.c b/src/protocols/telnet/settings.c
index 8f80291..dcd75b6 100644
--- a/src/protocols/telnet/settings.c
+++ b/src/protocols/telnet/settings.c
@@ -51,6 +51,7 @@ const char* GUAC_TELNET_CLIENT_ARGS[] = {
     "create-recording-path",
     "read-only",
     "backspace",
+    "terminal-type",
     NULL
 };
 
@@ -181,6 +182,12 @@ enum TELNET_ARGS_IDX {
      */
     IDX_BACKSPACE,
 
+    /**
+     * The terminal emulator type that is passed to the remote system (e.g.
+     * "xterm" or "xterm-256color"). "linux" is used if unspecified.
+     */
+    IDX_TERMINAL_TYPE,
+
     TELNET_ARGS_COUNT
 };
 
@@ -340,6 +347,11 @@ guac_telnet_settings* guac_telnet_parse_args(guac_user* user,
         guac_user_parse_args_int(user, GUAC_TELNET_CLIENT_ARGS, argv,
                 IDX_BACKSPACE, 127);
 
+    /* Read terminal emulator type. */
+    settings->terminal_type =
+        guac_user_parse_args_string(user, GUAC_TELNET_CLIENT_ARGS, argv,
+                IDX_TERMINAL_TYPE, "linux");
+
     /* Parsing was successful */
     return settings;
 
@@ -379,6 +391,9 @@ void guac_telnet_settings_free(guac_telnet_settings* settings) {
     free(settings->recording_name);
     free(settings->recording_path);
 
+    /* Free terminal emulator type. */
+    free(settings->terminal_type);
+
     /* Free overall structure */
     free(settings);
 

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/87df9731/src/protocols/telnet/settings.h
----------------------------------------------------------------------
diff --git a/src/protocols/telnet/settings.h b/src/protocols/telnet/settings.h
index 9bc3dc3..7d8d6ee 100644
--- a/src/protocols/telnet/settings.h
+++ b/src/protocols/telnet/settings.h
@@ -214,6 +214,11 @@ typedef struct guac_telnet_settings {
      */
     int backspace;
 
+    /**
+     * The terminal emulator type that is passed to the remote system.
+     */
+    char* terminal_type;
+
 } guac_telnet_settings;
 
 /**

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/87df9731/src/protocols/telnet/telnet.c
----------------------------------------------------------------------
diff --git a/src/protocols/telnet/telnet.c b/src/protocols/telnet/telnet.c
index 040d10b..e902c3b 100644
--- a/src/protocols/telnet/telnet.c
+++ b/src/protocols/telnet/telnet.c
@@ -216,7 +216,7 @@ static void __guac_telnet_event_handler(telnet_t* telnet, telnet_event_t* event,
         /* Terminal type request */
         case TELNET_EV_TTYPE:
             if (event->ttype.cmd == TELNET_TTYPE_SEND)
-                telnet_ttype_is(telnet_client->telnet, "linux");
+                telnet_ttype_is(telnet_client->telnet, settings->terminal_type);
             break;
 
         /* Environment request */


[2/2] guacamole-server git commit: GUACAMOLE-565: Merge add terminal-type parameter for SSH and telnet.

Posted by vn...@apache.org.
GUACAMOLE-565: Merge add terminal-type parameter for SSH and telnet.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/4eae5d2e
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/4eae5d2e
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/4eae5d2e

Branch: refs/heads/master
Commit: 4eae5d2e6d2c0def95d13516b5aa2ba878fe0aee
Parents: b61a6ab 87df973
Author: Nick Couchman <vn...@apache.org>
Authored: Sun May 27 07:18:46 2018 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Sun May 27 07:18:46 2018 -0400

----------------------------------------------------------------------
 src/protocols/ssh/settings.c    | 15 +++++++++++++++
 src/protocols/ssh/settings.h    |  5 +++++
 src/protocols/ssh/ssh.c         |  3 ++-
 src/protocols/telnet/settings.c | 15 +++++++++++++++
 src/protocols/telnet/settings.h |  5 +++++
 src/protocols/telnet/telnet.c   |  2 +-
 6 files changed, 43 insertions(+), 2 deletions(-)
----------------------------------------------------------------------