Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-1084: Implement basic handling for unsuccessful RAIL execution results. #502

Merged
merged 1 commit into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/protocols/rdp/channels/rail.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,37 @@ static UINT guac_rdp_rail_complete_handshake(RailClientContext* rail) {

}

/**
* A callback function that is invoked when the RDP server sends the result
* of the Remote App (RAIL) execution command back to the client, so that the
* client can handle any required actions associated with the result.
*
* @param context
* A pointer to the RAIL data structure associated with the current
* RDP connection.
*
* @param execResult
* A data structure containing the result of the RAIL command.
*
* @return
* CHANNEL_RC_OK (zero) if the result was handled successfully, otherwise
necouchman marked this conversation as resolved.
Show resolved Hide resolved
* a non-zero error code. This implementation always returns
* CHANNEL_RC_OK.
*/
static UINT guac_rdp_rail_execute_result(RailClientContext* context,
const RAIL_EXEC_RESULT_ORDER* execResult) {

guac_client* client = (guac_client*) context->custom;

if (execResult->execResult != RAIL_EXEC_S_OK) {
guac_client_log(client, GUAC_LOG_DEBUG, "Failed to execute RAIL command on server: %d", execResult->execResult);
guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_UNAVAILABLE, "Failed to execute RAIL command.");
}

return CHANNEL_RC_OK;

}

/**
* Callback which is invoked when a Handshake PDU is received from the RDP
* server. No communication for RemoteApp may occur until the Handshake PDU
Expand Down Expand Up @@ -250,6 +281,7 @@ static void guac_rdp_rail_channel_connected(rdpContext* context,
/* Init FreeRDP RAIL context, ensuring the guac_client can be accessed from
* within any RAIL-specific callbacks */
rail->custom = client;
rail->ServerExecuteResult = guac_rdp_rail_execute_result;
rail->ServerHandshake = guac_rdp_rail_handshake;
rail->ServerHandshakeEx = guac_rdp_rail_handshake_ex;

Expand Down