Skip to content

Commit

Permalink
GUACAMOLE-1084: Implement basic handling for unsuccessful RAIL execut…
Browse files Browse the repository at this point in the history
…ion results.
  • Loading branch information
necouchman committed May 24, 2024
1 parent f9d9dff commit 5e45235
Showing 1 changed file with 32 additions and 0 deletions.
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
* 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

0 comments on commit 5e45235

Please sign in to comment.