diff --git a/protocols/ssh/include/ssh_client.h b/protocols/ssh/include/ssh_client.h index 205cc930..4fcd357a 100644 --- a/protocols/ssh/include/ssh_client.h +++ b/protocols/ssh/include/ssh_client.h @@ -65,6 +65,8 @@ typedef struct ssh_guac_client_data { char password[1024]; int password_length; + int mod_ctrl; + } ssh_guac_client_data; int ssh_guac_client_auth(guac_client* client, const char* password); diff --git a/protocols/ssh/src/ssh_client.c b/protocols/ssh/src/ssh_client.c index 8715da2d..c8d3fbf8 100644 --- a/protocols/ssh/src/ssh_client.c +++ b/protocols/ssh/src/ssh_client.c @@ -114,6 +114,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) { /* Init client data */ client->data = client_data; client_data->term = term; + client_data->mod_ctrl = 0; /* Send name and dimensions */ guac_send_name(io, "SSH TEST"); diff --git a/protocols/ssh/src/ssh_handlers.c b/protocols/ssh/src/ssh_handlers.c index 7580b574..0a072a62 100644 --- a/protocols/ssh/src/ssh_handlers.c +++ b/protocols/ssh/src/ssh_handlers.c @@ -113,13 +113,28 @@ int ssh_guac_client_key_handler(guac_client* client, int keysym, int pressed) { ssh_guac_client_data* client_data = (ssh_guac_client_data*) client->data; + /* Track modifiers */ + if (keysym == 0xFFE3) { + client_data->mod_ctrl = pressed; + } + /* If key pressed */ - if (pressed) { + else if (pressed) { /* If simple ASCII key */ if (keysym >= 0x00 && keysym <= 0xFF) { char data = (char) keysym; + + /* Handle Ctrl modifier */ + if (client_data->mod_ctrl) { + if (keysym >= 'A' && keysym <= 'Z') + data = (char) (keysym - 'A' + 1); + else if (keysym >= 'a' && keysym <= 'z') + data = (char) (keysym - 'a' + 1); + } + return channel_write(client_data->term_channel, &data, 1); + } else {