Commit bf1b62d3 for guacamole.apache.org

commit bf1b62d3c7a5aa3e76f45bd376491257e1f6c23a
Author: pwgcz <pgrabczak@proton.me>
Date:   Mon Mar 30 14:47:17 2026 +0200

    GUACAMOLE-2221: fix RDP busy-loop on transport failure

    When an RDP connection hits a transport-level failure (for example, a
    certificate error), the inner event loop in rdp.c can spin at 100% CPU.

    This happens because rdp_guac_client_wait_for_events() does not check
    FreeRDP's error state, so it keeps returning success even after a
    transport failure has been recorded. As a result, the loop never
    observes the error and continues polling indefinitely.

    Fix: check freerdp_get_last_error() in rdp_guac_client_wait_for_events()
    and return -1 when an error is recorded. This satisfies the function's
    contract to report errors and ensures the loop exits promptly.

diff --git a/src/protocols/rdp/rdp.c b/src/protocols/rdp/rdp.c
index 1ef85bee..e2524d63 100644
--- a/src/protocols/rdp/rdp.c
+++ b/src/protocols/rdp/rdp.c
@@ -468,6 +468,10 @@ static int rdp_guac_client_wait_for_events(guac_client* client,

     }

+    /* Bail out if FreeRDP has recorded a connection error */
+    if (freerdp_get_last_error(GUAC_RDP_CONTEXT(rdp_inst)) != FREERDP_ERROR_SUCCESS)
+        return -1;
+
     /* Wait was successful */
     return 1;

@@ -625,8 +629,10 @@ static int guac_rdp_handle_connection(guac_client* client) {

             /* Handle any queued FreeRDP events (this may result in RDP messages
              * being sent), aborting later if FreeRDP event handling fails */
-            if (!guac_rdp_handle_events(rdp_client))
+            if (!guac_rdp_handle_events(rdp_client)) {
                 wait_result = -1;
+                break;
+            }

             /* Test whether the RDP server is closing the connection */
 #ifdef HAVE_DISCONNECT_CONTEXT