diff --git a/src/protocols/rdp/client.c b/src/protocols/rdp/client.c index f1cbeed5..814ddfe7 100644 --- a/src/protocols/rdp/client.c +++ b/src/protocols/rdp/client.c @@ -353,6 +353,7 @@ BOOL rdp_freerdp_post_connect(freerdp* instance) { /* File transfer handlers */ client->file_handler = rdp_guac_client_file_handler; + client->pipe_handler = rdp_guac_client_pipe_handler; client->blob_handler = rdp_guac_client_blob_handler; client->end_handler = rdp_guac_client_end_handler; client->ack_handler = rdp_guac_client_ack_handler; diff --git a/src/protocols/rdp/guac_handlers.c b/src/protocols/rdp/guac_handlers.c index be991b86..2d7b176b 100644 --- a/src/protocols/rdp/guac_handlers.c +++ b/src/protocols/rdp/guac_handlers.c @@ -566,6 +566,37 @@ int rdp_guac_client_file_handler(guac_client* client, guac_stream* stream, } +int rdp_guac_client_pipe_handler(guac_client* client, guac_stream* stream, + char* mimetype, char* name) { + + guac_rdp_stream* rdp_stream; + guac_rdp_svc* svc = guac_rdp_get_svc(client, name); + + /* Fail if no such SVC */ + if (svc == NULL) { + guac_client_log_error(client, + "Requested non-existent pipe: \"%s\".", + name); + guac_protocol_send_ack(client->socket, stream, "FAIL (NO SUCH PIPE)", + GUAC_PROTOCOL_STATUS_INVALID_PARAMETER); + guac_socket_flush(client->socket); + return 0; + } + else + guac_client_log_error(client, + "Inbound half of channel \"%s\" connected.", + name); + + /* Init stream data */ + stream->data = rdp_stream = malloc(sizeof(guac_rdp_stream)); + rdp_stream->type = GUAC_RDP_INBOUND_SVC_STREAM; + rdp_stream->svc = svc; + svc->input_pipe = stream; + + return 0; + +} + int rdp_guac_client_blob_handler(guac_client* client, guac_stream* stream, void* data, int length) { diff --git a/src/protocols/rdp/guac_handlers.h b/src/protocols/rdp/guac_handlers.h index 15de6a57..e9d20137 100644 --- a/src/protocols/rdp/guac_handlers.h +++ b/src/protocols/rdp/guac_handlers.h @@ -38,6 +38,9 @@ int rdp_guac_client_clipboard_handler(guac_client* client, char* data); int rdp_guac_client_file_handler(guac_client* client, guac_stream* stream, char* mimetype, char* filename); +int rdp_guac_client_pipe_handler(guac_client* client, guac_stream* stream, + char* mimetype, char* name); + int rdp_guac_client_blob_handler(guac_client* client, guac_stream* stream, void* data, int length); diff --git a/src/protocols/rdp/guac_svc/svc_service.c b/src/protocols/rdp/guac_svc/svc_service.c index f21870d7..fef6f9c5 100644 --- a/src/protocols/rdp/guac_svc/svc_service.c +++ b/src/protocols/rdp/guac_svc/svc_service.c @@ -144,5 +144,7 @@ void guac_svc_process_receive(rdpSvcPlugin* plugin, Stream_Buffer(input_stream), Stream_Length(input_stream)); + guac_socket_flush(svc->client->socket); + }