Properly associate inbound pipes.

This commit is contained in:
Michael Jumper 2014-03-02 12:06:08 -08:00
parent e37c5c462f
commit e26c0122fd
4 changed files with 37 additions and 0 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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);

View File

@ -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);
}