[1/2] guacamole-server git commit: GUACAMOLE-470: Fix incompatible pointer type warning under older GCC.

2018-05-27 Thread mjumper
Repository: guacamole-server
Updated Branches:
  refs/heads/master 526152b9c -> 21f54b9e1


GUACAMOLE-470: Fix incompatible pointer type warning under older GCC.

Older versions of GCC (prior to 5.1) emits an "incompatible pointer
type" warning when passing `foo(*)[]` as `const foo(*)[]`. This was
changed in GCC 5.1, and this patch adds explicit casts to remove the
warning under older GCC.


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

Branch: refs/heads/master
Commit: 9c10ddae3b976d1a524de03e612512ebf2991ea7
Parents: 6da9236
Author: Jim Chen 
Authored: Sun May 27 23:45:56 2018 -0400
Committer: Jim Chen 
Committed: Sun May 27 23:46:16 2018 -0400

--
 src/terminal/terminal.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/9c10ddae/src/terminal/terminal.c
--
diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c
index 7096add..5ae2ee3 100644
--- a/src/terminal/terminal.c
+++ b/src/terminal/terminal.c
@@ -495,7 +495,8 @@ static void guac_terminal_parse_color_scheme(guac_client* 
client,
 return; /* Parsing failed. */
 
 if (guac_terminal_parse_color_scheme_value(
-client, name_end + 1, pair_end, palette, color_target))
+client, name_end + 1, pair_end,
+(const guac_terminal_color(*)[256]) palette, color_target))
 return; /* Parsing failed. */
 }
 }
@@ -566,7 +567,7 @@ guac_terminal* guac_terminal_create(guac_client* client,
 font_name, font_size, dpi,
 &default_char.attributes.foreground,
 &default_char.attributes.background,
-default_palette);
+(const guac_terminal_color(*)[256]) default_palette);
 
 /* Fail if display init failed */
 if (term->display == NULL) {



[2/2] guacamole-server git commit: GUACAMOLE-470: Merge changes addressing broken build / GCC warning.

2018-05-27 Thread mjumper
GUACAMOLE-470: Merge changes addressing broken build / GCC warning.


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

Branch: refs/heads/master
Commit: 21f54b9e1283a2ccc03795b0e8bb46e1dd9128c3
Parents: 526152b 9c10dda
Author: Michael Jumper 
Authored: Sun May 27 21:13:25 2018 -0700
Committer: Michael Jumper 
Committed: Sun May 27 21:13:25 2018 -0700

--
 src/terminal/terminal.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
--




[6/6] guacamole-client git commit: GUACAMOLE-567: Merge warn if network connection appears unstable.

2018-05-27 Thread vnick
GUACAMOLE-567: Merge warn if network connection appears unstable.


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

Branch: refs/heads/master
Commit: c988975ec0a9c642b1989e78c2325de2625b0910
Parents: f5266fd 6ea2426
Author: Nick Couchman 
Authored: Sun May 27 23:07:12 2018 -0400
Committer: Nick Couchman 
Committed: Sun May 27 23:07:12 2018 -0400

--
 .../src/main/webapp/modules/Status.js   |  84 ++
 .../src/main/webapp/modules/Tunnel.js   | 159 ---
 .../app/client/controllers/clientController.js  |  12 ++
 .../app/client/styles/connection-warning.css|  56 +++
 .../webapp/app/client/templates/client.html |   5 +
 .../webapp/app/client/types/ManagedClient.js|  12 ++
 .../app/client/types/ManagedClientState.js  |  11 +-
 guacamole/src/main/webapp/images/warning.png| Bin 0 -> 1059 bytes
 guacamole/src/main/webapp/translations/en.json  |   1 +
 9 files changed, 280 insertions(+), 60 deletions(-)
--




[4/6] guacamole-client git commit: GUACAMOLE-567: Warn user when tunnel enters "UNSTABLE" state.

2018-05-27 Thread vnick
GUACAMOLE-567: Warn user when tunnel enters "UNSTABLE" state.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/1ed22401
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/1ed22401
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/1ed22401

Branch: refs/heads/master
Commit: 1ed22401bbc2b1b076f49190530dbcf61bd4809f
Parents: e6f3665
Author: Michael Jumper 
Authored: Sun Dec 10 20:28:35 2017 -0800
Committer: Michael Jumper 
Committed: Sun May 27 17:09:24 2018 -0700

--
 .../app/client/controllers/clientController.js  | 12 +++
 .../app/client/styles/connection-warning.css| 36 
 .../webapp/app/client/templates/client.html |  5 +++
 .../webapp/app/client/types/ManagedClient.js| 12 +++
 .../app/client/types/ManagedClientState.js  | 11 +-
 guacamole/src/main/webapp/translations/en.json  |  1 +
 6 files changed, 76 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/1ed22401/guacamole/src/main/webapp/app/client/controllers/clientController.js
--
diff --git 
a/guacamole/src/main/webapp/app/client/controllers/clientController.js 
b/guacamole/src/main/webapp/app/client/controllers/clientController.js
index af1d726..ffbe3c5 100644
--- a/guacamole/src/main/webapp/app/client/controllers/clientController.js
+++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js
@@ -626,6 +626,18 @@ angular.module('client').controller('clientController', 
['$scope', '$routeParams
 
 };
 
+/**
+ * Returns whether the current connection has been flagged as unstable due
+ * to an apparent network disruption.
+ *
+ * @returns {Boolean}
+ * true if the current connection has been flagged as unstable, false
+ * otherwise.
+ */
+$scope.isConnectionUnstable = function isConnectionUnstable() {
+return $scope.client && $scope.client.clientState.connectionState === 
ManagedClientState.ConnectionState.UNSTABLE;
+};
+
 // Show status dialog when connection status changes
 $scope.$watch('client.clientState.connectionState', function 
clientStateChanged(connectionState) {
 

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/1ed22401/guacamole/src/main/webapp/app/client/styles/connection-warning.css
--
diff --git a/guacamole/src/main/webapp/app/client/styles/connection-warning.css 
b/guacamole/src/main/webapp/app/client/styles/connection-warning.css
new file mode 100644
index 000..eec3e07
--- /dev/null
+++ b/guacamole/src/main/webapp/app/client/styles/connection-warning.css
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#connection-warning {
+
+position: absolute;
+right: 0.25em;
+top: 0.25em;
+z-index: 20;
+
+max-width: 100%;
+max-height: 3in;
+
+border: 1px solid rgba(0,0,0,0.5);
+box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
+background: #FFE;
+padding: 0.5em;
+font-size: .8em;
+
+}

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/1ed22401/guacamole/src/main/webapp/app/client/templates/client.html
--
diff --git a/guacamole/src/main/webapp/app/client/templates/client.html 
b/guacamole/src/main/webapp/app/client/templates/client.html
index 054cbcf..ad85f23 100644
--- a/guacamole/src/main/webapp/app/client/templates/client.html
+++ b/guacamole/src/main/webapp/app/client/templates/client.html
@@ -36,6 +36,11 @@
 
 
 
+
+
+{{'CLIENT.TEXT_CLIENT_STATUS_UNSTABLE' | translate}}
+
+
 
 
 

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/1ed22401/guacamole/src/main/webapp/app/client/types/ManagedClient.js
--
diff --git a/guacamole/src/main/webapp/app/cl

[1/6] guacamole-client git commit: GUACAMOLE-567: Add HTTP and WebSocket translation functions to Guacamole.Status.Code.

2018-05-27 Thread vnick
Repository: guacamole-client
Updated Branches:
  refs/heads/master f5266fdde -> c988975ec


GUACAMOLE-567: Add HTTP and WebSocket translation functions to 
Guacamole.Status.Code.


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

Branch: refs/heads/master
Commit: a1e59b9d3aa9b7fda49b9eb5e081700f46580b97
Parents: 1710c31
Author: Michael Jumper 
Authored: Sun Dec 10 17:46:11 2017 -0800
Committer: Michael Jumper 
Committed: Sun May 27 12:28:28 2018 -0700

--
 .../src/main/webapp/modules/Status.js   | 84 
 1 file changed, 84 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/a1e59b9d/guacamole-common-js/src/main/webapp/modules/Status.js
--
diff --git a/guacamole-common-js/src/main/webapp/modules/Status.js 
b/guacamole-common-js/src/main/webapp/modules/Status.js
index ceadaa6..3acfd63 100644
--- a/guacamole-common-js/src/main/webapp/modules/Status.js
+++ b/guacamole-common-js/src/main/webapp/modules/Status.js
@@ -232,3 +232,87 @@ Guacamole.Status.Code = {
 "CLIENT_TOO_MANY": 0x031D
 
 };
+
+/**
+ * Returns the Guacamole protocol status code which most closely
+ * represents the given HTTP status code.
+ *
+ * @param {Number} status
+ * The HTTP status code to translate into a Guacamole protocol status
+ * code.
+ *
+ * @returns {Number}
+ * The Guacamole protocol status code which most closely represents the
+ * given HTTP status code.
+ */
+Guacamole.Status.Code.fromHTTPCode = function fromHTTPCode(status) {
+
+// Translate status codes with known equivalents
+switch (status) {
+
+// HTTP 400 - Bad request
+case 400:
+return Guacamole.Status.Code.CLIENT_BAD_REQUEST;
+
+// HTTP 403 - Forbidden
+case 403:
+return Guacamole.Status.Code.CLIENT_FORBIDDEN;
+
+// HTTP 404 - Resource not found
+case 404:
+return Guacamole.Status.Code.RESOURCE_NOT_FOUND;
+
+// HTTP 429 - Too many requests
+case 429:
+return Guacamole.Status.Code.CLIENT_TOO_MANY;
+
+// HTTP 503 - Server unavailable
+case 503:
+return Guacamole.Status.Code.SERVER_BUSY;
+
+}
+
+// Default all other codes to generic internal error
+return Guacamole.Status.Code.SERVER_ERROR;
+
+};
+
+/**
+ * Returns the Guacamole protocol status code which most closely
+ * represents the given WebSocket status code.
+ *
+ * @param {Number} code
+ * The WebSocket status code to translate into a Guacamole protocol
+ * status code.
+ *
+ * @returns {Number}
+ * The Guacamole protocol status code which most closely represents the
+ * given WebSocket status code.
+ */
+Guacamole.Status.Code.fromWebSocketCode = function fromWebSocketCode(code) {
+
+// Translate status codes with known equivalents
+switch (code) {
+
+// Successful disconnect (no error)
+case 1000: // Normal Closure
+return Guacamole.Status.Code.SUCCESS;
+
+// Codes which indicate the server is not reachable
+case 1006: // Abnormal Closure (also signalled by JavaScript when the 
connection cannot be opened in the first place)
+case 1015: // TLS Handshake
+return Guacamole.Status.Code.UPSTREAM_NOT_FOUND;
+
+// Codes which indicate the server is reachable but busy/unavailable
+case 1001: // Going Away
+case 1012: // Service Restart
+case 1013: // Try Again Later
+case 1014: // Bad Gateway
+return Guacamole.Status.Code.UPSTREAM_UNAVAILABLE;
+
+}
+
+// Default all other codes to generic internal error
+return Guacamole.Status.Code.SERVER_ERROR;
+
+};



[3/6] guacamole-client git commit: GUACAMOLE-567: Add UNSTABLE tunnel status. Mark tunnel as UNSTABLE if no data has been received in a reasonable amount of time, but the tunnel is technically still o

2018-05-27 Thread vnick
GUACAMOLE-567: Add UNSTABLE tunnel status. Mark tunnel as UNSTABLE if no data 
has been received in a reasonable amount of time, but the tunnel is technically 
still open.


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

Branch: refs/heads/master
Commit: e6f36659954653271495ee2c12cd80469a2ee63a
Parents: ca98d07
Author: Michael Jumper 
Authored: Sun Dec 10 20:22:22 2017 -0800
Committer: Michael Jumper 
Committed: Sun May 27 15:43:41 2018 -0700

--
 .../src/main/webapp/modules/Tunnel.js   | 75 ++--
 1 file changed, 69 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/e6f36659/guacamole-common-js/src/main/webapp/modules/Tunnel.js
--
diff --git a/guacamole-common-js/src/main/webapp/modules/Tunnel.js 
b/guacamole-common-js/src/main/webapp/modules/Tunnel.js
index 63e27c5..52bd20a 100644
--- a/guacamole-common-js/src/main/webapp/modules/Tunnel.js
+++ b/guacamole-common-js/src/main/webapp/modules/Tunnel.js
@@ -84,12 +84,23 @@ Guacamole.Tunnel = function() {
  * The maximum amount of time to wait for data to be received, in
  * milliseconds. If data is not received within this amount of time,
  * the tunnel is closed with an error. The default value is 15000.
- * 
+ *
  * @type {Number}
  */
 this.receiveTimeout = 15000;
 
 /**
+ * The amount of time to wait for data to be received before considering
+ * the connection to be unstable, in milliseconds. If data is not received
+ * within this amount of time, the tunnel status is updated to warn that
+ * the connection appears unresponsive and may close. The default value is
+ * 1500.
+ * 
+ * @type {Number}
+ */
+this.unstableThreshold = 1500;
+
+/**
  * The UUID uniquely identifying this tunnel. If not yet known, this will
  * be null.
  *
@@ -165,7 +176,15 @@ Guacamole.Tunnel.State = {
  * 
  * @type {Number}
  */
-"CLOSED": 2
+"CLOSED": 2,
+
+/**
+ * The connection is open, but communication through the tunnel appears to
+ * be disrupted, and the connection may close as a result.
+ *
+ * @type {Number}
+ */
+"UNSTABLE" : 3
 
 };
 
@@ -220,6 +239,14 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, 
extraTunnelHeaders) {
 var receive_timeout = null;
 
 /**
+ * The current connection stability timeout ID, if any.
+ *
+ * @private
+ * @type {Number}
+ */
+var unstableTimeout = null;
+
+/**
  * Additional headers to be sent in tunnel requests. This dictionary can be
  * populated with key/value header pairs to pass information such as 
authentication
  * tokens, etc.
@@ -253,14 +280,24 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, 
extraTunnelHeaders) {
  */
 function reset_timeout() {
 
-// Get rid of old timeout (if any)
+// Get rid of old timeouts (if any)
 window.clearTimeout(receive_timeout);
+window.clearTimeout(unstableTimeout);
+
+// Clear unstable status
+if (tunnel.state === Guacamole.Tunnel.State.UNSTABLE)
+tunnel.setState(Guacamole.Tunnel.State.OPEN);
 
-// Set new timeout
+// Set new timeout for tracking overall connection timeout
 receive_timeout = window.setTimeout(function () {
 close_tunnel(new 
Guacamole.Status(Guacamole.Status.Code.UPSTREAM_TIMEOUT, "Server timeout."));
 }, tunnel.receiveTimeout);
 
+// Set new timeout for tracking suspected connection instability
+unstableTimeout = window.setTimeout(function() {
+tunnel.setState(Guacamole.Tunnel.State.UNSTABLE);
+}, tunnel.unstableThreshold);
+
 }
 
 /**
@@ -274,6 +311,10 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, 
extraTunnelHeaders) {
  */
 function close_tunnel(status) {
 
+// Get rid of old timeouts (if any)
+window.clearTimeout(receive_timeout);
+window.clearTimeout(unstableTimeout);
+
 // Ignore if already closed
 if (tunnel.state === Guacamole.Tunnel.State.CLOSED)
 return;
@@ -683,6 +724,14 @@ Guacamole.WebSocketTunnel = function(tunnelURL) {
 var receive_timeout = null;
 
 /**
+ * The current connection stability timeout ID, if any.
+ *
+ * @private
+ * @type {Number}
+ */
+var unstableTimeout = null;
+
+/**
  * The WebSocket protocol corresponding to the protocol used for the 
current
  * location

[5/6] guacamole-client git commit: GUACAMOLE-567: Clean up style of connection stability warning. Add warning icon.

2018-05-27 Thread vnick
GUACAMOLE-567: Clean up style of connection stability warning. Add warning icon.

Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/6ea24261
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/6ea24261
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/6ea24261

Branch: refs/heads/master
Commit: 6ea24261aef0da51faf4b9cff70bd607a6de
Parents: 1ed2240
Author: Michael Jumper 
Authored: Sun May 27 15:27:17 2018 -0700
Committer: Michael Jumper 
Committed: Sun May 27 17:09:24 2018 -0700

--
 .../app/client/styles/connection-warning.css|  28 ---
 guacamole/src/main/webapp/images/warning.png| Bin 0 -> 1059 bytes
 2 files changed, 24 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/6ea24261/guacamole/src/main/webapp/app/client/styles/connection-warning.css
--
diff --git a/guacamole/src/main/webapp/app/client/styles/connection-warning.css 
b/guacamole/src/main/webapp/app/client/styles/connection-warning.css
index eec3e07..87af0a8 100644
--- a/guacamole/src/main/webapp/app/client/styles/connection-warning.css
+++ b/guacamole/src/main/webapp/app/client/styles/connection-warning.css
@@ -21,16 +21,36 @@
 
 position: absolute;
 right: 0.25em;
-top: 0.25em;
+bottom: 0.25em;
 z-index: 20;
 
+width: 3in;
 max-width: 100%;
-max-height: 3in;
+min-height: 1em;
 
-border: 1px solid rgba(0,0,0,0.5);
+border-left: 2em solid #FA0;
 box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
 background: #FFE;
-padding: 0.5em;
+padding: 0.5em 0.75em;
 font-size: .8em;
 
 }
+
+#connection-warning::before {
+
+content: ' ';
+display: block;
+position: absolute;
+left: -2em;
+top: 0;
+
+width: 1.25em;
+height: 100%;
+margin: 0 0.375em;
+
+background: url('images/warning.png');
+background-size: contain;
+background-position: center;
+background-repeat: no-repeat;
+
+}

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/6ea24261/guacamole/src/main/webapp/images/warning.png
--
diff --git a/guacamole/src/main/webapp/images/warning.png 
b/guacamole/src/main/webapp/images/warning.png
new file mode 100644
index 000..1933417
Binary files /dev/null and b/guacamole/src/main/webapp/images/warning.png differ



[2/6] guacamole-client git commit: GUACAMOLE-567: Rely on HTTP or WebSocket status code to determine error if Guacamole-specific reason is missing. Default to server unreachable.

2018-05-27 Thread vnick
GUACAMOLE-567: Rely on HTTP or WebSocket status code to determine error if 
Guacamole-specific reason is missing. Default to server unreachable.


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

Branch: refs/heads/master
Commit: ca98d07b4abe8f37a0d8eb51bd4a4043cbc2c3d1
Parents: a1e59b9
Author: Michael Jumper 
Authored: Sun Dec 10 16:56:19 2017 -0800
Committer: Michael Jumper 
Committed: Sun May 27 12:29:10 2018 -0700

--
 .../src/main/webapp/modules/Tunnel.js   | 84 
 1 file changed, 31 insertions(+), 53 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/ca98d07b/guacamole-common-js/src/main/webapp/modules/Tunnel.js
--
diff --git a/guacamole-common-js/src/main/webapp/modules/Tunnel.js 
b/guacamole-common-js/src/main/webapp/modules/Tunnel.js
index c8f8502..63e27c5 100644
--- a/guacamole-common-js/src/main/webapp/modules/Tunnel.js
+++ b/guacamole-common-js/src/main/webapp/modules/Tunnel.js
@@ -382,10 +382,23 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, 
extraTunnelHeaders) {
 
 function handleHTTPTunnelError(xmlhttprequest) {
 
+// Pull status code directly from headers provided by Guacamole
 var code = 
parseInt(xmlhttprequest.getResponseHeader("Guacamole-Status-Code"));
-var message = 
xmlhttprequest.getResponseHeader("Guacamole-Error-Message");
+if (code) {
+var message = 
xmlhttprequest.getResponseHeader("Guacamole-Error-Message");
+close_tunnel(new Guacamole.Status(code, message));
+}
+
+// Failing that, derive a Guacamole status code from the HTTP status
+// code provided by the browser
+else if (xmlhttprequest.status)
+close_tunnel(new Guacamole.Status(
+Guacamole.Status.Code.fromHTTPCode(xmlhttprequest.status),
+xmlhttprequest.statusText));
 
-close_tunnel(new Guacamole.Status(code, message));
+// Otherwise, assume server is unreachable
+else
+close_tunnel(new 
Guacamole.Status(Guacamole.Status.Code.UPSTREAM_NOT_FOUND));
 
 }
 
@@ -808,13 +821,22 @@ Guacamole.WebSocketTunnel = function(tunnelURL) {
 };
 
 socket.onclose = function(event) {
-close_tunnel(new Guacamole.Status(parseInt(event.reason), 
event.reason));
+
+// Pull status code directly from closure reason provided by 
Guacamole
+if (event.reason)
+close_tunnel(new Guacamole.Status(parseInt(event.reason), 
event.reason));
+
+// Failing that, derive a Guacamole status code from the WebSocket
+// status code provided by the browser
+else if (event.code)
+close_tunnel(new 
Guacamole.Status(Guacamole.Status.Code.fromWebSocketCode(event.code)));
+
+// Otherwise, assume server is unreachable
+else
+close_tunnel(new 
Guacamole.Status(Guacamole.Status.Code.UPSTREAM_NOT_FOUND));
+
 };
 
-socket.onerror = function(event) {
-close_tunnel(new 
Guacamole.Status(Guacamole.Status.Code.SERVER_ERROR, event.data));
-};
-
 socket.onmessage = function(event) {
 
 reset_timeout();
@@ -1141,51 +1163,6 @@ Guacamole.StaticHTTPTunnel = function 
StaticHTTPTunnel(url, crossDomain, extraTu
 }
 }
 
-/**
- * Returns the Guacamole protocol status code which most closely
- * represents the given HTTP status code.
- *
- * @private
- * @param {Number} httpStatus
- * The HTTP status code to translate into a Guacamole protocol status
- * code.
- *
- * @returns {Number}
- * The Guacamole protocol status code which most closely represents the
- * given HTTP status code.
- */
-var getGuacamoleStatusCode = function getGuacamoleStatusCode(httpStatus) {
-
-// Translate status codes with known equivalents
-switch (httpStatus) {
-
-// HTTP 400 - Bad request
-case 400:
-return Guacamole.Status.Code.CLIENT_BAD_REQUEST;
-
-// HTTP 403 - Forbidden
-case 403:
-return Guacamole.Status.Code.CLIENT_FORBIDDEN;
-
-// HTTP 404 - Resource not found
-case 404:
-return Guacamole.Status.Code.RESOURCE_NOT_FOUND;
-
-// HTTP 429 - Too many requests
-case 429:
-return Guacamole.Status.Code.CLIENT_TOO_MANY;
-
-// HTTP 503

[jira] [Assigned] (GUACAMOLE-567) Network connection problem acknowledgement/feedback

2018-05-27 Thread Michael Jumper (JIRA)

 [ 
https://issues.apache.org/jira/browse/GUACAMOLE-567?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Jumper reassigned GUACAMOLE-567:


Assignee: Michael Jumper

> Network connection problem acknowledgement/feedback
> ---
>
> Key: GUACAMOLE-567
> URL: https://issues.apache.org/jira/browse/GUACAMOLE-567
> Project: Guacamole
>  Issue Type: Improvement
>Reporter: Michael Jumper
>Assignee: Michael Jumper
>Priority: Major
> Fix For: 1.0.0
>
> Attachments: internal-error.png
>
>
> {panel:bgColor=#EE}
> *The description of this issue was copied from 
> [GUAC-1055|https://jira.glyptodon.org/browse/GUAC-1055], an issue in the JIRA 
> instance used by the Guacamole project prior to its move to the ASF.*
> Comments, attachments, related issues, and history from prior to acceptance 
> *may not have been copied* and can be found instead at the original issue.
> {panel}
> When Guacamole detects that the network connection is slow or hanging, it 
> should acknowledge this and unobtrusively notify the user. Lacking such 
> notification, slow networks or remote desktop failures look like Guacamole 
> bugs, and are frequently reported as such.
> Further, the total lack of a network connection is handled within JavaScript, 
> but the error code is not recognized by the Guacamole client. The unknown 
> error is thus translated into a generic "An internal error has occurred ..." 
> message, which is obviously incorrect:
> !internal-error.png|width=320!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[1/2] guacamole-client git commit: GUACAMOLE-470: Update "color-scheme" parameter for SSH and Telnet.

2018-05-27 Thread vnick
Repository: guacamole-client
Updated Branches:
  refs/heads/master ff9f3ae7e -> f5266fdde


GUACAMOLE-470: Update "color-scheme" parameter for SSH and Telnet.

GUACAMOLE-470 changes the "color-scheme" parameter to be a configuration
string instead of a simple enum, so update the protocol JSON
accordingly.


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

Branch: refs/heads/master
Commit: 4e610f2d1bda0ef073b8b9190fa2135d427f30cb
Parents: fed5133
Author: Jim Chen 
Authored: Wed May 16 11:52:08 2018 -0400
Committer: Jim Chen 
Committed: Wed May 16 11:52:08 2018 -0400

--
 .../src/main/resources/org/apache/guacamole/protocols/ssh.json| 3 +--
 .../src/main/resources/org/apache/guacamole/protocols/telnet.json | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/4e610f2d/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json
--
diff --git 
a/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json 
b/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json
index 442214a..ed728cf 100644
--- a/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json
+++ b/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json
@@ -43,8 +43,7 @@
 "fields" : [
 {
 "name"  : "color-scheme",
-"type"  : "ENUM",
-"options" : [ "", "black-white", "gray-black", 
"green-black", "white-black" ]
+"type"  : "TEXT"
 },
 {
 "name"  : "font-name",

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/4e610f2d/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json
--
diff --git 
a/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json 
b/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json
index 5b960f8..67a3a1f 100644
--- 
a/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json
+++ 
b/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json
@@ -39,8 +39,7 @@
 "fields" : [
 {
 "name"  : "color-scheme",
-"type"  : "ENUM",
-"options" : [ "", "black-white", "gray-black", 
"green-black", "white-black" ]
+"type"  : "TEXT"
 },
 {
 "name"  : "font-name",



[2/2] guacamole-client git commit: GUACAMOLE-470: Merge updated color-scheme parameter for SSH and telnet.

2018-05-27 Thread vnick
GUACAMOLE-470: Merge updated color-scheme parameter for SSH and telnet.


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

Branch: refs/heads/master
Commit: f5266fdde1d1ee120372314dcf504705807d1bde
Parents: ff9f3ae 4e610f2
Author: Nick Couchman 
Authored: Sun May 27 17:16:08 2018 -0400
Committer: Nick Couchman 
Committed: Sun May 27 17:16:08 2018 -0400

--
 .../src/main/resources/org/apache/guacamole/protocols/ssh.json| 3 +--
 .../src/main/resources/org/apache/guacamole/protocols/telnet.json | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/f5266fdd/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json
--

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/f5266fdd/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json
--



[jira] [Updated] (GUACAMOLE-567) Network connection problem acknowledgement/feedback

2018-05-27 Thread Nick Couchman (JIRA)

 [ 
https://issues.apache.org/jira/browse/GUACAMOLE-567?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nick Couchman updated GUACAMOLE-567:

Fix Version/s: 1.0.0

> Network connection problem acknowledgement/feedback
> ---
>
> Key: GUACAMOLE-567
> URL: https://issues.apache.org/jira/browse/GUACAMOLE-567
> Project: Guacamole
>  Issue Type: Improvement
>Reporter: Michael Jumper
>Priority: Major
> Fix For: 1.0.0
>
> Attachments: internal-error.png
>
>
> {panel:bgColor=#EE}
> *The description of this issue was copied from 
> [GUAC-1055|https://jira.glyptodon.org/browse/GUAC-1055], an issue in the JIRA 
> instance used by the Guacamole project prior to its move to the ASF.*
> Comments, attachments, related issues, and history from prior to acceptance 
> *may not have been copied* and can be found instead at the original issue.
> {panel}
> When Guacamole detects that the network connection is slow or hanging, it 
> should acknowledge this and unobtrusively notify the user. Lacking such 
> notification, slow networks or remote desktop failures look like Guacamole 
> bugs, and are frequently reported as such.
> Further, the total lack of a network connection is handled within JavaScript, 
> but the error code is not recognized by the Guacamole client. The unknown 
> error is thus translated into a generic "An internal error has occurred ..." 
> message, which is obviously incorrect:
> !internal-error.png|width=320!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


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

2018-05-27 Thread vnick
GUACAMOLE-565: Merge add terminal-type parameter for SSH and Telnet.


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

Branch: refs/heads/master
Commit: ff9f3ae7e7d048d5042459c4136f03651df8fb53
Parents: 1710c31 ad7d3dd
Author: Nick Couchman 
Authored: Sun May 27 15:16:12 2018 -0400
Committer: Nick Couchman 
Committed: Sun May 27 15:16:12 2018 -0400

--
 .../src/main/resources/org/apache/guacamole/protocols/ssh.json  | 5 +
 .../main/resources/org/apache/guacamole/protocols/telnet.json   | 5 +
 2 files changed, 10 insertions(+)
--




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

2018-05-27 Thread vnick
Repository: guacamole-client
Updated Branches:
  refs/heads/master 1710c31fc -> ff9f3ae7e


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

Add the new terminal-type parameter to the protocol JSON files.


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

Branch: refs/heads/master
Commit: ad7d3dde34cc1da720db08e5568ead9175ed4168
Parents: fed5133
Author: Jim Chen 
Authored: Wed May 16 11:57:31 2018 -0400
Committer: Jim Chen 
Committed: Sat May 26 23:52:24 2018 -0400

--
 .../src/main/resources/org/apache/guacamole/protocols/ssh.json  | 5 +
 .../main/resources/org/apache/guacamole/protocols/telnet.json   | 5 +
 2 files changed, 10 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/ad7d3dde/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json
--
diff --git 
a/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json 
b/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json
index 442214a..a0cb7d8 100644
--- a/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json
+++ b/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/ssh.json
@@ -83,6 +83,11 @@
 "name": "backspace",
 "type": "ENUM",
 "options" : [ "", "127", "8" ]
+},
+{
+"name"  : "terminal-type",
+"type": "ENUM",
+"options" : [ "xterm", "xterm-256color", "vt220", "vt100", 
"ansi", "linux" ]
 }
 ]
 },

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/ad7d3dde/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json
--
diff --git 
a/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json 
b/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json
index 5b960f8..5d60281 100644
--- 
a/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json
+++ 
b/guacamole-ext/src/main/resources/org/apache/guacamole/protocols/telnet.json
@@ -66,6 +66,11 @@
 "name": "backspace",
 "type": "ENUM",
 "options" : [ "", "127", "8" ]
+},
+{
+"name"  : "terminal-type",
+"type": "ENUM",
+"options" : [ "xterm", "xterm-256color", "vt220", "vt100", 
"ansi", "linux" ]
 }
 ]
 },



[jira] [Created] (GUACAMOLE-567) Network connection problem acknowledgement/feedback

2018-05-27 Thread Michael Jumper (JIRA)
Michael Jumper created GUACAMOLE-567:


 Summary: Network connection problem acknowledgement/feedback
 Key: GUACAMOLE-567
 URL: https://issues.apache.org/jira/browse/GUACAMOLE-567
 Project: Guacamole
  Issue Type: Improvement
Reporter: Michael Jumper
 Attachments: internal-error.png

{panel:bgColor=#EE}
*The description of this issue was copied from 
[GUAC-1055|https://jira.glyptodon.org/browse/GUAC-1055], an issue in the JIRA 
instance used by the Guacamole project prior to its move to the ASF.*

Comments, attachments, related issues, and history from prior to acceptance 
*may not have been copied* and can be found instead at the original issue.
{panel}

When Guacamole detects that the network connection is slow or hanging, it 
should acknowledge this and unobtrusively notify the user. Lacking such 
notification, slow networks or remote desktop failures look like Guacamole 
bugs, and are frequently reported as such.

Further, the total lack of a network connection is handled within JavaScript, 
but the error code is not recognized by the Guacamole client. The unknown error 
is thus translated into a generic "An internal error has occurred ..." message, 
which is obviously incorrect:

!internal-error.png|width=320!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[1/2] guacamole-server git commit: GUACAMOLE-564: Hide APC escape sequence.

2018-05-27 Thread mjumper
Repository: guacamole-server
Updated Branches:
  refs/heads/master 81bba1b58 -> 526152b9c


GUACAMOLE-564: Hide APC escape sequence.

An APC escape sequence contains an arbitrary string command between
(ESC _) and (ESC \) sequences. While we don't support any APC commands, we
should ignore any commands that we do encounter.


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

Branch: refs/heads/master
Commit: b96afce222dc8bc44d1f56dee2b314f1cfe09259
Parents: b61a6ab
Author: Jim Chen 
Authored: Tue Jan 9 22:36:46 2018 -0500
Committer: Jim Chen 
Committed: Sat May 26 23:25:56 2018 -0400

--
 src/terminal/terminal/terminal_handlers.h | 11 +++
 src/terminal/terminal_handlers.c  | 20 
 2 files changed, 31 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/b96afce2/src/terminal/terminal/terminal_handlers.h
--
diff --git a/src/terminal/terminal/terminal_handlers.h 
b/src/terminal/terminal/terminal_handlers.h
index 0b2f9bb..6130d2c 100644
--- a/src/terminal/terminal/terminal_handlers.h
+++ b/src/terminal/terminal/terminal_handlers.h
@@ -186,5 +186,16 @@ int guac_terminal_osc(guac_terminal* term, unsigned char 
c);
  */
 int guac_terminal_ctrl_func(guac_terminal* term, unsigned char c);
 
+/**
+ * Handles terminal control function sequences initiated with "ESC _".
+ *
+ * @param term
+ * The terminal that received the given character of data.
+ *
+ * @param c
+ * The character that was received by the given terminal.
+ */
+int guac_terminal_apc(guac_terminal* term, unsigned char c);
+
 #endif
 

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/b96afce2/src/terminal/terminal_handlers.c
--
diff --git a/src/terminal/terminal_handlers.c b/src/terminal/terminal_handlers.c
index 02e9f9d..afbf20e 100644
--- a/src/terminal/terminal_handlers.c
+++ b/src/terminal/terminal_handlers.c
@@ -367,6 +367,10 @@ int guac_terminal_escape(guac_terminal* term, unsigned 
char c) {
 guac_terminal_reset(term);
 break;
 
+case '_':
+term->char_handler = guac_terminal_apc;
+break;
+
 default:
 guac_client_log(term->client, GUAC_LOG_DEBUG,
 "Unhandled ESC sequence: %c", c);
@@ -1373,3 +1377,19 @@ int guac_terminal_ctrl_func(guac_terminal* term, 
unsigned char c) {
 
 }
 
+int guac_terminal_apc(guac_terminal* term, unsigned char c) {
+
+/* xterm does not implement APC functions and neither do we. Look for the
+ * "ESC \" (string terminator) sequence, while ignoring other chars. */
+static bool escaping = false;
+
+if (escaping) {
+if (c == '\\')
+term->char_handler = guac_terminal_echo;
+escaping = false;
+}
+
+if (c == 0x1B)
+escaping = true;
+return 0;
+}



[2/2] guacamole-server git commit: GUACAMOLE-564: Merge changes ignoring APC sequences within Guacamole's terminal emulator.

2018-05-27 Thread mjumper
GUACAMOLE-564: Merge changes ignoring APC sequences within Guacamole's terminal 
emulator.


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

Branch: refs/heads/master
Commit: 526152b9c6efc731a940cf5ee7f9f32c93973c3d
Parents: 81bba1b b96afce
Author: Michael Jumper 
Authored: Sun May 27 09:31:35 2018 -0700
Committer: Michael Jumper 
Committed: Sun May 27 09:31:35 2018 -0700

--
 src/terminal/terminal/terminal_handlers.h | 11 +++
 src/terminal/terminal_handlers.c  | 20 
 2 files changed, 31 insertions(+)
--




[5/6] guacamole-server git commit: GUACAMOLE-470: Set palette index for parsed RGB colors.

2018-05-27 Thread mjumper
GUACAMOLE-470: Set palette index for parsed RGB colors.

Parsed RGB colors do not correspond to any palette entry, so set the
palette index to -1.


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

Branch: refs/heads/master
Commit: 7e68901cebac639f615fc87449cfc5a34e1c582f
Parents: 1bd537c
Author: Jim Chen 
Authored: Tue Jan 9 22:08:13 2018 -0500
Committer: Jim Chen 
Committed: Sat May 26 23:18:27 2018 -0400

--
 src/terminal/xparsecolor.c | 4 
 1 file changed, 4 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/7e68901c/src/terminal/xparsecolor.c
--
diff --git a/src/terminal/xparsecolor.c b/src/terminal/xparsecolor.c
index 5aa1fd4..779374d 100644
--- a/src/terminal/xparsecolor.c
+++ b/src/terminal/xparsecolor.c
@@ -33,6 +33,7 @@ int guac_terminal_xparsecolor(const char* spec,
 
 /* 12-bit RGB ("rgb:h/h/h"), zero-padded to 24-bit */
 if (sscanf(spec, "rgb:%1x/%1x/%1x", &red, &green, &blue) == 3) {
+color->palette_index = -1; /* Not from palette. */
 color->red   = red   << 4;
 color->green = green << 4;
 color->blue  = blue  << 4;
@@ -41,6 +42,7 @@ int guac_terminal_xparsecolor(const char* spec,
 
 /* 24-bit RGB ("rgb:hh/hh/hh") */
 if (sscanf(spec, "rgb:%2x/%2x/%2x", &red, &green, &blue) == 3) {
+color->palette_index = -1; /* Not from palette. */
 color->red   = red;
 color->green = green;
 color->blue  = blue;
@@ -49,6 +51,7 @@ int guac_terminal_xparsecolor(const char* spec,
 
 /* 36-bit RGB ("rgb:hhh/hhh/hhh"), truncated to 24-bit */
 if (sscanf(spec, "rgb:%3x/%3x/%3x", &red, &green, &blue) == 3) {
+color->palette_index = -1; /* Not from palette. */
 color->red   = red   >> 4;
 color->green = green >> 4;
 color->blue  = blue  >> 4;
@@ -57,6 +60,7 @@ int guac_terminal_xparsecolor(const char* spec,
 
 /* 48-bit RGB ("rgb://"), truncated to 24-bit */
 if (sscanf(spec, "rgb:%4x/%4x/%4x", &red, &green, &blue) == 3) {
+color->palette_index = -1; /* Not from palette. */
 color->red   = red   >> 8;
 color->green = green >> 8;
 color->blue  = blue  >> 8;



[1/6] guacamole-server git commit: GUACAMOLE-470: Add support for configurable default palette.

2018-05-27 Thread mjumper
Repository: guacamole-server
Updated Branches:
  refs/heads/master 4eae5d2e6 -> 81bba1b58


GUACAMOLE-470: Add support for configurable default palette.

Add support for configuring a default palette for a terminal display.
When the default palette is specified during display creation, that
palette is used instead of GUAC_TERMINAL_INITIAL_PALETTE when resetting
the display palette.


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

Branch: refs/heads/master
Commit: f8b35078fc2eab22a982f43100f6c07d55931a05
Parents: b61a6ab
Author: Jim Chen 
Authored: Tue Jan 9 22:14:56 2018 -0500
Committer: Jim Chen 
Committed: Tue May 15 22:05:59 2018 -0400

--
 src/terminal/display.c  | 13 -
 src/terminal/terminal.c |  2 +-
 src/terminal/terminal/display.h | 11 +--
 3 files changed, 22 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/f8b35078/src/terminal/display.c
--
diff --git a/src/terminal/display.c b/src/terminal/display.c
index 3ad1cba..9391ec1 100644
--- a/src/terminal/display.c
+++ b/src/terminal/display.c
@@ -246,7 +246,8 @@ int __guac_terminal_set(guac_terminal_display* display, int 
row, int col, int co
 
 guac_terminal_display* guac_terminal_display_alloc(guac_client* client,
 const char* font_name, int font_size, int dpi,
-guac_terminal_color* foreground, guac_terminal_color* background) {
+guac_terminal_color* foreground, guac_terminal_color* background,
+const guac_terminal_color (*palette)[256]) {
 
 PangoFontMap* font_map;
 PangoFont* font;
@@ -294,6 +295,7 @@ guac_terminal_display* 
guac_terminal_display_alloc(guac_client* client,
 
 display->default_foreground = display->glyph_foreground = *foreground;
 display->default_background = display->glyph_background = *background;
+display->default_palette = palette;
 
 /* Calculate character dimensions */
 display->char_width =
@@ -317,6 +319,9 @@ guac_terminal_display* 
guac_terminal_display_alloc(guac_client* client,
 
 void guac_terminal_display_free(guac_terminal_display* display) {
 
+/* Free default palette. */
+free((void*) display->default_palette);
+
 /* Free operations buffers */
 free(display->operations);
 
@@ -328,6 +333,12 @@ void guac_terminal_display_free(guac_terminal_display* 
display) {
 void guac_terminal_display_reset_palette(guac_terminal_display* display) {
 
 /* Reinitialize palette with default values */
+if (display->default_palette) {
+memcpy(display->palette, *display->default_palette,
+   sizeof(GUAC_TERMINAL_INITIAL_PALETTE));
+return;
+}
+
 memcpy(display->palette, GUAC_TERMINAL_INITIAL_PALETTE,
 sizeof(GUAC_TERMINAL_INITIAL_PALETTE));
 

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/f8b35078/src/terminal/terminal.c
--
diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c
index 076305a..a9f5ae5 100644
--- a/src/terminal/terminal.c
+++ b/src/terminal/terminal.c
@@ -332,7 +332,7 @@ guac_terminal* guac_terminal_create(guac_client* client,
 term->display = guac_terminal_display_alloc(client,
 font_name, font_size, dpi,
 &default_char.attributes.foreground,
-&default_char.attributes.background);
+&default_char.attributes.background, NULL);
 
 /* Fail if display init failed */
 if (term->display == NULL) {

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/f8b35078/src/terminal/terminal/display.h
--
diff --git a/src/terminal/terminal/display.h b/src/terminal/terminal/display.h
index e51b07f..98337fd 100644
--- a/src/terminal/terminal/display.h
+++ b/src/terminal/terminal/display.h
@@ -139,6 +139,12 @@ typedef struct guac_terminal_display {
 guac_terminal_color palette[256];
 
 /**
+ * The default palette. Use GUAC_TERMINAL_INITIAL_PALETTE if null.
+ * Must free on destruction if not null.
+ */
+const guac_terminal_color (*default_palette)[256];
+
+/**
  * Default foreground color for all glyphs.
  */
 guac_terminal_color default_foreground;
@@ -215,7 +221,8 @@ typedef struct guac_terminal_display {
  */
 guac_terminal_display* guac_terminal_display_alloc(guac_client* client,
 const char* font_name, int font_size, int dpi,
-guac_terminal_color* foreground, guac_terminal_color* background);
+

[4/6] guacamole-server git commit: GUACAMOLE-470: Support configurable colors in color-scheme parameter.

2018-05-27 Thread mjumper
GUACAMOLE-470: Support configurable colors in color-scheme parameter.

Add support for configuring individual colors in the color-scheme
parameter, by parsing the parameter content into name-value pairs.
Backward compatibility is preserved by translating previously supported
values into corresponding new values.


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

Branch: refs/heads/master
Commit: 1bd537c350303b0de41f666bc795561dc04beb6c
Parents: f8b3507
Author: Jim Chen 
Authored: Wed May 16 00:23:15 2018 -0400
Committer: Jim Chen 
Committed: Sat May 26 23:18:27 2018 -0400

--
 src/protocols/ssh/settings.c |  10 +-
 src/protocols/telnet/settings.c  |  10 +-
 src/terminal/terminal.c  | 299 ++
 src/terminal/terminal/terminal.h |  15 ++
 4 files changed, 292 insertions(+), 42 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/1bd537c3/src/protocols/ssh/settings.c
--
diff --git a/src/protocols/ssh/settings.c b/src/protocols/ssh/settings.c
index 983f7f0..923c9e1 100644
--- a/src/protocols/ssh/settings.c
+++ b/src/protocols/ssh/settings.c
@@ -121,10 +121,12 @@ enum SSH_ARGS_IDX {
 #endif
 
 /**
- * The name of the color scheme to use. Currently valid color schemes are:
- * "black-white", "white-black", "gray-black", and "green-black", each
- * following the "foreground-background" pattern. By default, this will be
- * "gray-black".
+ * The color scheme to use, as a series of semicolon-separated color-value
+ * pairs: "background: ", "foreground: ", or
+ * "color: ", where  is a number from 0 to 255, and  is
+ * "color" or an X11 color code (e.g. "aqua" or "rgb:12/34/56").
+ * The color scheme can also be one of the special values: "black-white",
+ * "white-black", "gray-black", or "green-black".
  */
 IDX_COLOR_SCHEME,
 

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/1bd537c3/src/protocols/telnet/settings.c
--
diff --git a/src/protocols/telnet/settings.c b/src/protocols/telnet/settings.c
index 8f80291..45d6290 100644
--- a/src/protocols/telnet/settings.c
+++ b/src/protocols/telnet/settings.c
@@ -99,10 +99,12 @@ enum TELNET_ARGS_IDX {
 IDX_FONT_SIZE,
 
 /**
- * The name of the color scheme to use. Currently valid color schemes are:
- * "black-white", "white-black", "gray-black", and "green-black", each
- * following the "foreground-background" pattern. By default, this will be
- * "gray-black".
+ * The color scheme to use, as a series of semicolon-separated color-value
+ * pairs: "background: ", "foreground: ", or
+ * "color: ", where  is a number from 0 to 255, and  is
+ * "color" or an X11 color code (e.g. "aqua" or "rgb:12/34/56").
+ * The color scheme can also be one of the special values: "black-white",
+ * "white-black", "gray-black", or "green-black".
  */
 IDX_COLOR_SCHEME,
 

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/1bd537c3/src/terminal/terminal.c
--
diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c
index a9f5ae5..50d24be 100644
--- a/src/terminal/terminal.c
+++ b/src/terminal/terminal.c
@@ -29,7 +29,9 @@
 #include "terminal/terminal_handlers.h"
 #include "terminal/types.h"
 #include "terminal/typescript.h"
+#include "terminal/xparsecolor.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -255,53 +257,255 @@ void* guac_terminal_thread(void* data) {
 
 }
 
-guac_terminal* guac_terminal_create(guac_client* client,
-const char* font_name, int font_size, int dpi,
-int width, int height, const char* color_scheme,
-const int backspace) {
+/**
+ * Compare a non-null-terminated string to a null-terminated literal, in the
+ * same manner as strcmp().
+ *
+ * @param str_start
+ * Start of the non-null-terminated string.
+ *
+ * @param str_end
+ * End of the non-null-terminated string, after the last character.
+ *
+ * @param literal
+ * The null-terminated literal to compare against.
+ *
+ * @return
+ * Zero if the two strings are equal and non-zero otherwise.
+ */
+static int guac_terminal_color_scheme_compare_token(const char* str_start,
+const char* str_end, const char* literal) {
 
-int default_foreground;
-int default_background;
+const int result = strncmp(literal, str_start, str_end - str_start);
+if (result != 0)
+return result;

[6/6] guacamole-server git commit: GUACAMOLE-470: Merge support for fully configurable terminal color palette.

2018-05-27 Thread mjumper
GUACAMOLE-470: Merge support for fully configurable terminal color palette.


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

Branch: refs/heads/master
Commit: 81bba1b587ebfcb1e403ffc3a187a3d5315623bd
Parents: 4eae5d2 6da9236
Author: Michael Jumper 
Authored: Sun May 27 08:49:18 2018 -0700
Committer: Michael Jumper 
Committed: Sun May 27 08:49:18 2018 -0700

--
 src/protocols/ssh/settings.c |  10 +-
 src/protocols/telnet/settings.c  |  10 +-
 src/terminal/display.c   |  13 +-
 src/terminal/named-colors.c  |   2 +-
 src/terminal/terminal.c  | 302 ++
 src/terminal/terminal/display.h  |  11 +-
 src/terminal/terminal/terminal.h |  15 ++
 src/terminal/xparsecolor.c   |   4 +
 8 files changed, 321 insertions(+), 46 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/81bba1b5/src/protocols/ssh/settings.c
--

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/81bba1b5/src/protocols/telnet/settings.c
--



[3/6] guacamole-server git commit: GUACAMOLE-470: Fix crash when X11 color is not found.

2018-05-27 Thread mjumper
GUACAMOLE-470: Fix crash when X11 color is not found.

Fix a crash when an X11 color name is not found. The variable to
null-check should be `found`, not `color`.


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

Branch: refs/heads/master
Commit: 03d9c51b5d3e15cac7148e8cc733af7ae8c9f6cc
Parents: 7e68901
Author: Jim Chen 
Authored: Wed May 16 00:11:30 2018 -0400
Committer: Jim Chen 
Committed: Sat May 26 23:18:27 2018 -0400

--
 src/terminal/named-colors.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/03d9c51b/src/terminal/named-colors.c
--
diff --git a/src/terminal/named-colors.c b/src/terminal/named-colors.c
index 89deee8..b0e579b 100644
--- a/src/terminal/named-colors.c
+++ b/src/terminal/named-colors.c
@@ -786,7 +786,7 @@ int guac_terminal_find_color(const char* name, 
guac_terminal_color* color) {
 guac_terminal_named_color_search);
 
 /* Fail if no such color is found */
-if (color == NULL)
+if (found == NULL)
 return 1;
 
 /* Otherwise copy the found color */



[2/6] guacamole-server git commit: GUACAMOLE-470: Reset character attributes on terminal reset.

2018-05-27 Thread mjumper
GUACAMOLE-470: Reset character attributes on terminal reset.

The character attributes such as foreground/background colors should be
reset as well when performing a terminal reset.


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

Branch: refs/heads/master
Commit: 6da9236ffdd0fce61a08fc2e0f86ba4642215993
Parents: 03d9c51
Author: Jim Chen 
Authored: Wed May 16 00:13:07 2018 -0400
Committer: Jim Chen 
Committed: Sat May 26 23:18:27 2018 -0400

--
 src/terminal/terminal.c | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/6da9236f/src/terminal/terminal.c
--
diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c
index 50d24be..7096add 100644
--- a/src/terminal/terminal.c
+++ b/src/terminal/terminal.c
@@ -180,6 +180,9 @@ void guac_terminal_reset(guac_terminal* term) {
 term->tab_interval = 8;
 memset(term->custom_tabs, 0, sizeof(term->custom_tabs));
 
+/* Reset character attributes */
+term->current_attributes = term->default_char.attributes;
+
 /* Reset display palette */
 guac_terminal_display_reset_palette(term->display);
 



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

2018-05-27 Thread vnick
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 
Authored: Tue Jan 9 23:11:12 2018 -0500
Committer: Jim Chen 
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 termi

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

2018-05-27 Thread vnick
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 
Authored: Sun May 27 07:18:46 2018 -0400
Committer: Nick Couchman 
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(-)
--