110 lines
3.8 KiB
Diff
110 lines
3.8 KiB
Diff
diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/fsutil.c open-vm-tools-10.3.0-8931395/vmhgfs-fuse/fsutil.c
|
|
--- open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/fsutil.c 2018-06-23 03:03:28.000000000 -0700
|
|
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/fsutil.c 2019-02-02 22:42:45.458832655 -0800
|
|
@@ -189,8 +189,6 @@
|
|
size_t reqBufferSize;
|
|
size_t reqSize;
|
|
int result = 0;
|
|
- char *fileName = NULL;
|
|
- uint32 *fileNameLength = NULL;
|
|
ASSERT(attr);
|
|
ASSERT(req);
|
|
ASSERT(path);
|
|
@@ -204,8 +202,6 @@
|
|
|
|
/* Fill out the request packet. */
|
|
requestV3->hints = 0;
|
|
- fileName = requestV3->fileName.name;
|
|
- fileNameLength = &requestV3->fileName.length;
|
|
requestV3->fileName.flags = 0;
|
|
requestV3->fileName.fid = HGFS_INVALID_HANDLE;
|
|
requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
|
|
@@ -213,6 +209,19 @@
|
|
requestV3->reserved = 0;
|
|
reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
|
|
reqBufferSize = HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize);
|
|
+ if (requestV3->fileName.name != NULL) {
|
|
+ /* Convert to CP name. */
|
|
+ result = CPName_ConvertTo(path,
|
|
+ reqBufferSize,
|
|
+ requestV3->fileName.name);
|
|
+ LOG(8, ("Converted path %s\n", requestV3->fileName.name));
|
|
+ if (result < 0) {
|
|
+ LOG(8, ("CP conversion failed.\n"));
|
|
+ result = -EINVAL;
|
|
+ goto out;
|
|
+ }
|
|
+ requestV3->fileName.length = result;
|
|
+ }
|
|
break;
|
|
}
|
|
|
|
@@ -223,20 +232,42 @@
|
|
|
|
requestV2 = (HgfsRequestGetattrV2 *)(HGFS_REQ_PAYLOAD(req));
|
|
requestV2->hints = 0;
|
|
- fileName = requestV2->fileName.name;
|
|
- fileNameLength = &requestV2->fileName.length;
|
|
reqSize = sizeof *requestV2;
|
|
reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV2);
|
|
+ if (requestV2->fileName.name != NULL) {
|
|
+ /* Convert to CP name. */
|
|
+ result = CPName_ConvertTo(path,
|
|
+ reqBufferSize,
|
|
+ requestV2->fileName.name);
|
|
+ LOG(8, ("Converted path %s\n", requestV2->fileName.name));
|
|
+ if (result < 0) {
|
|
+ LOG(8, ("CP conversion failed.\n"));
|
|
+ result = -EINVAL;
|
|
+ goto out;
|
|
+ }
|
|
+ requestV2->fileName.length = result;
|
|
+ }
|
|
break;
|
|
}
|
|
|
|
case HGFS_OP_GETATTR: {
|
|
HgfsRequestGetattr *requestV1;
|
|
requestV1 = (HgfsRequestGetattr *)(HGFS_REQ_PAYLOAD(req));
|
|
- fileName = requestV1->fileName.name;
|
|
- fileNameLength = &requestV1->fileName.length;
|
|
reqSize = sizeof *requestV1;
|
|
reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV1);
|
|
+ if (requestV1->fileName.name != NULL) {
|
|
+ /* Convert to CP name. */
|
|
+ result = CPName_ConvertTo(path,
|
|
+ reqBufferSize,
|
|
+ requestV1->fileName.name);
|
|
+ LOG(8, ("Converted path %s\n", requestV1->fileName.name));
|
|
+ if (result < 0) {
|
|
+ LOG(8, ("CP conversion failed.\n"));
|
|
+ result = -EINVAL;
|
|
+ goto out;
|
|
+ }
|
|
+ requestV1->fileName.length = result;
|
|
+ }
|
|
break;
|
|
}
|
|
|
|
@@ -246,20 +277,6 @@
|
|
goto out;
|
|
}
|
|
|
|
- if (fileName != NULL) {
|
|
- /* Convert to CP name. */
|
|
- result = CPName_ConvertTo(path,
|
|
- reqBufferSize,
|
|
- fileName);
|
|
- LOG(8, ("Converted path %s\n", fileName));
|
|
- if (result < 0) {
|
|
- LOG(8, ("CP conversion failed.\n"));
|
|
- result = -EINVAL;
|
|
- goto out;
|
|
- }
|
|
- *fileNameLength = result;
|
|
- }
|
|
-
|
|
req->payloadSize = reqSize + result;
|
|
|
|
/* Fill in header here as payloadSize needs to be there. */
|