You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2018/04/02 19:20:54 UTC
[21/23] guacamole-server git commit: GUACAMOLE-269: Clean up logging
and comments, and simplify code.
GUACAMOLE-269: Clean up logging and comments, and simplify code.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/7453bc8f
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/7453bc8f
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/7453bc8f
Branch: refs/heads/master
Commit: 7453bc8f4472cd41e90cf72cfdbbce3d5fa10140
Parents: b441181
Author: Nick Couchman <vn...@apache.org>
Authored: Mon Apr 2 15:04:03 2018 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Mon Apr 2 15:04:03 2018 -0400
----------------------------------------------------------------------
src/protocols/ssh/ssh.c | 4 ++--
src/protocols/ssh/ttymode.c | 5 +----
src/protocols/ssh/ttymode.h | 8 ++++++++
3 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/7453bc8f/src/protocols/ssh/ssh.c
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/ssh.c b/src/protocols/ssh/ssh.c
index dca6208..1a7e6ef 100644
--- a/src/protocols/ssh/ssh.c
+++ b/src/protocols/ssh/ssh.c
@@ -303,8 +303,8 @@ void* ssh_client_thread(void* data) {
int ttymodeBytes = guac_ssh_ttymodes_init(ssh_ttymodes,
GUAC_SSH_TTY_OP_VERASE, settings->backspace, GUAC_SSH_TTY_OP_END);
if (ttymodeBytes < 1)
- guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR, "Error storing TTY mode encoding \
- opcodes and values in array.");
+ guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR, "Unable to set TTY modes."
+ " Backspace may not work as expected.");
/* Request PTY */
if (libssh2_channel_request_pty_ex(ssh_client->term_channel, "linux", sizeof("linux")-1,
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/7453bc8f/src/protocols/ssh/ttymode.c
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/ttymode.c b/src/protocols/ssh/ttymode.c
index 686cbbd..e6731b4 100644
--- a/src/protocols/ssh/ttymode.c
+++ b/src/protocols/ssh/ttymode.c
@@ -33,7 +33,6 @@ int guac_ssh_ttymodes_init(char opcode_array[], ...) {
/* Initialize array pointer and byte counter. */
char *current = opcode_array;
- int bytes = 0;
/* Loop through variable argument list. */
while (true) {
@@ -41,7 +40,6 @@ int guac_ssh_ttymodes_init(char opcode_array[], ...) {
/* Next argument should be an opcode. */
char opcode = (char)va_arg(args, int);
*(current++) = opcode;
- bytes += sizeof(char);
/* If it's the end opcode, we're done. */
if (opcode == GUAC_SSH_TTY_OP_END)
@@ -53,12 +51,11 @@ int guac_ssh_ttymodes_init(char opcode_array[], ...) {
*(current++) = (value >> 16) & 0xFF;
*(current++) = (value >> 8) & 0xFF;
*(current++) = value & 0xFF;
- bytes += sizeof(uint32_t);
}
/* We're done processing arguments. */
va_end(args);
- return bytes;
+ return current - opcode_array;
}
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/7453bc8f/src/protocols/ssh/ttymode.h
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/ttymode.h b/src/protocols/ssh/ttymode.h
index 648d13e..92e081b 100644
--- a/src/protocols/ssh/ttymode.h
+++ b/src/protocols/ssh/ttymode.h
@@ -50,6 +50,14 @@
* to pass a given number of opcodes, which calculates
* the size of the number of opcodes plus the single byte
* end opcode.
+ *
+ * @param num_opcodes
+ * The number of opcodes for which a size in bytes
+ * should be calculated.
+ *
+ * @returns
+ * The number of bytes that the given number of
+ * opcodes will require.
*/
#define GUAC_SSH_TTYMODES_SIZE(num_opcodes) ((GUAC_SSH_TTY_OPCODE_SIZE * num_opcodes) + 1)