Updated *-aligned.patch files with more tweaks.

Filed a regression in readdir operation in dir-aligned.patch.
This commit is contained in:
Ravindra Kumar 2019-02-12 18:38:53 -08:00
parent d2616b89bb
commit ecd814a373
8 changed files with 378 additions and 125 deletions

View File

@ -1,17 +1,27 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.0-8931395/vmhgfs-fuse/dir.c
--- open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c 2018-06-23 03:03:28.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/dir.c 2019-02-02 23:40:26.945508336 -0800
@@ -54,8 +54,6 @@
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/dir.c 2019-02-12 14:37:35.773990588 -0800
@@ -1,5 +1,5 @@
/*********************************************************
- * Copyright (C) 2013 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013,2019 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
@@ -54,38 +54,53 @@
HgfsOp opUsed, // IN: Op to be used
HgfsReq *req) // IN/OUT: Packet to write into
{
- char *name;
- unsigned int *nameLength = NULL;
size_t reqSize;
int result;
- int result;
@@ -66,14 +64,21 @@
ASSERT(path);
ASSERT(req);
LOG(4, ("Path = %s \n", path));
switch (opUsed) {
case HGFS_OP_SEARCH_OPEN_V3: {
+ int result;
HgfsRequestSearchOpenV3 *requestV3 = HgfsGetRequestPayload(req);
- /* We'll use these later. */
@ -31,11 +41,14 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
+ return -EINVAL;
+ }
+ LOG(4, ("After conversion = %s\n", requestV3->dirName.name));
+ requestV3->dirName.length = (uint32) result;
+ requestV3->dirName.length = result;
+ reqSize += result;
break;
}
@@ -82,10 +87,17 @@
case HGFS_OP_SEARCH_OPEN: {
+ int result;
HgfsRequestSearchOpen *request;
request = (HgfsRequestSearchOpen *)(HGFS_REQ_PAYLOAD(req));
@ -52,11 +65,12 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
+ return -EINVAL;
+ }
+ LOG(4, ("After conversion = %s\n", request->dirName.name));
+ request->dirName.length = (uint32) result;
+ request->dirName.length = result;
+ reqSize += result;
break;
}
@@ -94,20 +106,6 @@
@@ -94,21 +109,7 @@
return -EPROTO;
}
@ -74,54 +88,68 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
- LOG(4, ("After conversion = %s\n", name));
-
- *nameLength = (uint32) result;
req->payloadSize = reqSize + result;
- req->payloadSize = reqSize + result;
+ req->payloadSize = reqSize;
/* Fill in header here as payloadSize needs to be there. */
@@ -149,7 +147,7 @@
HgfsPackHeader(req, opUsed);
@@ -149,7 +150,6 @@
int result;
HgfsOp opUsed;
HgfsStatus replyStatus;
- HgfsHandle *replySearch;
+ HgfsHandle replySearch;
ASSERT(path);
req = HgfsGetNewRequest();
@@ -164,12 +162,12 @@
if (opUsed == HGFS_OP_SEARCH_OPEN_V3) {
HgfsReplySearchOpenV3 *requestV3 = HgfsGetReplyPayload(req);
@@ -161,16 +161,6 @@
retry:
opUsed = hgfsVersionSearchOpen;
- if (opUsed == HGFS_OP_SEARCH_OPEN_V3) {
- HgfsReplySearchOpenV3 *requestV3 = HgfsGetReplyPayload(req);
-
- replySearch = &requestV3->search;
+ replySearch = requestV3->search;
} else {
HgfsReplySearchOpen *request = (HgfsReplySearchOpen *)HGFS_REQ_PAYLOAD(req);
-
- } else {
- HgfsReplySearchOpen *request = (HgfsReplySearchOpen *)HGFS_REQ_PAYLOAD(req);
-
- replySearch = &request->search;
+ replySearch = request->search;
}
- }
result = HgfsPackDirOpenRequest(path, opUsed, req);
@@ -187,8 +185,8 @@
if (result != 0) {
@@ -187,8 +177,14 @@
switch (result) {
case 0:
- *handle = *replySearch;
- LOG(6, ("Set handle to %u\n", *replySearch));
+ *handle = replySearch;
+ LOG(6, ("Set handle to %u\n", replySearch));
+ if (opUsed == HGFS_OP_SEARCH_OPEN_V3) {
+ HgfsReplySearchOpenV3 *requestV3 = HgfsGetReplyPayload(req);
+ *handle = requestV3->search;
+ } else {
+ HgfsReplySearchOpen *request = (HgfsReplySearchOpen *)HGFS_REQ_PAYLOAD(req);
+ *handle = request->search;
+ }
+ LOG(6, ("Set handle to %u\n", *handle));
break;
case -EPROTO:
/* Retry with older version(s). Set globally. */
@@ -626,8 +624,6 @@
@@ -626,25 +622,30 @@
HgfsOp opUsed, // IN: Op to be used.
HgfsReq *req) // IN/OUT: Packet to write into
{
- char *fileName = NULL;
- uint32 *fileNameLength;
size_t reqSize;
int result;
- int result;
+
@@ -638,13 +634,18 @@
ASSERT(req);
switch (opUsed) {
case HGFS_OP_CREATE_DIR_V3: {
+ int result;
HgfsRequestCreateDirV3 *requestV3 = HgfsGetRequestPayload(req);
reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
@ -141,10 +169,16 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
+ return -EINVAL;
+ }
+ requestV3->fileName.length = result;
+ reqSize += result;
requestV3->mask = HGFS_CREATE_DIR_MASK;
/* Set permissions. */
@@ -660,11 +661,17 @@
@@ -656,15 +657,23 @@
break;
}
case HGFS_OP_CREATE_DIR_V2: {
+ int result;
HgfsRequestCreateDirV2 *requestV2;
requestV2 = (HgfsRequestCreateDirV2 *)(HGFS_REQ_PAYLOAD(req));
@ -162,10 +196,16 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
+ return -EINVAL;
+ }
+ requestV2->fileName.length = result;
+ reqSize += result;
requestV2->mask = HGFS_CREATE_DIR_MASK;
/* Set permissions. */
@@ -679,11 +686,16 @@
@@ -675,15 +684,22 @@
break;
}
case HGFS_OP_CREATE_DIR: {
+ int result;
HgfsRequestCreateDir *request;
request = (HgfsRequestCreateDir *)(HGFS_REQ_PAYLOAD(req));
@ -183,10 +223,11 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
+ return -EINVAL;
+ }
+ request->fileName.length = result;
+ reqSize += result;
/* Set permissions. */
request->permissions = (permsMode & S_IRWXU) >> 6;
break;
@@ -693,17 +705,6 @@
@@ -693,18 +709,7 @@
return -EPROTO;
}
@ -201,10 +242,12 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
- }
-
- *fileNameLength = result;
req->payloadSize = reqSize + result;
- req->payloadSize = reqSize + result;
+ req->payloadSize = reqSize;
/* Fill in header here as payloadSize needs to be there. */
@@ -827,8 +828,6 @@
HgfsPackHeader(req, opUsed);
@@ -827,8 +832,6 @@
HgfsReq *req = NULL;
int result = 0;
HgfsStatus replyStatus;
@ -213,7 +256,7 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
uint32 reqSize;
HgfsOp opUsed;
HgfsAttrInfo newAttr = {0};
@@ -862,8 +861,16 @@
@@ -862,8 +865,17 @@
reqSize = sizeof(*request) + HgfsGetRequestHeaderSize();
request->hints = 0;
@ -229,10 +272,11 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
+ goto out;
+ }
+ request->fileName.length = result;
+ reqSize += result;
request->fileName.fid = HGFS_INVALID_HANDLE;
request->fileName.flags = 0;
request->fileName.caseType = HGFS_FILE_NAME_DEFAULT_CASE;
@@ -874,23 +881,19 @@
@@ -874,24 +886,21 @@
request = (HgfsRequestDelete *)(HGFS_REQ_PAYLOAD(req));
/* Fill out the request packet. */
@ -249,6 +293,7 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
+ goto out;
+ }
+ request->fileName.length = result;
+ reqSize += result;
}
-
@ -263,6 +308,8 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.
- }
-
- *fileNameLength = result;
req->payloadSize = reqSize + result;
- req->payloadSize = reqSize + result;
+ req->payloadSize = reqSize;
/* Fill in header here as payloadSize needs to be there. */
HgfsPackHeader(req, opUsed);

View File

@ -1,16 +1,29 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3.0-8931395/vmhgfs-fuse/file.c
--- open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c 2018-06-23 03:03:28.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/file.c 2019-02-02 23:41:49.274822242 -0800
@@ -66,8 +66,6 @@
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/file.c 2019-02-11 18:46:55.342639145 -0800
@@ -1,5 +1,5 @@
/*********************************************************
- * Copyright (C) 2013,2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013,2018-2019 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
@@ -66,10 +66,7 @@
HgfsOp opUsed, // IN: Op to use
HgfsReq *req) // IN/OUT: Packet to write into
{
- char *name;
- uint32 *nameLength;
size_t reqSize;
int result;
- int result;
int openMode, openFlags;
@@ -92,10 +90,16 @@
ASSERT(path);
@@ -88,14 +85,22 @@
switch (opUsed) {
case HGFS_OP_OPEN_V3: {
+ int result;
HgfsRequestOpenV3 *requestV3 = HgfsGetRequestPayload(req);
reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
@ -26,11 +39,17 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
+ return -EINVAL;
+ }
+ requestV3->fileName.length = (uint32) result;
+ requestV3->fileName.length = result;
+ reqSize += result;
/* Linux clients need case-sensitive lookups. */
requestV3->fileName.flags = 0;
requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
@@ -126,11 +130,18 @@
@@ -122,15 +127,24 @@
}
case HGFS_OP_OPEN_V2: {
+ int result;
HgfsRequestOpenV2 *requestV2;
requestV2 = (HgfsRequestOpenV2 *)(HGFS_REQ_PAYLOAD(req));
@ -48,11 +67,16 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
+ return -EINVAL;
+ }
+
+ requestV2->fileName.length = (uint32) result;
+ requestV2->fileName.length = result;
+ reqSize += result;
requestV2->mask = mask;
requestV2->mode = openMode;
requestV2->flags = openFlags;
@@ -151,11 +162,18 @@
@@ -148,14 +162,23 @@
break;
}
case HGFS_OP_OPEN: {
+ int result;
HgfsRequestOpen *request;
request = (HgfsRequestOpen *)(HGFS_REQ_PAYLOAD(req));
@ -70,11 +94,12 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
+ return -EINVAL;
+ }
+
+ request->fileName.length = (uint32) result;
+ request->fileName.length = result;
+ reqSize += result;
request->mode = openMode;
request->flags = openFlags;
@@ -168,17 +186,6 @@
@@ -168,18 +191,7 @@
return -EPROTO;
}
@ -89,10 +114,12 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
- }
-
- *nameLength = (uint32) result;
req->payloadSize = reqSize + result;
- req->payloadSize = reqSize + result;
+ req->payloadSize = reqSize;
/* Fill in header here as payloadSize needs to be there. */
@@ -915,10 +922,6 @@
HgfsPackHeader(req, opUsed);
@@ -915,10 +927,6 @@
HgfsRename(const char* from, const char* to)
{
HgfsReq *req = NULL;
@ -103,7 +130,7 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
int result = 0;
uint32 reqSize;
HgfsOp opUsed;
@@ -942,33 +945,41 @@
@@ -942,33 +950,41 @@
if (opUsed == HGFS_OP_RENAME_V3) {
HgfsRequestRenameV3 *requestV3 = HgfsGetRequestPayload(req);
@ -161,7 +188,7 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
/*
* Build full new name to send to server.
@@ -983,8 +994,20 @@
@@ -983,8 +999,20 @@
newNameP = (HgfsFileNameV3 *)((char *)&requestV3->oldName +
sizeof requestV3->oldName + result);
@ -184,7 +211,7 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
newNameP->flags = 0;
newNameP->fid = HGFS_INVALID_HANDLE;
newNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
@@ -993,24 +1016,22 @@
@@ -993,24 +1021,22 @@
HgfsFileName *newNameP;
newNameP = (HgfsFileName *)((char *)&request->oldName +
sizeof request->oldName + result);
@ -221,7 +248,16 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
req->payloadSize = reqSize;
/* Fill in header here as payloadSize needs to be there. */
@@ -1109,10 +1130,7 @@
@@ -1068,7 +1094,7 @@
}
break;
default:
- LOG(4, ("failed with result %d\n", result));
+ LOG(4, ("Server protocol result %d\n", result));
}
break;
default:
@@ -1109,21 +1135,17 @@
{
HgfsAttrV2 *attrV2;
HgfsAttr *attrV1;
@ -231,8 +267,12 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
- uint32 *fileNameLength = NULL;
size_t reqBufferSize;
size_t reqSize;
int result = 0;
@@ -1123,7 +1141,6 @@
- int result = 0;
ASSERT(req);
switch (opUsed) {
case HGFS_OP_SETATTR_V3: {
+ int result;
HgfsRequestSetattrV3 *requestV3 = HgfsGetRequestPayload(req);
attrV2 = &requestV3->attr;
@ -240,7 +280,7 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
/*
* Clear attributes, mask, and hints before touching them.
@@ -1131,7 +1148,7 @@
@@ -1131,7 +1153,7 @@
* make sure to zero them all here.
*/
memset(attrV2, 0, sizeof *attrV2);
@ -249,7 +289,7 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
/*
* When possible, issue a setattr using an existing handle. This will
@@ -1143,14 +1160,20 @@
@@ -1143,14 +1165,21 @@
* the times also requires write permissions on Windows, so we require it
* here too. Otherwise, any handle will do.
*/
@ -269,10 +309,11 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
+ return -EINVAL;
+ }
+ requestV3->fileName.length = result;
+ reqSize += result;
attrV2->mask = attr->mask;
if (attr->mask & (HGFS_ATTR_VALID_SPECIAL_PERMS |
@@ -1173,11 +1196,11 @@
@@ -1173,22 +1202,22 @@
}
if (attr->mask & HGFS_ATTR_VALID_ACCESS_TIME) {
attrV2->accessTime = attr->accessTime;
@ -286,7 +327,11 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
}
break;
@@ -1188,7 +1211,6 @@
}
case HGFS_OP_SETATTR_V2: {
+ int result;
HgfsRequestSetattrV2 *requestV2;
requestV2 = (HgfsRequestSetattrV2 *)(HGFS_REQ_PAYLOAD(req));
attrV2 = &requestV2->attr;
@ -294,7 +339,7 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
/*
* Clear attributes, mask, and hints before touching them.
@@ -1196,13 +1218,18 @@
@@ -1196,13 +1225,19 @@
* make sure to zero them all here.
*/
memset(attrV2, 0, sizeof *attrV2);
@ -314,10 +359,11 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
+ return -EINVAL;
+ }
+ requestV2->fileName.length = result;
+ reqSize += result;
if (attr->mask & (HGFS_ATTR_VALID_SPECIAL_PERMS |
HGFS_ATTR_VALID_OWNER_PERMS |
@@ -1224,11 +1251,11 @@
@@ -1224,16 +1259,17 @@
}
if (attr->mask & HGFS_ATTR_VALID_ACCESS_TIME) {
attrV2->accessTime = attr->accessTime;
@ -331,7 +377,13 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
}
break;
@@ -1241,11 +1268,16 @@
}
case HGFS_OP_SETATTR: {
+ int result;
HgfsRequestSetattr *request;
request = (HgfsRequestSetattr *)(HGFS_REQ_PAYLOAD(req));
@@ -1241,11 +1277,17 @@
attrV1 = &request->attr;
update = &request->update;
@ -348,10 +400,11 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
+ return -EINVAL;
+ }
+ request->fileName.length = result;
+ reqSize += result;
/*
* Clear attributes before touching them.
@@ -1284,15 +1316,6 @@
@@ -1284,16 +1326,7 @@
return -EPROTO;
}
@ -364,6 +417,8 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3
- }
-
- *fileNameLength = result;
req->payloadSize = reqSize + result;
- req->payloadSize = reqSize + result;
+ req->payloadSize = reqSize;
/* Fill in header here as payloadSize needs to be there. */
HgfsPackHeader(req, opUsed);

View File

@ -1,17 +1,27 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/filesystem.c open-vm-tools-10.3.0-8931395/vmhgfs-fuse/filesystem.c
--- open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/filesystem.c 2018-06-23 03:03:28.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/filesystem.c 2019-02-02 17:32:36.382480084 -0800
@@ -123,8 +123,6 @@
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/filesystem.c 2019-02-11 18:47:36.188968780 -0800
@@ -1,5 +1,5 @@
/*********************************************************
- * Copyright (C) 2013 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013,2019 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
@@ -123,36 +123,50 @@
HgfsOp opUsed, // IN: Op to be used.
HgfsReq *req) // IN/OUT: Packet to write into
{
- char *name;
- uint32 *nameLength;
size_t requestSize;
int result;
- int result;
+
@@ -134,14 +132,20 @@
ASSERT(req);
switch (opUsed) {
case HGFS_OP_QUERY_VOLUME_INFO_V3: {
+ int result;
HgfsRequestQueryVolumeV3 *requestV3 = HgfsGetRequestPayload(req);
- /* We'll use these later. */
@ -30,11 +40,13 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/filesystem.c open-vm-tool
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ requestV3->fileName.length = (uint32) result;
+ requestV3->fileName.length = result;
+ requestSize += result;
break;
}
case HGFS_OP_QUERY_VOLUME_INFO: {
@@ -149,10 +153,16 @@
+ int result;
HgfsRequestQueryVolume *request;
request = (HgfsRequestQueryVolume *)(HGFS_REQ_PAYLOAD(req));
@ -50,11 +62,12 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/filesystem.c open-vm-tool
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ request->fileName.length = (uint32) result;
+ request->fileName.length = result;
+ requestSize += result;
break;
}
default:
@@ -160,16 +170,6 @@
@@ -160,17 +174,7 @@
return -EPROTO;
}
@ -68,6 +81,8 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/filesystem.c open-vm-tool
- }
-
- *nameLength = (uint32) result;
req->payloadSize = requestSize + result;
- req->payloadSize = requestSize + result;
+ req->payloadSize = requestSize;
/* Fill in header here as payloadSize needs to be there. */
HgfsPackHeader(req, opUsed);

View File

@ -1,6 +1,12 @@
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
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/fsutil.c 2019-02-11 18:51:48.527005190 -0800
@@ -1,5 +1,5 @@
/*********************************************************
- * Copyright (C) 2013 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013,2019 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
@@ -189,8 +189,6 @@
size_t reqBufferSize;
size_t reqSize;

View File

@ -1,7 +1,69 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/lib/hgfsServer/hgfsServer.c open-vm-tools-10.3.0-8931395/lib/hgfsServer/hgfsServer.c
--- open-vm-tools-10.3.0-8931395-orig/lib/hgfsServer/hgfsServer.c 2018-06-23 03:04:02.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/lib/hgfsServer/hgfsServer.c 2019-02-02 14:11:19.537039738 -0800
@@ -6536,9 +6536,11 @@
+++ open-vm-tools-10.3.0-8931395/lib/hgfsServer/hgfsServer.c 2019-02-11 18:49:37.218945512 -0800
@@ -1,5 +1,5 @@
/*********************************************************
- * Copyright (C) 1998-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2019 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
@@ -159,7 +159,7 @@
HgfsServerChannelData channelCapabilities;
};
-/* The input request paramaters object. */
+/* The input request parameters object. */
typedef struct HgfsInputParam {
const void *request; /* Hgfs header followed by operation request */
size_t requestSize; /* Size of Hgfs header and operation request */
@@ -2682,8 +2682,8 @@
* None
*
* Side effects:
- * If there isnt enough memory to accomodate the new names, those file nodes
- * that couldnt be updated are deleted.
+ * If there isn't enough memory to accommodate the new names, those file nodes
+ * that couldn't be updated are deleted.
*
*-----------------------------------------------------------------------------
*/
@@ -3399,7 +3399,7 @@
/* Send error if we fail to process the op. */
if (HGFS_ERROR_SUCCESS != status) {
- LOG(4, ("Error %d occured parsing the packet\n", (uint32)status));
+ LOG(4, ("Error %d occurred parsing the packet\n", (uint32)status));
HgfsServerCompleteRequest(status, 0, input);
}
}
@@ -4131,7 +4131,7 @@
result = TRUE;
}
}
- LOG(4, ("%s: Setting capabilitiy flags %x for op code %d %s\n",
+ LOG(4, ("%s: Setting capability flags %x for op code %d %s\n",
__FUNCTION__, flags, op, result ? "succeeded" : "failed"));
return result;
@@ -4143,7 +4143,7 @@
*
* HgfsServerResEnumInit --
*
- * Initialize an enumeration of all exisitng resources.
+ * Initialize an enumeration of all existing resources.
*
* Results:
* The enumeration state object.
@@ -4239,7 +4239,7 @@
*
* HgfsServerEnumerateSharedFolders --
*
- * Enumerates all exisitng shared folders and registers shared folders with
+ * Enumerates all existing shared folders and registers shared folders with
* directory notification package.
*
* Results:
@@ -6536,11 +6536,13 @@
payload = &reply->payload[0];
}
if (payload) {
@ -10,11 +72,13 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/lib/hgfsServer/hgfsServer.c open-vm-t
requiredSize, payload,
- &reply->actualSize);
+ &actualSize);
+ reply->actualSize = actualSize;
if (HGFS_ERROR_SUCCESS == status) {
reply->reserved = 0;
+ reply->actualSize = actualSize;
replyPayloadSize = sizeof *reply;
@@ -6556,10 +6558,12 @@
if (readUseDataBuffer) {
@@ -6556,11 +6558,13 @@
break;
}
case HGFS_OP_READ: {
@ -24,7 +88,19 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/lib/hgfsServer/hgfsServer.c open-vm-t
status = HgfsPlatformReadFile(readFd, input->session, offset, requiredSize,
- reply->payload, &reply->actualSize);
+ reply->payload, &actualSize);
+ reply->actualSize = actualSize;
if (HGFS_ERROR_SUCCESS == status) {
+ reply->actualSize = actualSize;
replyPayloadSize = sizeof *reply + reply->actualSize;
} else {
LOG(4, ("%s: V1 Failed to read-> %d.\n", __FUNCTION__, status));
@@ -7246,8 +7250,8 @@
if (HGFS_ERROR_SUCCESS != status) {
LOG(4, ("%s: could not map cached handle %d, error %u\n",
__FUNCTION__, fileHandle, status));
- } else if (!HgfsHandle2FileNameMode(fileHandle, session, &shareInfo->writePermissions,
- &shareInfo->readPermissions, localFileName,
+ } else if (!HgfsHandle2FileNameMode(fileHandle, session, &shareInfo->readPermissions,
+ &shareInfo->writePermissions, localFileName,
localNameLength)) {
/*
* HgfsPlatformRename requires valid source file name even when file handle

View File

@ -1,6 +1,12 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/hgfsmounter/hgfsmounter.c open-vm-tools-10.3.0-8931395/hgfsmounter/hgfsmounter.c
--- open-vm-tools-10.3.0-8931395-orig/hgfsmounter/hgfsmounter.c 2018-06-23 03:03:28.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/hgfsmounter/hgfsmounter.c 2019-02-02 15:22:17.639393841 -0800
+++ open-vm-tools-10.3.0-8931395/hgfsmounter/hgfsmounter.c 2019-02-11 18:48:21.024330608 -0800
@@ -1,5 +1,5 @@
/*********************************************************
- * Copyright (C) 2006-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2006-2019 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
@@ -514,11 +514,13 @@
HgfsMountInfo *mountInfo, // OUT: mount data
int *flags) // OUT: mount flags

View File

@ -1,7 +1,13 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/link.c open-vm-tools-10.3.0-8931395/vmhgfs-fuse/link.c
--- open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/link.c 2018-06-23 03:03:28.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/link.c 2019-02-03 00:07:18.555759499 -0800
@@ -51,12 +51,7 @@
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/link.c 2019-02-11 18:50:41.293462605 -0800
@@ -1,5 +1,5 @@
/*********************************************************
- * Copyright (C) 2013 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013,2019 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
@@ -51,36 +51,81 @@
{
HgfsRequestSymlinkCreateV3 *requestV3 = NULL;
HgfsRequestSymlinkCreate *request = NULL;
@ -12,10 +18,14 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/link.c open-vm-tools-10.3
size_t targetNameBytes;
-
size_t requestSize;
int result;
- int result;
+
+ targetNameBytes = strlen(symname) + 1;
@@ -64,23 +59,35 @@
switch (opUsed) {
case HGFS_OP_CREATE_SYMLINK_V3: {
+ int result;
+ HgfsFileNameV3 *fileNameP;
requestV3 = HgfsGetRequestPayload(req);
- /* We'll use these later. */
@ -35,9 +45,29 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/link.c open-vm-tools-10.3
+ return -EINVAL;
+ }
+ requestV3->symlinkName.length = result;
+ requestSize += result;
+
+ /* Copy target name into request packet. */
+ if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) {
+ LOG(4, ("Target name is too long.\n"));
+ return -EINVAL;
+ }
+
+ fileNameP = (HgfsFileNameV3 *)((char *)&requestV3->symlinkName +
+ sizeof requestV3->symlinkName + result);
+ memcpy(fileNameP->name, symname, targetNameBytes);
+ LOG(6, ("Target name: \"%s\"\n", fileNameP->name));
+ /* Convert target name to CPName-lite format. */
+ CPNameLite_ConvertTo(fileNameP->name, targetNameBytes - 1, '/');
+ fileNameP->length = targetNameBytes - 1;
+ fileNameP->flags = 0;
+ fileNameP->fid = HGFS_INVALID_HANDLE;
+ fileNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
break;
}
case HGFS_OP_CREATE_SYMLINK: {
+ int result;
+ HgfsFileName *fileNameP;
request = (HgfsRequestSymlinkCreate *)(HGFS_REQ_PAYLOAD(req));
- /* We'll use these later. */
@ -53,10 +83,25 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/link.c open-vm-tools-10.3
+ return -EINVAL;
+ }
+ request->symlinkName.length = result;
+ requestSize += result;
+
+ /* Copy target name into request packet. */
+ if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) {
+ LOG(4, ("Target name is too long.\n"));
+ return -EINVAL;
+ }
+
+ fileNameP = (HgfsFileName *)((char *)&request->symlinkName +
+ sizeof request->symlinkName + result);
+ memcpy(fileNameP->name, symname, targetNameBytes);
+ LOG(6, ("Target name: \"%s\"\n", fileNameP->name));
+ /* Convert target name to CPName-lite format. */
+ CPNameLite_ConvertTo(fileNameP->name, targetNameBytes - 1, '/');
+ fileNameP->length = targetNameBytes - 1;
break;
}
default:
@@ -88,19 +95,10 @@
@@ -88,59 +133,13 @@
return -EPROTO;
}
@ -71,52 +116,51 @@ diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/link.c open-vm-tools-10.3
- }
-
- *symlinkNameLength = result;
req->payloadSize = requestSize + result;
- req->payloadSize = requestSize + result;
+ req->payloadSize = requestSize;
+ targetNameBytes = strlen(symname) + 1;
+
/*
* Note the different buffer length. This is because HgfsRequestSymlink
* contains two filenames, and once we place the first into the packet we
@@ -115,8 +113,11 @@
HgfsFileNameV3 *fileNameP;
fileNameP = (HgfsFileNameV3 *)((char *)&requestV3->symlinkName +
sizeof requestV3->symlinkName + result);
- * Note the different buffer length. This is because HgfsRequestSymlink
- * contains two filenames, and once we place the first into the packet we
- * must account for it when determining the amount of buffer available for
- * the second.
- *
- * Also note that targetNameBytes accounts for the NUL character. Once
- * we've converted it to CP name, it won't be NUL-terminated and the length
- * of the string in the packet itself won't account for it.
+ * targetNameBytes accounts for the NUL character. Once we've converted
+ * it to CP name, it won't be NUL-terminated and the length of the string
+ * in the packet itself won't account for it.
*/
- if (opUsed == HGFS_OP_CREATE_SYMLINK_V3) {
- HgfsFileNameV3 *fileNameP;
- fileNameP = (HgfsFileNameV3 *)((char *)&requestV3->symlinkName +
- sizeof requestV3->symlinkName + result);
- targetName = fileNameP->name;
- targetNameLength = &fileNameP->length;
+ memcpy(fileNameP->name, symname, targetNameBytes);
+ LOG(6, ("Target name: \"%s\"\n", fileNameP->name));
+ /* Convert target name to CPName-lite format. */
+ CPNameLite_ConvertTo(fileNameP->name, targetNameBytes - 1, '/');
+ fileNameP->length = targetNameBytes - 1;
fileNameP->flags = 0;
fileNameP->fid = HGFS_INVALID_HANDLE;
fileNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
@@ -124,23 +125,19 @@
HgfsFileName *fileNameP;
fileNameP = (HgfsFileName *)((char *)&request->symlinkName +
sizeof request->symlinkName + result);
- fileNameP->flags = 0;
- fileNameP->fid = HGFS_INVALID_HANDLE;
- fileNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
- } else {
- HgfsFileName *fileNameP;
- fileNameP = (HgfsFileName *)((char *)&request->symlinkName +
- sizeof request->symlinkName + result);
- targetName = fileNameP->name;
- targetNameLength = &fileNameP->length;
+ memcpy(fileNameP->name, symname, targetNameBytes);
+ LOG(6, ("Target name: \"%s\"\n", fileNameP->name));
+ /* Convert target name to CPName-lite format. */
+ CPNameLite_ConvertTo(fileNameP->name, targetNameBytes - 1, '/');
+ fileNameP->length = targetNameBytes - 1;
}
- }
- targetNameBytes = strlen(symname) + 1;
/* Copy target name into request packet. */
if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) {
LOG(4, ("Target name is too long.\n"));
return -EINVAL;
}
-
- /* Copy target name into request packet. */
- if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) {
- LOG(4, ("Target name is too long.\n"));
- return -EINVAL;
- }
- memcpy(targetName, symname, targetNameBytes);
- LOG(6, ("Target name: \"%s\"\n", targetName));
-
- /* Convert target name to CPName-lite format. */
- CPNameLite_ConvertTo(targetName, targetNameBytes - 1, '/');
-
- *targetNameLength = targetNameBytes - 1;
req->payloadSize += targetNameBytes - 1;

View File

@ -1,5 +1,5 @@
################################################################################
### Copyright 2013-18 VMware, Inc. All rights reserved.
### Copyright 2013-19 VMware, Inc. All rights reserved.
###
### RPM SPEC file for building open-vm-tools packages.
###
@ -331,6 +331,10 @@ fi
%{_bindir}/vmware-vgauth-smoketest
%changelog
* Tue Feb 12 2019 Ravindra Kumar <ravindrakumar@vmware.com> - 10.3.0-8
- Updated *-aligned.patch files with more tweaks.
- Filed a regression in readdir operation in dir-aligned.patch.
* Sun Feb 03 2019 Ravindra Kumar <ravindrakumar@vmware.com> - 10.3.0-7
- Added hgfsServer-aligned.patch for "address-of-packed-member" error.
- Added hgfsmounter-aligned.patch for "address-of-packed-member" error.