Patches 003 and 004 regenerated against current upstream: - 003: upstream already added config.h to disp.c and input.c, removed those hunks. NULL guards and remaining config.h additions preserved. - 004: upstream added path_lock field to display layer, adjusted context.
guacamole-server patches
These patches are applied to the apache/guacamole-server source tree before building guacd. They fix compilation and runtime issues when building against FreeRDP 3.x on Debian 13 (Trixie).
001-freerdp3-debian13.patch
Problem: guacamole-server 1.6.1 fails to compile against FreeRDP 3.15+ (as shipped in Debian 13) due to:
-
Autoconf feature detection failure — FreeRDP 3.15 marks
codecs_free()as deprecated. The-Werrorflag inconfigure.accauses all compile-time feature-detection tests to fail, cascading into 10+ undefined macros and wrong#ifdefcode paths. -
Deprecated function pointer API — FreeRDP 3.x deprecates direct struct member access for
->input->KeyboardEvent(),->input->MouseEvent(), etc. behindWITH_FREERDP_DEPRECATED. The safe replacement functions arefreerdp_input_send_keyboard_event(),freerdp_input_send_mouse_event(), etc. -
NULL pointer dereference in display channel — FreeRDP 3.x fires PubSub
ChannelConnectedevents beforeguac_rdp_dispis allocated, causing a segfault when the callback writes todisp->requested_width(offset 0x18 of NULL).
Files patched:
| File | Fix |
|---|---|
configure.ac |
Add -Wno-error=deprecated-declarations to both FreeRDP 2.x and 3.x PKG_CHECK_MODULES blocks so autoconf feature detection works |
src/protocols/rdp/Makefile.am |
Add -Wno-error=deprecated-declarations to all three CFLAGS targets |
src/protocols/rdp/tests/Makefile.am |
Same for test CFLAGS |
src/protocols/rdp/keyboard.c |
Replace ->input->KeyboardEvent(), ->input->UnicodeKeyboardEvent(), ->input->SynchronizeEvent() with safe API functions |
src/protocols/rdp/input-queue.c |
Replace all ->input->MouseEvent() calls with freerdp_input_send_mouse_event() |
src/protocols/rdp/channels/disp.c |
Add NULL guards in guac_rdp_disp_channel_connected() and guac_rdp_disp_channel_disconnected() |
002-kerberos-nla.patch
Feature: Adds Kerberos NLA authentication support to guacd's RDP protocol, based on GUACAMOLE-2057 (PR #581). This allows RDP connections to use Kerberos instead of NTLM for NLA, which is required as Microsoft phases out NTLM.
Three new connection parameters:
| Parameter | Values | FreeRDP3 Setting |
|---|---|---|
auth-pkg |
"" (negotiate), "kerberos", "ntlm" |
FreeRDP_AuthenticationPackageList |
kdc-url |
KDC server URL (optional) | FreeRDP_KerberosKdcUrl |
kerberos-cache |
Path to ccache file (optional) | FreeRDP_KerberosCache |
Files patched:
| File | Fix |
|---|---|
src/protocols/rdp/settings.h |
Add guac_rdp_auth_package enum, add auth_pkg, kdc_url, kerberos_cache fields to guac_rdp_settings |
src/protocols/rdp/settings.c |
Add connection parameter parsing, FreeRDP3 settings push, memory cleanup |
Differences from upstream PR #581:
- Dropped FreeRDP2 code path (not needed on Debian 13)
- Fixed
guac_strdup()leak infreerdp_settings_set_string()calls (FreeRDP3 copies internally) - Fixed typos ("NTML" -> "NTLM", "negotiatoin" -> "negotiation")
Requires: FreeRDP 3.x built with Kerberos support (-DWITH_KRB5=ON). Debian 13's freerdp3-dev includes this by default.
003-null-guard-and-config-h.patch
Problem: Two related issues causing RDP display resize to silently fail:
-
Missing
config.hinclude — Several RDP channel source files andinput.cdo not includeconfig.h, soENABLE_COMMON_SSHis undefined in those compilation units. This causes theguac_rdp_clientstruct to have a different layout (missing 3 SSH pointer fields = 24 bytes), making all field accesses after the#ifdef ENABLE_COMMON_SSHblock read/write wrong memory offsets. Specifically,rdp_client->dispreads NULL (actually therecordingfield), so RDP display resizing silently fails. -
Early size instructions — Browser may send
sizeinstructions before the RDP connection is fully established, causing NULL pointer dereferences in the resize handler.
Files patched:
| File | Fix |
|---|---|
src/protocols/rdp/channels/common-svc.c |
Add #include "config.h" |
src/protocols/rdp/channels/disp.c |
Add #include "config.h", add NULL guard in guac_rdp_disp_set_size() |
src/protocols/rdp/channels/pipe-svc.c |
Add #include "config.h" |
src/protocols/rdp/channels/rdpei.c |
Add #include "config.h" |
src/protocols/rdp/channels/rdpgfx.c |
Add #include "config.h" |
src/protocols/rdp/input.c |
Add #include "config.h", add NULL guard in guac_rdp_user_size_handler() |
004-h264-display-worker.patch
Feature: H.264 passthrough via guac_display worker integration. When the RDP server sends AVC420/AVC444 encoded frames (H.264), the raw NAL units are passed through to the browser's WebCodecs VideoDecoder instead of being decoded server-side and re-encoded as JPEG/PNG/WebP.
Architecture: The SurfaceCommand callback intercepts H.264 data and stores it on the display layer. During the normal frame flush cycle (guac_display_plan_apply), the H.264 data is sent to clients as a custom h264 instruction before worker threads start encoding. All IMG operations for the H.264 layer are skipped, eliminating the decode→re-encode overhead.
This approach avoids the socket contention issue that occurred when H.264 was sent directly from FreeRDP's SurfaceCommand callback thread, which raced with guac_display's worker threads writing to the same socket.
Files patched:
| File | Fix |
|---|---|
src/libguac/display-priv.h |
Add H.264 buffer fields to guac_display_layer (data, length, keyframe, rect) |
src/libguac/guacamole/display.h |
Add guac_display_layer_set_h264() public API |
src/libguac/display-layer.c |
Implement guac_display_layer_set_h264() with lock management |
src/libguac/display-layer-list.c |
Free H.264 data in layer cleanup |
src/libguac/display-plan.c |
Send H.264 data during plan apply, skip IMG ops for H.264 layers |
src/protocols/rdp/channels/rdpgfx.c |
Wrap SurfaceCommand to store H.264 on display layer after GDI decode |
src/protocols/rdp/settings.c |
Enable GfxH264 and GfxAVC444 in FreeRDP settings |
Requires: RDP server with H.264 support (xrdp with x264, or Windows with AVC hardware encoder). Browser must support WebCodecs VideoDecoder (Chrome/Edge 94+, Firefox 130+).
Applying patches
Patches are applied automatically by all build scripts (build-deb.sh, build-rpm.sh, install.sh, dev.sh, Dockerfile). To apply manually:
cd ../guacamole-server
git apply ../rustguac/patches/001-freerdp3-debian13.patch
To check if patches are already applied:
cd ../guacamole-server
git apply --check ../rustguac/patches/001-freerdp3-debian13.patch 2>&1 || echo "Already applied or conflict"
Adding new patches
- Make changes in the
../guacamole-serverworking tree - Export:
cd ../guacamole-server && git diff > ../rustguac/patches/NNN-description.patch - Patches are applied in numeric order by the build scripts