GUACAMOLE-446: Merge changes adding support for overriding default RDP virtual drive name.
This commit is contained in:
commit
71f993b25d
@ -25,6 +25,7 @@
|
|||||||
#include "rdp_status.h"
|
#include "rdp_status.h"
|
||||||
|
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
#include <freerdp/utils/svc_plugin.h>
|
||||||
|
#include <guacamole/unicode.h>
|
||||||
|
|
||||||
#ifdef ENABLE_WINPR
|
#ifdef ENABLE_WINPR
|
||||||
#include <winpr/stream.h>
|
#include <winpr/stream.h>
|
||||||
@ -100,22 +101,23 @@ void guac_rdpdr_fs_process_query_device_info(guac_rdpdr_device* device, wStream*
|
|||||||
void guac_rdpdr_fs_process_query_attribute_info(guac_rdpdr_device* device, wStream* input_stream,
|
void guac_rdpdr_fs_process_query_attribute_info(guac_rdpdr_device* device, wStream* input_stream,
|
||||||
int file_id, int completion_id) {
|
int file_id, int completion_id) {
|
||||||
|
|
||||||
|
int name_len = guac_utf8_strlen(device->device_name);
|
||||||
|
|
||||||
wStream* output_stream = guac_rdpdr_new_io_completion(device,
|
wStream* output_stream = guac_rdpdr_new_io_completion(device,
|
||||||
completion_id, STATUS_SUCCESS, 16 + GUAC_FILESYSTEM_NAME_LENGTH);
|
completion_id, STATUS_SUCCESS, 16 + name_len);
|
||||||
|
|
||||||
guac_client_log(device->rdpdr->client, GUAC_LOG_DEBUG,
|
guac_client_log(device->rdpdr->client, GUAC_LOG_DEBUG,
|
||||||
"%s: [file_id=%i]",
|
"%s: [file_id=%i]",
|
||||||
__func__, file_id);
|
__func__, file_id);
|
||||||
|
|
||||||
Stream_Write_UINT32(output_stream, 12 + GUAC_FILESYSTEM_NAME_LENGTH);
|
Stream_Write_UINT32(output_stream, 12 + name_len);
|
||||||
Stream_Write_UINT32(output_stream,
|
Stream_Write_UINT32(output_stream,
|
||||||
FILE_UNICODE_ON_DISK
|
FILE_UNICODE_ON_DISK
|
||||||
| FILE_CASE_SENSITIVE_SEARCH
|
| FILE_CASE_SENSITIVE_SEARCH
|
||||||
| FILE_CASE_PRESERVED_NAMES); /* FileSystemAttributes */
|
| FILE_CASE_PRESERVED_NAMES); /* FileSystemAttributes */
|
||||||
Stream_Write_UINT32(output_stream, GUAC_RDP_FS_MAX_PATH ); /* MaximumComponentNameLength */
|
Stream_Write_UINT32(output_stream, GUAC_RDP_FS_MAX_PATH ); /* MaximumComponentNameLength */
|
||||||
Stream_Write_UINT32(output_stream, GUAC_FILESYSTEM_NAME_LENGTH);
|
Stream_Write_UINT32(output_stream, name_len);
|
||||||
Stream_Write(output_stream, GUAC_FILESYSTEM_NAME,
|
Stream_Write(output_stream, device->device_name, name_len);
|
||||||
GUAC_FILESYSTEM_NAME_LENGTH);
|
|
||||||
|
|
||||||
svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream);
|
svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream);
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ static void guac_rdpdr_device_fs_free_handler(guac_rdpdr_device* device) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_rdpdr_register_fs(guac_rdpdrPlugin* rdpdr) {
|
void guac_rdpdr_register_fs(guac_rdpdrPlugin* rdpdr, char* drive_name) {
|
||||||
|
|
||||||
guac_client* client = rdpdr->client;
|
guac_client* client = rdpdr->client;
|
||||||
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
|
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
|
||||||
@ -131,7 +131,7 @@ void guac_rdpdr_register_fs(guac_rdpdrPlugin* rdpdr) {
|
|||||||
/* Init device */
|
/* Init device */
|
||||||
device->rdpdr = rdpdr;
|
device->rdpdr = rdpdr;
|
||||||
device->device_id = id;
|
device->device_id = id;
|
||||||
device->device_name = "Guacamole Filesystem";
|
device->device_name = drive_name;
|
||||||
int device_name_len = guac_utf8_strlen(device->device_name);
|
int device_name_len = guac_utf8_strlen(device->device_name);
|
||||||
device->device_type = RDPDR_DTYP_FILESYSTEM;
|
device->device_type = RDPDR_DTYP_FILESYSTEM;
|
||||||
device->dos_name = "GUACFS\0\0";
|
device->dos_name = "GUACFS\0\0";
|
||||||
|
@ -41,8 +41,14 @@
|
|||||||
/**
|
/**
|
||||||
* Registers a new filesystem device within the RDPDR plugin. This must be done
|
* Registers a new filesystem device within the RDPDR plugin. This must be done
|
||||||
* before RDPDR connection finishes.
|
* before RDPDR connection finishes.
|
||||||
|
*
|
||||||
|
* @param rdpdr
|
||||||
|
* The RDP device redirection plugin with which to register the device.
|
||||||
|
*
|
||||||
|
* @param drive_name
|
||||||
|
* The name of the redirected drive to display in the RDP connection.
|
||||||
*/
|
*/
|
||||||
void guac_rdpdr_register_fs(guac_rdpdrPlugin* rdpdr);
|
void guac_rdpdr_register_fs(guac_rdpdrPlugin* rdpdr, char* drive_name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -76,12 +76,6 @@
|
|||||||
#define GUAC_PRINTER_DRIVER "M\0S\0 \0P\0u\0b\0l\0i\0s\0h\0e\0r\0 \0I\0m\0a\0g\0e\0s\0e\0t\0t\0e\0r\0\0\0"
|
#define GUAC_PRINTER_DRIVER "M\0S\0 \0P\0u\0b\0l\0i\0s\0h\0e\0r\0 \0I\0m\0a\0g\0e\0s\0e\0t\0t\0e\0r\0\0\0"
|
||||||
#define GUAC_PRINTER_DRIVER_LENGTH 50
|
#define GUAC_PRINTER_DRIVER_LENGTH 50
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the filesystem.
|
|
||||||
*/
|
|
||||||
#define GUAC_FILESYSTEM_NAME "G\0u\0a\0c\0a\0m\0o\0l\0e\0\0\0"
|
|
||||||
#define GUAC_FILESYSTEM_NAME_LENGTH 20
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Label of the filesystem.
|
* Label of the filesystem.
|
||||||
*/
|
*/
|
||||||
|
@ -100,7 +100,7 @@ void guac_rdpdr_process_connect(rdpSvcPlugin* plugin) {
|
|||||||
|
|
||||||
/* Register drive if enabled */
|
/* Register drive if enabled */
|
||||||
if (rdp_client->settings->drive_enabled)
|
if (rdp_client->settings->drive_enabled)
|
||||||
guac_rdpdr_register_fs(rdpdr);
|
guac_rdpdr_register_fs(rdpdr, rdp_client->settings->drive_name);
|
||||||
|
|
||||||
/* Log that printing, etc. has been loaded */
|
/* Log that printing, etc. has been loaded */
|
||||||
guac_client_log(client, GUAC_LOG_INFO, "guacdr connected.");
|
guac_client_log(client, GUAC_LOG_INFO, "guacdr connected.");
|
||||||
|
@ -54,6 +54,7 @@ const char* GUAC_RDP_CLIENT_ARGS[] = {
|
|||||||
"enable-printing",
|
"enable-printing",
|
||||||
"printer-name",
|
"printer-name",
|
||||||
"enable-drive",
|
"enable-drive",
|
||||||
|
"drive-name",
|
||||||
"drive-path",
|
"drive-path",
|
||||||
"create-drive-path",
|
"create-drive-path",
|
||||||
"console",
|
"console",
|
||||||
@ -199,6 +200,12 @@ enum RDP_ARGS_IDX {
|
|||||||
*/
|
*/
|
||||||
IDX_ENABLE_DRIVE,
|
IDX_ENABLE_DRIVE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the virtual driver that will be passed through to the
|
||||||
|
* RDP connection.
|
||||||
|
*/
|
||||||
|
IDX_DRIVE_NAME,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The local system path which will be used to persist the
|
* The local system path which will be used to persist the
|
||||||
* virtual drive. This must be specified if the virtual drive is enabled.
|
* virtual drive. This must be specified if the virtual drive is enabled.
|
||||||
@ -810,6 +817,11 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
|
|||||||
guac_user_parse_args_boolean(user, GUAC_RDP_CLIENT_ARGS, argv,
|
guac_user_parse_args_boolean(user, GUAC_RDP_CLIENT_ARGS, argv,
|
||||||
IDX_ENABLE_DRIVE, 0);
|
IDX_ENABLE_DRIVE, 0);
|
||||||
|
|
||||||
|
/* Name of the drive being passed through */
|
||||||
|
settings->drive_name =
|
||||||
|
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
|
||||||
|
IDX_DRIVE_NAME, "Guacamole Filesystem");
|
||||||
|
|
||||||
settings->drive_path =
|
settings->drive_path =
|
||||||
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
|
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
|
||||||
IDX_DRIVE_PATH, "");
|
IDX_DRIVE_PATH, "");
|
||||||
@ -990,6 +1002,7 @@ void guac_rdp_settings_free(guac_rdp_settings* settings) {
|
|||||||
/* Free settings strings */
|
/* Free settings strings */
|
||||||
free(settings->client_name);
|
free(settings->client_name);
|
||||||
free(settings->domain);
|
free(settings->domain);
|
||||||
|
free(settings->drive_name);
|
||||||
free(settings->drive_path);
|
free(settings->drive_path);
|
||||||
free(settings->hostname);
|
free(settings->hostname);
|
||||||
free(settings->initial_program);
|
free(settings->initial_program);
|
||||||
|
@ -187,6 +187,11 @@ typedef struct guac_rdp_settings {
|
|||||||
*/
|
*/
|
||||||
int drive_enabled;
|
int drive_enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the virtual drive to pass through to the RDP connection.
|
||||||
|
*/
|
||||||
|
char* drive_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The local system path which will be used to persist the
|
* The local system path which will be used to persist the
|
||||||
* virtual drive.
|
* virtual drive.
|
||||||
|
Loading…
Reference in New Issue
Block a user