1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
From 187cbdfe2c0abdef554306394d12a9b28a5100eb Mon Sep 17 00:00:00 2001
From: akallabeth <akallabeth@posteo.net>
Date: Tue, 9 Mar 2021 12:09:58 +0100
Subject: [PATCH 20/36] Use specific names for drive hotplug special values
(cherry picked from commit b1be3d78fcc63a5842f7707a139b2582a4a42b21)
---
client/common/cmdline.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
--- a/client/common/cmdline.c
+++ b/client/common/cmdline.c
@@ -120,6 +120,23 @@
return TRUE;
}
+static char* name_from_path(const char* path)
+{
+ const char* name = "NULL";
+ if (path)
+ {
+ if (_strnicmp(path, "%", 2) == 0)
+ name = "home";
+ else if (_strnicmp(path, "*", 2) == 0)
+ name = "hotplug-all";
+ else if (_strnicmp(path, "DynamicDrives", 2) == 0)
+ name = "hotplug";
+ else
+ name = path;
+ }
+ return _strdup(name);
+}
+
static BOOL freerdp_client_add_drive(rdpSettings* settings, const char* path, const char* name)
{
RDPDR_DRIVE* drive;
@@ -151,8 +168,10 @@
goto fail;
}
else /* We need a name to send to the server. */
- if (!(drive->Name = _strdup(path)))
- goto fail;
+ {
+ if (!(drive->Name = name_from_path(path)))
+ goto fail;
+ }
if (!path || !freerdp_sanitize_drive_name(drive->Name, "\\/", "__"))
goto fail;
@@ -3557,6 +3576,7 @@
/* Syntax: Comma seperated list of the following entries:
* '*' ... Redirect all drives, including hotplug
* 'DynamicDrives' ... hotplug
+ * '%' ... user home directory
* <label>(<path>) ... One or more paths to redirect.
* <path>(<label>) ... One or more paths to redirect.
* <path> ... One or more paths to redirect.
|