From 3823165d7f74aa1ac07b436f8a4b4467d5050329 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 11 Apr 2014 13:45:19 -0700 Subject: [PATCH] GUAC-598: Fix warnings against SSH. --- src/protocols/ssh/ssh_client.c | 7 +++++-- src/protocols/ssh/terminal.h | 2 +- src/protocols/ssh/terminal_handlers.c | 18 +++++++++--------- src/protocols/ssh/terminal_handlers.h | 20 +++++++++----------- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/protocols/ssh/ssh_client.c b/src/protocols/ssh/ssh_client.c index ecb601b1..1ccd7c19 100644 --- a/src/protocols/ssh/ssh_client.c +++ b/src/protocols/ssh/ssh_client.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -129,15 +130,17 @@ static int __sign_callback(LIBSSH2_SESSION* session, const unsigned char* data, size_t data_len, void **abstract) { ssh_key* key = (ssh_key*) abstract; + int length; /* Allocate space for signature */ *sig = malloc(4096); /* Sign with key */ - *sig_len = ssh_key_sign(key, (const char*) data, data_len, *sig); - if (*sig_len < 0) + length = ssh_key_sign(key, (const char*) data, data_len, *sig); + if (length < 0) return 1; + *sig_len = length; return 0; } diff --git a/src/protocols/ssh/terminal.h b/src/protocols/ssh/terminal.h index a6a428ac..c48ae7dc 100644 --- a/src/protocols/ssh/terminal.h +++ b/src/protocols/ssh/terminal.h @@ -52,7 +52,7 @@ typedef struct guac_terminal guac_terminal; * the current char handler for the terminal is called and given that * character. */ -typedef int guac_terminal_char_handler(guac_terminal* term, char c); +typedef int guac_terminal_char_handler(guac_terminal* term, unsigned char c); /** * Represents a terminal emulator which uses a given Guacamole client to diff --git a/src/protocols/ssh/terminal_handlers.c b/src/protocols/ssh/terminal_handlers.c index 71f28262..60786283 100644 --- a/src/protocols/ssh/terminal_handlers.c +++ b/src/protocols/ssh/terminal_handlers.c @@ -45,7 +45,7 @@ */ #define GUAC_TERMINAL_OK "\x1B[0n" -int guac_terminal_echo(guac_terminal* term, char c) { +int guac_terminal_echo(guac_terminal* term, unsigned char c) { static int bytes_remaining = 0; static int codepoint = 0; @@ -216,7 +216,7 @@ int guac_terminal_echo(guac_terminal* term, char c) { } -int guac_terminal_escape(guac_terminal* term, char c) { +int guac_terminal_escape(guac_terminal* term, unsigned char c) { switch (c) { @@ -360,7 +360,7 @@ static const int* __guac_terminal_get_char_mapping(char c) { } -int guac_terminal_g0_charset(guac_terminal* term, char c) { +int guac_terminal_g0_charset(guac_terminal* term, unsigned char c) { term->char_mapping[0] = __guac_terminal_get_char_mapping(c); term->char_handler = guac_terminal_echo; @@ -368,7 +368,7 @@ int guac_terminal_g0_charset(guac_terminal* term, char c) { } -int guac_terminal_g1_charset(guac_terminal* term, char c) { +int guac_terminal_g1_charset(guac_terminal* term, unsigned char c) { term->char_mapping[1] = __guac_terminal_get_char_mapping(c); term->char_handler = guac_terminal_echo; @@ -400,7 +400,7 @@ static bool* __guac_terminal_get_flag(guac_terminal* term, int num, char private } -int guac_terminal_csi(guac_terminal* term, char c) { +int guac_terminal_csi(guac_terminal* term, unsigned char c) { /* CSI function arguments */ static int argc = 0; @@ -876,7 +876,7 @@ int guac_terminal_csi(guac_terminal* term, char c) { } -int guac_terminal_guac_set_directory(guac_terminal* term, char c) { +int guac_terminal_guac_set_directory(guac_terminal* term, unsigned char c) { static char filename[2048]; static int length = 0; @@ -897,7 +897,7 @@ int guac_terminal_guac_set_directory(guac_terminal* term, char c) { } -int guac_terminal_guac_download(guac_terminal* term, char c) { +int guac_terminal_guac_download(guac_terminal* term, unsigned char c) { static char filename[2048]; static int length = 0; @@ -918,7 +918,7 @@ int guac_terminal_guac_download(guac_terminal* term, char c) { } -int guac_terminal_osc(guac_terminal* term, char c) { +int guac_terminal_osc(guac_terminal* term, unsigned char c) { static int operation = 0; @@ -949,7 +949,7 @@ int guac_terminal_osc(guac_terminal* term, char c) { return 0; } -int guac_terminal_ctrl_func(guac_terminal* term, char c) { +int guac_terminal_ctrl_func(guac_terminal* term, unsigned char c) { int row; diff --git a/src/protocols/ssh/terminal_handlers.h b/src/protocols/ssh/terminal_handlers.h index 46f869e5..bccad21a 100644 --- a/src/protocols/ssh/terminal_handlers.h +++ b/src/protocols/ssh/terminal_handlers.h @@ -28,17 +28,15 @@ #include "terminal.h" -int guac_terminal_echo(guac_terminal* term, char c); -int guac_terminal_escape(guac_terminal* term, char c); -int guac_terminal_g0_charset(guac_terminal* term, char c); -int guac_terminal_g1_charset(guac_terminal* term, char c); -int guac_terminal_g2_charset(guac_terminal* term, char c); -int guac_terminal_g3_charset(guac_terminal* term, char c); -int guac_terminal_csi(guac_terminal* term, char c); -int guac_terminal_guac_download(guac_terminal* term, char c); -int guac_terminal_guac_set_directory(guac_terminal* term, char c); -int guac_terminal_osc(guac_terminal* term, char c); -int guac_terminal_ctrl_func(guac_terminal* term, char c); +int guac_terminal_echo(guac_terminal* term, unsigned char c); +int guac_terminal_escape(guac_terminal* term, unsigned char c); +int guac_terminal_g0_charset(guac_terminal* term, unsigned char c); +int guac_terminal_g1_charset(guac_terminal* term, unsigned char c); +int guac_terminal_csi(guac_terminal* term, unsigned char c); +int guac_terminal_guac_download(guac_terminal* term, unsigned char c); +int guac_terminal_guac_set_directory(guac_terminal* term, unsigned char c); +int guac_terminal_osc(guac_terminal* term, unsigned char c); +int guac_terminal_ctrl_func(guac_terminal* term, unsigned char c); #endif