GUACAMOLE-278: Handle (but ignore) xterm's 256-color palette redefinition OSC.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/10180095 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/10180095 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/10180095 Branch: refs/heads/master Commit: 10180095d8ff1618412843338ed5493c96ec2b32 Parents: e4ce7b0 Author: Michael Jumper <[email protected]> Authored: Sun Apr 23 13:59:03 2017 -0700 Committer: Michael Jumper <[email protected]> Committed: Sun Apr 23 13:59:03 2017 -0700 ---------------------------------------------------------------------- src/terminal/terminal/terminal_handlers.h | 12 ++++++++++++ src/terminal/terminal_handlers.c | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/10180095/src/terminal/terminal/terminal_handlers.h ---------------------------------------------------------------------- diff --git a/src/terminal/terminal/terminal_handlers.h b/src/terminal/terminal/terminal_handlers.h index cc97686..0a8fdce 100644 --- a/src/terminal/terminal/terminal_handlers.h +++ b/src/terminal/terminal/terminal_handlers.h @@ -139,6 +139,18 @@ int guac_terminal_open_pipe_stream(guac_terminal* term, unsigned char c); int guac_terminal_close_pipe_stream(guac_terminal* term, unsigned char c); /** + * Parses the remainder of xterm's OSC sequence for redefining the terminal + * emulator's palette. + * + * @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_xterm_palette(guac_terminal* term, unsigned char c); + +/** * Handles the remaining characters of an Operating System Code (OSC) sequence, * typically initiated with "ESC ]". * http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/10180095/src/terminal/terminal_handlers.c ---------------------------------------------------------------------- diff --git a/src/terminal/terminal_handlers.c b/src/terminal/terminal_handlers.c index defca4b..8e83fb1 100644 --- a/src/terminal/terminal_handlers.c +++ b/src/terminal/terminal_handlers.c @@ -1156,6 +1156,19 @@ int guac_terminal_close_pipe_stream(guac_terminal* term, unsigned char c) { } +int guac_terminal_xterm_palette(guac_terminal* term, unsigned char c) { + + /* NOTE: Currently unimplemented. Attempts to set the 256-color palette + * are ignored. */ + + /* Stop on ECMA-48 ST (String Terminator */ + if (c == 0x9C || c == 0x5C || c == 0x07) + term->char_handler = guac_terminal_echo; + + return 0; + +} + int guac_terminal_osc(guac_terminal* term, unsigned char c) { static int operation = 0; @@ -1183,6 +1196,10 @@ int guac_terminal_osc(guac_terminal* term, unsigned char c) { else if (operation == 482203) term->char_handler = guac_terminal_close_pipe_stream; + /* xterm 256-color palette redefinition */ + else if (operation == 4) + term->char_handler = guac_terminal_xterm_palette; + /* Reset parameter for next OSC */ operation = 0;
