GitHub user mike-jumper opened a pull request:
https://github.com/apache/guacamole-server/pull/178
GUACAMOLE-559: Fix race condition in receipt of clipboard data by terminal.
As of recent changes due to
[GUACAMOLE-559](https://issues.apache.org/jira/browse/GUACAMOLE-559), there is
a random change that SSH or telnet connections will segfault while the
connection is being established. This is due to a race condition between the
receipt of initial clipboard data from the client (which happens after the
first frame is received) and the assignment of the terminal to the server-side
client structure (which happens within a thread). Since the clipboard contents
are maintained by the terminal, the structure receiving the new clipboard data
may not be accessible at the time the data is received.
These changes:
1. Remove maintenance of the clipboard from the terminal, instead requiring
that the protocol implementation provide its own `guac_common_clipboard`
instance (same as VNC and RDP). This allows SSH and telnet to allocate the
clipboard during client initialization, which in turn guarantees that the
clipboard will be accessible when clipboard data is received.
2. Modify `guac_common_clipboard` such that the read/write operations are
threadsafe (another potential avenue for issues with clipboard data received at
unexpected times).
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mike-jumper/guacamole-server clipboard-timing
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/guacamole-server/pull/178.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #178
----
commit 860a5fca8f98ae13fcbcce07ef247666666c0d93
Author: Michael Jumper <mjumper@...>
Date: 2018-07-31T06:01:27Z
GUACAMOLE-559: Maintain terminal clipboard at client level such that it is
guaranteed to exist immediately after user connects.
commit 4f25410aa9ec6914d20c4f1b529ddefcd3e4392e
Author: Michael Jumper <mjumper@...>
Date: 2018-07-31T06:20:14Z
GUACAMOLE-559: Guarantee ordered modification to the clipboard. Do not
allow modification of clipboard while clipboard contents are being sent.
----
---