Repository: guacamole-server Updated Branches: refs/heads/master d7cfff324 -> 54fda2136
GUACAMOLE-622: Do not allow STDIN to be redirected if the terminal is not yet started. Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/1178b475 Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/1178b475 Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/1178b475 Branch: refs/heads/master Commit: 1178b475dad6b8c567041dda8e3fabd34a584f75 Parents: 286cbf3 Author: Michael Jumper <mjum...@apache.org> Authored: Sat Sep 1 21:41:13 2018 -0700 Committer: Michael Jumper <mjum...@apache.org> Committed: Sun Sep 2 23:04:14 2018 -0700 ---------------------------------------------------------------------- src/terminal/terminal-stdin-stream.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/1178b475/src/terminal/terminal-stdin-stream.c ---------------------------------------------------------------------- diff --git a/src/terminal/terminal-stdin-stream.c b/src/terminal/terminal-stdin-stream.c index 1f662d6..02f5b94 100644 --- a/src/terminal/terminal-stdin-stream.c +++ b/src/terminal/terminal-stdin-stream.c @@ -103,6 +103,22 @@ static int guac_terminal_input_stream_end_handler(guac_user* user, static int __guac_terminal_send_stream(guac_terminal* term, guac_user* user, guac_stream* stream) { + /* Deny redirecting STDIN if terminal is not started */ + if (!term->started) { + + guac_user_log(user, GUAC_LOG_DEBUG, "Attempt to direct the contents " + "of an inbound stream to STDIN denied. The terminal is not " + "yet ready for input."); + + guac_protocol_send_ack(user->socket, stream, + "Terminal not yet started.", + GUAC_PROTOCOL_STATUS_RESOURCE_CONFLICT); + + guac_socket_flush(user->socket); + return 1; + + } + /* If a stream is already being used for STDIN, deny creation of * further streams */ if (term->input_stream != NULL) {