Commit Graph

3410 Commits

Author SHA1 Message Date
Virtually Nick
a6a7e8ac26
GUACAMOLE-1201: Merge throttle outbound audio data to avoid overflowing RDP server audio input buffer. 2021-05-01 22:10:11 -04:00
Michael Jumper
189d8fab30 GUACAMOLE-1201: Throttle outbound audio data to avoid overflowing RDP server audio input buffer.
The RDP specification for the AUDIO_INPUT channel requires that all
audio be sent in packets of a specific size. Guacamole does correctly
limit itself to sending packets of this size to the RDP server, but will
send quite a few of these packets all at once if it has received more
audio data than the RDP packet size. This is OK in principle (the
Guacamole client should be able to send audio in packets of whatever
size it chooses), but may overwhelm the software running within the RDP
server if the amount of data received exceeds the available buffer
space, resulting in dropped samples.

As there is no way to know the size of the remote audio buffer, we need
to instead ensure that audio is streamed as close to real time as
possible, with each audio packet of N bytes not being sent until roughly
the amount of time represented by those N bytes has elapsed since the
last packet. This throttling ensures that software expecting to process
audio in real time should never run out of buffer space.

That said, if we never exceed the per-packet data rate and occasionally
send a packet earlier than real time would dictate, unavoidable latency
in sending/receiving audio data would accumulate over time. For example,
if each audio packet represents 10ms of audio data, but we receive that
audio packet 10.1ms after the previous packet, we need to adjust the
timing of the next audio packet(s) to account for that additional 0.1ms.
Simply waiting 10ms after sending each packet would cause that 0.1ms to
accumulate each time it occurs, eventually resulting in noticable
latency and finally running out of buffer space.

Thus, these changes:

1. Leverage a flush thread and per-packet scheduling to ensure that each
   flushed audio packet does not exceed the equivalent real time rate.
2. Calculate the amount of additional latency from the amount of data
   received beyond the required packet size, and amortize scheduling
   corrections to account for that latency over the next several audio
   packets.

This ensures that audio is streamed exactly as it is received if the
audio matches the packet size of the RDP server, and audio that is
received in a different size or varying sizes is buffered and throttled
to keep things within the expectations of software running within the
RDP server.
2021-05-01 16:23:32 -07:00
Virtually Nick
e90e438cf6
GUACAMOLE-1283: Merge add synchronization around absolutely all outbound RDP messages. 2021-04-17 13:11:32 -04:00
Michael Jumper
bf6922b31e GUACAMOLE-1283: Remove redundant parameters from guac_rdp_audio_buffer callback.
The buffer and data parameters of the guac_rdp_audio_buffer flush
handler are redundant now that the guac_rdp_audio_buffer is being passed
to the handler. They can instead be referenced as audio_buffer->packet
and audio_buffer->data respectively.
2021-04-13 17:47:56 -07:00
Michael Jumper
27e762d06f GUACAMOLE-1283: Add synchronization around absolutely all outbound RDP messages.
The FreeRDP library is intended to be threadsafe, but is not reliably so
with respect to legacy RDP encryption and outbound messages. When
outbound messages are sent by multiple threads, the encryption key used
for legacy RDP encryption may not be updated correctly, resulting in a
fatal connection error like:

"ERRINFO_DECRYPT_FAILED (0x00001192):(a) Decryption using Standard RDP
Security mechanisms (section 5.3.6) failed. (b) Session key creation
using Standard RDP Security mechanisms (section 5.3.5) failed."
2021-04-08 15:43:15 -07:00
Virtually Nick
b2ae2fdf00
GUACAMOLE-1307: Merge use VerifyCertificateEx callback if supported. 2021-03-10 14:38:43 -05:00
Michael Jumper
1b78f611d3 GUACAMOLE-1307: Use VerifyCertificateEx callback if supported. 2021-03-09 22:53:11 -08:00
James Muehlner
e2a136f41e
GUACAMOLE-1302: Merge support for forcing lossless compression in VNC and RDP connections. 2021-03-03 19:31:25 -08:00
Michael Jumper
18a0362dab GUACAMOLE-1302: Add RDP support for forcing lossless compression. 2021-03-03 19:29:14 -08:00
Michael Jumper
c2b7e2d039 GUACAMOLE-1302: Add VNC support for forcing lossless compression. 2021-03-03 19:29:14 -08:00
Michael Jumper
27f8403178 GUACAMOLE-1302: Always use lossless compression for text-based protocols leveraging the terminal. 2021-03-03 19:29:14 -08:00
Michael Jumper
0729a6cc73 GUACAMOLE-1302: Add surface/display level support for forcing lossless compression. 2021-03-03 19:29:14 -08:00
Virtually Nick
d9d5c79644
GUACAMOLE-1305: Merge fix pt-br keyboard layout 2021-03-03 16:19:20 -05:00
Higor Cavalcanti
650e7ad90f GUACAMOLE-1305: Fix pt-br keyboard layout. Key being recognized as right shift. 2021-03-03 16:49:59 -03:00
Virtually Nick
7bbab0efdd
GUACAMOLE-1174: Merge correct handling of truncated parameters when appending to URLs. 2021-02-21 20:32:47 -05:00
Michael Jumper
a920932703 GUACAMOLE-1174: Correct logic detecting truncation of appended parameter.
The previous implementation passed `length - str_len` to `snprintf()`,
yet compared the return value to `length`. This is incorrect, as
`length` is not the buffer size provided to `snprintf()`.
2021-02-21 15:05:53 -08:00
Michael Jumper
c7935736da GUACAMOLE-1174: Add unit tests for URL utility functions. 2021-02-21 15:05:53 -08:00
Michael Jumper
7f55399304 GUACAMOLE-1174: Clarify behavior of URL parameter appending function. 2021-02-21 14:15:17 -08:00
Mike Jumper
5428ac5057
GUACAMOLE-1174: Merge support for Kubernetes "exec" API call. 2021-02-21 11:09:53 -08:00
James Muehlner
ca1fbd5e98
GUACAMOLE-1204: Merge addition of server-side support for multi-touch events. 2021-02-11 20:53:22 -08:00
Michael Jumper
d16ba33dee GUACAMOLE-1204: Add support for including touch events within session recordings. 2021-02-11 20:12:21 -08:00
Michael Jumper
5eb2867733 GUACAMOLE-1204: Add RDP support for multi-touch events via RDPEI channel. 2021-02-11 20:12:21 -08:00
Michael Jumper
048a59310b GUACAMOLE-1204: Add support for declaring layer multi-touch capabilities. 2021-02-11 20:12:21 -08:00
Michael Jumper
c88c0d1c89 GUACAMOLE-1204: Add libguac support for processing the "touch" instruction. 2021-02-11 20:12:21 -08:00
Virtually Nick
4a38d39694
GUACAMOLE-1277: Merge unswap - and _ on fr-be-azerty keymap 2021-02-02 15:54:12 -05:00
Sander Vanheule
841dc28e9b GUACAMOLE-1277: Unswap -/_ on fr-be-azerty keymap
When using the fr-be-azerty remote keyboard layout on an RDP connection,
the dash ('-') and underscore ('_') are swapped.

Underscore and dash are located on the same key on a Belgian azerty
layout. Dash should be the normal/unshifted character, and underscore
should be the shifted character. The current mapping has this the other
way around, so let's fix this.

Signed-off-by: Sander Vanheule <Sander.Vanheule@UGent.be>
2021-02-02 19:53:51 +01:00
Mike Jumper
c122a5f14a
GUACAMOLE-1133: Merge build-time sanity check for libvncserver usage of gcrypt. 2021-01-24 14:15:35 -08:00
Nick Couchman
5cee64514f GUACAMOLE-1133: Add gcrypt build dependency for Docker image. 2021-01-23 22:16:58 -05:00
Nick Couchman
b40b7e7bf6 GUACAMOLE-1133: Add build check for headers when libvncserver includes gcrypt support. 2021-01-23 22:04:38 -05:00
Mike Jumper
6d526cb60f
GUACAMOLE-1133: Merge addition of GCrypt initialization to VNC startup process. 2021-01-22 21:33:10 -08:00
Nick Couchman
46bed49a43 GUACAMOLE-1133: initialize GCrypt in VNC protocol prior to client start-up. 2021-01-21 21:14:18 -05:00
Virtually Nick
c769d18cf6
GUACAMOLE-1263: Merge mark freed memory as freed prior to calling rfbClientCleanup(). 2021-01-15 14:51:36 -05:00
Michael Jumper
612c5eba20 GUACAMOLE-1263: Mark freed memory as freed prior to calling rfbClientCleanup().
Older versions of libvncclient did not free all memory within
rfbClientCleanup(), but this has been corrected as of their 0.9.12
release. As guacamole-server may well be built against older versions of
libvncclient, we can't simply remove the manual free() calls, but we
should be sure to set any memory that we free ourselves to NULL so that
rfbClientCleanup() does not attempt to free it again.
2021-01-15 11:46:16 -08:00
Virtually Nick
fe62300223
GUACAMOLE-1259: Merge include missing config.h header for sake of conditional Stream_Free(). 2021-01-10 13:09:39 -05:00
Michael Jumper
0b6b14b71e GUACAMOLE-1259: Include missing config.h header for sake of conditional Stream_Free().
The changes introduced by GUACAMOLE-1181 (commit 2c86e20) were made
conditional as older versions of FreeRDP will automatically free the
wStream, resulting in a double-free if we attempt to do so ourselves.

The macro controlling that conditional code is defined within config.h,
which is missing here. Without that macro, the call to Stream_Free()
always occurs, and we get a double-free with older FreeRDP.
2021-01-09 21:15:50 -08:00
Virtually Nick
1c3e86dc2c
GUACAMOLE-1191: Merge always disable the glyph cache due to stability issues. 2021-01-09 22:46:12 -05:00
Michael Jumper
9dc793b0e5 GUACAMOLE-1191: Always disable the glyph cache, as FreeRDP no longer considers the feature to be stable. 2021-01-09 17:49:32 -08:00
Virtually Nick
1e6c42594f
GUACAMOLE-1254: Merge add support for libuuid as alternative to OSSP UUID. 2021-01-07 12:21:11 -05:00
Michael Jumper
430182dce2 GUACAMOLE-1254: Add unit tests for unique ID generation. 2021-01-06 22:51:07 -08:00
Michael Jumper
f710e00d26 GUACAMOLE-1254: Use libuuid rather than OSSP UUID if available.
The libuuid library is widely available (part of util-linux) and much
more frequently updated. The OSSP UUID library works great, but was last
updated in 2008 and causes some confusion for users that have libuuid.
2021-01-06 20:58:22 -08:00
Mike Jumper
53f981f864
GUACAMOLE-1245: Merge support for specifying Wake-on-LAN port. 2020-12-30 21:06:13 -08:00
Nick Couchman
a37668e9f5 GUACAMOLE-1245: Add support for specifying Wake-on-LAN port. 2020-12-30 16:50:38 -05:00
Nick Couchman
68c5dd1730 Merge 1.3.0 changes back to master. 2020-12-25 07:31:03 -05:00
Virtually Nick
90e15cb706
GUACAMOLE-1241: Merge avoid double-free when building against FreeRDP development snapshot. 2020-12-25 07:30:06 -05:00
Michael Jumper
9475c0b6fa GUACAMOLE-1241: Build against Debian repository that has non-snapshot version of FreeRDP.
Debian stable currently provides a FreeRDP package that is a snapshot of
commit 2693389a103394e035edc2a01055ca2c9ccccb21, whereas
stable-backports provides a FreeRDP package from release 2.2.0. Only a
release or release candidate can be relied upon for consistent behavior.
2020-12-24 13:15:58 -08:00
Michael Jumper
218f8d36b1 GUACAMOLE-1241: Disable build against FreeRDP development snapshots unless *explicitly* overridden. 2020-12-22 20:53:06 -08:00
Nick Couchman
d20b385834 Merge 1.3.0 changes back to master. 2020-12-22 19:05:16 -05:00
Virtually Nick
b608bb1513
GUACAMOLE-1242: Merge move "connection closed" log message to debug level. 2020-12-22 18:02:35 -05:00
Michael Jumper
3196f9f0d0 GUACAMOLE-1242: Move "connection closed" log message to debug level.
It is expected under normal circumstances that the connection may be
abruptly closed, including during the handshake. For example, this will
commonly occur when a TCP load balancer is performing a simple service
health check.

An message noting that the connection has been closed during the
Guacamole protocol handshake is really only of benefit when debugging,
where that information may provide useful context. If not debugging, the
message amounts to log noise.
2020-12-22 13:00:48 -08:00
Virtually Nick
2fc3a43e87
GUACAMOLE-1225: Merge fix simple typo, verfying -> verifying, in code documentation 2020-12-21 08:00:29 -05:00