Skip to content

GUACAMOLE-2323: Abort the connection when FreeRDP reports a connection error - #709

Open
xelan wants to merge 2 commits into
apache:staging/1.6.1from
xelan:GUACAMOLE-2323-rdp-xp-logoff-reconnect
Open

GUACAMOLE-2323: Abort the connection when FreeRDP reports a connection error#709
xelan wants to merge 2 commits into
apache:staging/1.6.1from
xelan:GUACAMOLE-2323-rdp-xp-logoff-reconnect

Conversation

@xelan

@xelan xelan commented Aug 24, 2026

Copy link
Copy Markdown

…n error.

Leaving the message loop without aborting the guac_client returns from
guac_rdp_handle_connection() with the client still running, which
guac_rdp_client_thread() takes as a request to reconnect. RDP servers that end
a session by tearing down the connection instead of sending a Set Error Info
PDU (Windows XP on logoff) were therefore given a fresh, silently
auto-logged-in session rather than a closed one. This path aborted the client
before 1.6.0, where the early break was introduced with the render thread.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@xelan
xelan changed the base branch from main to staging/1.6.1 August 24, 2026 13:53

@necouchman necouchman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment below - I think we've discussed this in the past, and I'm pretty sure the behavior we have currently is the desired behavior - generally speaking, failures in the RDP client should trigger a reconnect, and changing that behavior for the sake of broken versions of Windows that don't send the correct disconnect/logout event to the client I'm not sure is the way to go - at least, not without some other checks to distinguish between the two. Otherwise we might end up simply aborting connections in situations where we should actually retry them?

Comment thread src/protocols/rdp/rdp.c Outdated
Comment on lines +887 to +895
/* Abort if the wait failed or FreeRDP recorded a connection error, as
* is the case when an RDP server tears down the connection without
* first sending a Set Error Info PDU. Simply leaving the loop would
* return from this function with the guac_client still running, which
* guac_rdp_client_thread() takes as a request to reconnect. */
if (wait_result < 0) {
guac_rdp_client_abort(client, rdp_inst);
break;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is guacd to distinguish events which should trigger a reconnection from the logout events which should not?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback @necouchman! I've added another commit which improves the detection logic. Now the guac_rdp_client_abort is only done if FreeRDP reports an appropriate info code. Tested with Windows XP SP3. What do you think about this approach?

…ion ended.

Restricts the previous commit's abort to connections for which FreeRDP holds an
error info code, which it records both from a Set Error Info PDU and from a
Disconnect Provider Ultimatum. Windows XP ends a session with the former, and
FreeRDP notes the code without aborting the connection, so the error surfaces at
the top of the message loop rather than through freerdp_shall_disconnect(); a
logoff was therefore answered with a fresh, silently auto-logged-in session.
Errors carrying no error info code are plain connection failures and stay
eligible for the reconnect that guac_rdp_client_thread() performs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants