diff options
| -rw-r--r-- | meta-oe/recipes-support/open-vm-tools/open-vm-tools/0014-Fix-new-warnings-from-gcc9.patch | 1281 | ||||
| -rw-r--r-- | meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.3.5.bb | 1 |
2 files changed, 1282 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0014-Fix-new-warnings-from-gcc9.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0014-Fix-new-warnings-from-gcc9.patch new file mode 100644 index 0000000000..b5ccffd141 --- /dev/null +++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0014-Fix-new-warnings-from-gcc9.patch | |||
| @@ -0,0 +1,1281 @@ | |||
| 1 | From af9eca8689c97ea8e792902b458a31608286655e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Martin Jansa <martin.jansa@lge.com> | ||
| 3 | Date: Thu, 13 Jun 2019 16:01:03 +0000 | ||
| 4 | Subject: [PATCH] Fix new warnings from gcc9 | ||
| 5 | |||
| 6 | Imported from Fedora: | ||
| 7 | https://src.fedoraproject.org/rpms/open-vm-tools/raw/master/f/gcc9-warnings.patch | ||
| 8 | |||
| 9 | Upstream bug: | ||
| 10 | https://github.com/vmware/open-vm-tools/issues/330 | ||
| 11 | |||
| 12 | Upstream-Status: Pending | ||
| 13 | --- | ||
| 14 | open-vm-tools/hgfsmounter/hgfsmounter.c | 14 +- | ||
| 15 | open-vm-tools/lib/hgfsServer/hgfsServer.c | 24 ++- | ||
| 16 | open-vm-tools/vmhgfs-fuse/dir.c | 175 ++++++++--------- | ||
| 17 | open-vm-tools/vmhgfs-fuse/file.c | 217 +++++++++++++--------- | ||
| 18 | open-vm-tools/vmhgfs-fuse/filesystem.c | 46 ++--- | ||
| 19 | open-vm-tools/vmhgfs-fuse/fsutil.c | 63 ++++--- | ||
| 20 | open-vm-tools/vmhgfs-fuse/link.c | 125 +++++++------ | ||
| 21 | 7 files changed, 367 insertions(+), 297 deletions(-) | ||
| 22 | |||
| 23 | diff --git a/open-vm-tools/hgfsmounter/hgfsmounter.c b/open-vm-tools/hgfsmounter/hgfsmounter.c | ||
| 24 | index 0921b700..3f6798dc 100644 | ||
| 25 | --- a/open-vm-tools/hgfsmounter/hgfsmounter.c | ||
| 26 | +++ b/open-vm-tools/hgfsmounter/hgfsmounter.c | ||
| 27 | @@ -1,5 +1,5 @@ | ||
| 28 | /********************************************************* | ||
| 29 | - * Copyright (C) 2006-2017 VMware, Inc. All rights reserved. | ||
| 30 | + * Copyright (C) 2006-2019 VMware, Inc. All rights reserved. | ||
| 31 | * | ||
| 32 | * This program is free software; you can redistribute it and/or modify it | ||
| 33 | * under the terms of the GNU Lesser General Public License as published | ||
| 34 | @@ -514,11 +514,13 @@ ParseFmask(const char *option, // IN: option string along with value | ||
| 35 | HgfsMountInfo *mountInfo, // OUT: mount data | ||
| 36 | int *flags) // OUT: mount flags | ||
| 37 | { | ||
| 38 | + unsigned short fmask = 0; | ||
| 39 | ASSERT(option); | ||
| 40 | ASSERT(mountInfo); | ||
| 41 | |||
| 42 | - if (ParseMask(option, &mountInfo->fmask)) { | ||
| 43 | - LOG("Setting mount fmask to %o\n", mountInfo->fmask); | ||
| 44 | + if (ParseMask(option, &fmask)) { | ||
| 45 | + LOG("Setting mount fmask to %o\n", fmask); | ||
| 46 | + mountInfo->fmask = fmask; | ||
| 47 | return TRUE; | ||
| 48 | } | ||
| 49 | |||
| 50 | @@ -548,11 +550,13 @@ ParseDmask(const char *option, // IN: option string along with value | ||
| 51 | HgfsMountInfo *mountInfo, // OUT: mount data | ||
| 52 | int *flags) // OUT: mount flags | ||
| 53 | { | ||
| 54 | + unsigned short dmask = 0; | ||
| 55 | ASSERT(option); | ||
| 56 | ASSERT(mountInfo); | ||
| 57 | |||
| 58 | - if (ParseMask(option, &mountInfo->dmask)) { | ||
| 59 | - LOG("Setting mount dmask to %o\n", mountInfo->dmask); | ||
| 60 | + if (ParseMask(option, &dmask)) { | ||
| 61 | + LOG("Setting mount dmask to %o\n", dmask); | ||
| 62 | + mountInfo->dmask = dmask; | ||
| 63 | return TRUE; | ||
| 64 | } | ||
| 65 | |||
| 66 | diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c | ||
| 67 | index 740c4fed..422383cd 100644 | ||
| 68 | --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c | ||
| 69 | +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c | ||
| 70 | @@ -1,5 +1,5 @@ | ||
| 71 | /********************************************************* | ||
| 72 | - * Copyright (C) 1998-2018 VMware, Inc. All rights reserved. | ||
| 73 | + * Copyright (C) 1998-2019 VMware, Inc. All rights reserved. | ||
| 74 | * | ||
| 75 | * This program is free software; you can redistribute it and/or modify it | ||
| 76 | * under the terms of the GNU Lesser General Public License as published | ||
| 77 | @@ -159,7 +159,7 @@ struct HgfsTransportSessionInfo { | ||
| 78 | HgfsServerChannelData channelCapabilities; | ||
| 79 | }; | ||
| 80 | |||
| 81 | -/* The input request paramaters object. */ | ||
| 82 | +/* The input request parameters object. */ | ||
| 83 | typedef struct HgfsInputParam { | ||
| 84 | const void *request; /* Hgfs header followed by operation request */ | ||
| 85 | size_t requestSize; /* Size of Hgfs header and operation request */ | ||
| 86 | @@ -2682,8 +2682,8 @@ HgfsSearchHandle2Search(HgfsHandle handle, // IN: handle | ||
| 87 | * None | ||
| 88 | * | ||
| 89 | * Side effects: | ||
| 90 | - * If there isnt enough memory to accomodate the new names, those file nodes | ||
| 91 | - * that couldnt be updated are deleted. | ||
| 92 | + * If there isn't enough memory to accommodate the new names, those file nodes | ||
| 93 | + * that couldn't be updated are deleted. | ||
| 94 | * | ||
| 95 | *----------------------------------------------------------------------------- | ||
| 96 | */ | ||
| 97 | @@ -3399,7 +3399,7 @@ HgfsServerSessionReceive(HgfsPacket *packet, // IN: Hgfs Packet | ||
| 98 | |||
| 99 | /* Send error if we fail to process the op. */ | ||
| 100 | if (HGFS_ERROR_SUCCESS != status) { | ||
| 101 | - LOG(4, ("Error %d occured parsing the packet\n", (uint32)status)); | ||
| 102 | + LOG(4, ("Error %d occurred parsing the packet\n", (uint32)status)); | ||
| 103 | HgfsServerCompleteRequest(status, 0, input); | ||
| 104 | } | ||
| 105 | } | ||
| 106 | @@ -4131,7 +4131,7 @@ HgfsServerSetSessionCapability(HgfsOp op, // IN: operation code | ||
| 107 | result = TRUE; | ||
| 108 | } | ||
| 109 | } | ||
| 110 | - LOG(4, ("%s: Setting capabilitiy flags %x for op code %d %s\n", | ||
| 111 | + LOG(4, ("%s: Setting capability flags %x for op code %d %s\n", | ||
| 112 | __FUNCTION__, flags, op, result ? "succeeded" : "failed")); | ||
| 113 | |||
| 114 | return result; | ||
| 115 | @@ -4143,7 +4143,7 @@ HgfsServerSetSessionCapability(HgfsOp op, // IN: operation code | ||
| 116 | * | ||
| 117 | * HgfsServerResEnumInit -- | ||
| 118 | * | ||
| 119 | - * Initialize an enumeration of all exisitng resources. | ||
| 120 | + * Initialize an enumeration of all existing resources. | ||
| 121 | * | ||
| 122 | * Results: | ||
| 123 | * The enumeration state object. | ||
| 124 | @@ -4239,7 +4239,7 @@ HgfsServerResEnumExit(void *enumState) // IN/OUT: enumeration state | ||
| 125 | * | ||
| 126 | * HgfsServerEnumerateSharedFolders -- | ||
| 127 | * | ||
| 128 | - * Enumerates all exisitng shared folders and registers shared folders with | ||
| 129 | + * Enumerates all existing shared folders and registers shared folders with | ||
| 130 | * directory notification package. | ||
| 131 | * | ||
| 132 | * Results: | ||
| 133 | @@ -6536,11 +6536,13 @@ HgfsServerRead(HgfsInputParam *input) // IN: Input params | ||
| 134 | payload = &reply->payload[0]; | ||
| 135 | } | ||
| 136 | if (payload) { | ||
| 137 | + uint32 actualSize = 0; | ||
| 138 | status = HgfsPlatformReadFile(readFd, input->session, offset, | ||
| 139 | requiredSize, payload, | ||
| 140 | - &reply->actualSize); | ||
| 141 | + &actualSize); | ||
| 142 | if (HGFS_ERROR_SUCCESS == status) { | ||
| 143 | reply->reserved = 0; | ||
| 144 | + reply->actualSize = actualSize; | ||
| 145 | replyPayloadSize = sizeof *reply; | ||
| 146 | |||
| 147 | if (readUseDataBuffer) { | ||
| 148 | @@ -6556,11 +6558,13 @@ HgfsServerRead(HgfsInputParam *input) // IN: Input params | ||
| 149 | break; | ||
| 150 | } | ||
| 151 | case HGFS_OP_READ: { | ||
| 152 | + uint32 actualSize = 0; | ||
| 153 | HgfsReplyRead *reply = replyRead; | ||
| 154 | |||
| 155 | status = HgfsPlatformReadFile(readFd, input->session, offset, requiredSize, | ||
| 156 | - reply->payload, &reply->actualSize); | ||
| 157 | + reply->payload, &actualSize); | ||
| 158 | if (HGFS_ERROR_SUCCESS == status) { | ||
| 159 | + reply->actualSize = actualSize; | ||
| 160 | replyPayloadSize = sizeof *reply + reply->actualSize; | ||
| 161 | } else { | ||
| 162 | LOG(4, ("%s: V1 Failed to read-> %d.\n", __FUNCTION__, status)); | ||
| 163 | diff --git a/open-vm-tools/vmhgfs-fuse/dir.c b/open-vm-tools/vmhgfs-fuse/dir.c | ||
| 164 | index 6298a4ea..e71b7afd 100644 | ||
| 165 | --- a/open-vm-tools/vmhgfs-fuse/dir.c | ||
| 166 | +++ b/open-vm-tools/vmhgfs-fuse/dir.c | ||
| 167 | @@ -1,5 +1,5 @@ | ||
| 168 | /********************************************************* | ||
| 169 | - * Copyright (C) 2013 VMware, Inc. All rights reserved. | ||
| 170 | + * Copyright (C) 2013,2019 VMware, Inc. All rights reserved. | ||
| 171 | * | ||
| 172 | * This program is free software; you can redistribute it and/or modify it | ||
| 173 | * under the terms of the GNU Lesser General Public License as published | ||
| 174 | @@ -54,38 +54,53 @@ HgfsPackDirOpenRequest(const char *path, // IN: Path of the dir to open | ||
| 175 | HgfsOp opUsed, // IN: Op to be used | ||
| 176 | HgfsReq *req) // IN/OUT: Packet to write into | ||
| 177 | { | ||
| 178 | - char *name; | ||
| 179 | - unsigned int *nameLength = NULL; | ||
| 180 | size_t reqSize; | ||
| 181 | - int result; | ||
| 182 | |||
| 183 | ASSERT(path); | ||
| 184 | ASSERT(req); | ||
| 185 | LOG(4, ("Path = %s \n", path)); | ||
| 186 | switch (opUsed) { | ||
| 187 | case HGFS_OP_SEARCH_OPEN_V3: { | ||
| 188 | + int result; | ||
| 189 | HgfsRequestSearchOpenV3 *requestV3 = HgfsGetRequestPayload(req); | ||
| 190 | |||
| 191 | - /* We'll use these later. */ | ||
| 192 | - name = requestV3->dirName.name; | ||
| 193 | - nameLength = &requestV3->dirName.length; | ||
| 194 | requestV3->dirName.flags = 0; | ||
| 195 | requestV3->dirName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 196 | requestV3->dirName.fid = HGFS_INVALID_HANDLE; | ||
| 197 | requestV3->reserved = 0; | ||
| 198 | reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize(); | ||
| 199 | + /* Convert to CP name. */ | ||
| 200 | + result = CPName_ConvertTo(path, | ||
| 201 | + HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 202 | + requestV3->dirName.name); | ||
| 203 | + if (result < 0) { | ||
| 204 | + LOG(4, ("CP conversion failed\n")); | ||
| 205 | + return -EINVAL; | ||
| 206 | + } | ||
| 207 | + LOG(4, ("After conversion = %s\n", requestV3->dirName.name)); | ||
| 208 | + requestV3->dirName.length = result; | ||
| 209 | + reqSize += result; | ||
| 210 | break; | ||
| 211 | } | ||
| 212 | |||
| 213 | case HGFS_OP_SEARCH_OPEN: { | ||
| 214 | + int result; | ||
| 215 | HgfsRequestSearchOpen *request; | ||
| 216 | |||
| 217 | request = (HgfsRequestSearchOpen *)(HGFS_REQ_PAYLOAD(req)); | ||
| 218 | |||
| 219 | - /* We'll use these later. */ | ||
| 220 | - name = request->dirName.name; | ||
| 221 | - nameLength = &request->dirName.length; | ||
| 222 | reqSize = sizeof *request; | ||
| 223 | + /* Convert to CP name. */ | ||
| 224 | + result = CPName_ConvertTo(path, | ||
| 225 | + HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 226 | + request->dirName.name); | ||
| 227 | + if (result < 0) { | ||
| 228 | + LOG(4, ("CP conversion failed\n")); | ||
| 229 | + return -EINVAL; | ||
| 230 | + } | ||
| 231 | + LOG(4, ("After conversion = %s\n", request->dirName.name)); | ||
| 232 | + request->dirName.length = result; | ||
| 233 | + reqSize += result; | ||
| 234 | break; | ||
| 235 | } | ||
| 236 | |||
| 237 | @@ -94,21 +109,7 @@ HgfsPackDirOpenRequest(const char *path, // IN: Path of the dir to open | ||
| 238 | return -EPROTO; | ||
| 239 | } | ||
| 240 | |||
| 241 | - /* Convert to CP name. */ | ||
| 242 | - | ||
| 243 | - LOG(4, ("After buildPath = %s\n", path)); | ||
| 244 | - result = CPName_ConvertTo(path, | ||
| 245 | - HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 246 | - name); | ||
| 247 | - if (result < 0) { | ||
| 248 | - LOG(4, ("CP conversion failed\n")); | ||
| 249 | - return -EINVAL; | ||
| 250 | - } | ||
| 251 | - | ||
| 252 | - LOG(4, ("After conversion = %s\n", name)); | ||
| 253 | - | ||
| 254 | - *nameLength = (uint32) result; | ||
| 255 | - req->payloadSize = reqSize + result; | ||
| 256 | + req->payloadSize = reqSize; | ||
| 257 | |||
| 258 | /* Fill in header here as payloadSize needs to be there. */ | ||
| 259 | HgfsPackHeader(req, opUsed); | ||
| 260 | @@ -149,7 +150,6 @@ HgfsDirOpen(const char* path, // IN: Path of dir to open | ||
| 261 | int result; | ||
| 262 | HgfsOp opUsed; | ||
| 263 | HgfsStatus replyStatus; | ||
| 264 | - HgfsHandle *replySearch; | ||
| 265 | |||
| 266 | ASSERT(path); | ||
| 267 | req = HgfsGetNewRequest(); | ||
| 268 | @@ -161,16 +161,6 @@ HgfsDirOpen(const char* path, // IN: Path of dir to open | ||
| 269 | |||
| 270 | retry: | ||
| 271 | opUsed = hgfsVersionSearchOpen; | ||
| 272 | - if (opUsed == HGFS_OP_SEARCH_OPEN_V3) { | ||
| 273 | - HgfsReplySearchOpenV3 *requestV3 = HgfsGetReplyPayload(req); | ||
| 274 | - | ||
| 275 | - replySearch = &requestV3->search; | ||
| 276 | - | ||
| 277 | - } else { | ||
| 278 | - HgfsReplySearchOpen *request = (HgfsReplySearchOpen *)HGFS_REQ_PAYLOAD(req); | ||
| 279 | - | ||
| 280 | - replySearch = &request->search; | ||
| 281 | - } | ||
| 282 | |||
| 283 | result = HgfsPackDirOpenRequest(path, opUsed, req); | ||
| 284 | if (result != 0) { | ||
| 285 | @@ -187,8 +177,14 @@ retry: | ||
| 286 | |||
| 287 | switch (result) { | ||
| 288 | case 0: | ||
| 289 | - *handle = *replySearch; | ||
| 290 | - LOG(6, ("Set handle to %u\n", *replySearch)); | ||
| 291 | + if (opUsed == HGFS_OP_SEARCH_OPEN_V3) { | ||
| 292 | + HgfsReplySearchOpenV3 *requestV3 = HgfsGetReplyPayload(req); | ||
| 293 | + *handle = requestV3->search; | ||
| 294 | + } else { | ||
| 295 | + HgfsReplySearchOpen *request = (HgfsReplySearchOpen *)HGFS_REQ_PAYLOAD(req); | ||
| 296 | + *handle = request->search; | ||
| 297 | + } | ||
| 298 | + LOG(6, ("Set handle to %u\n", *handle)); | ||
| 299 | break; | ||
| 300 | case -EPROTO: | ||
| 301 | /* Retry with older version(s). Set globally. */ | ||
| 302 | @@ -626,25 +622,30 @@ HgfsPackCreateDirRequest(const char *path, | ||
| 303 | HgfsOp opUsed, // IN: Op to be used. | ||
| 304 | HgfsReq *req) // IN/OUT: Packet to write into | ||
| 305 | { | ||
| 306 | - char *fileName = NULL; | ||
| 307 | - uint32 *fileNameLength; | ||
| 308 | size_t reqSize; | ||
| 309 | - int result; | ||
| 310 | + | ||
| 311 | |||
| 312 | ASSERT(req); | ||
| 313 | |||
| 314 | switch (opUsed) { | ||
| 315 | case HGFS_OP_CREATE_DIR_V3: { | ||
| 316 | + int result; | ||
| 317 | HgfsRequestCreateDirV3 *requestV3 = HgfsGetRequestPayload(req); | ||
| 318 | |||
| 319 | reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize(); | ||
| 320 | - /* We'll use these later. */ | ||
| 321 | - fileName = requestV3->fileName.name; | ||
| 322 | - fileNameLength = &requestV3->fileName.length; | ||
| 323 | requestV3->fileName.flags = 0; | ||
| 324 | requestV3->fileName.fid = HGFS_INVALID_HANDLE; | ||
| 325 | requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 326 | - | ||
| 327 | + /* Convert to CP name. */ | ||
| 328 | + result = CPName_ConvertTo(path, | ||
| 329 | + HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 330 | + requestV3->fileName.name); | ||
| 331 | + if (result < 0) { | ||
| 332 | + LOG(4, ("CP conversion failed.\n")); | ||
| 333 | + return -EINVAL; | ||
| 334 | + } | ||
| 335 | + requestV3->fileName.length = result; | ||
| 336 | + reqSize += result; | ||
| 337 | requestV3->mask = HGFS_CREATE_DIR_MASK; | ||
| 338 | |||
| 339 | /* Set permissions. */ | ||
| 340 | @@ -656,15 +657,23 @@ HgfsPackCreateDirRequest(const char *path, | ||
| 341 | break; | ||
| 342 | } | ||
| 343 | case HGFS_OP_CREATE_DIR_V2: { | ||
| 344 | + int result; | ||
| 345 | HgfsRequestCreateDirV2 *requestV2; | ||
| 346 | |||
| 347 | requestV2 = (HgfsRequestCreateDirV2 *)(HGFS_REQ_PAYLOAD(req)); | ||
| 348 | |||
| 349 | - /* We'll use these later. */ | ||
| 350 | - fileName = requestV2->fileName.name; | ||
| 351 | - fileNameLength = &requestV2->fileName.length; | ||
| 352 | reqSize = sizeof *requestV2; | ||
| 353 | |||
| 354 | + /* Convert to CP name. */ | ||
| 355 | + result = CPName_ConvertTo(path, | ||
| 356 | + HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 357 | + requestV2->fileName.name); | ||
| 358 | + if (result < 0) { | ||
| 359 | + LOG(4, ("CP conversion failed.\n")); | ||
| 360 | + return -EINVAL; | ||
| 361 | + } | ||
| 362 | + requestV2->fileName.length = result; | ||
| 363 | + reqSize += result; | ||
| 364 | requestV2->mask = HGFS_CREATE_DIR_MASK; | ||
| 365 | |||
| 366 | /* Set permissions. */ | ||
| 367 | @@ -675,15 +684,22 @@ HgfsPackCreateDirRequest(const char *path, | ||
| 368 | break; | ||
| 369 | } | ||
| 370 | case HGFS_OP_CREATE_DIR: { | ||
| 371 | + int result; | ||
| 372 | HgfsRequestCreateDir *request; | ||
| 373 | |||
| 374 | request = (HgfsRequestCreateDir *)(HGFS_REQ_PAYLOAD(req)); | ||
| 375 | |||
| 376 | - /* We'll use these later. */ | ||
| 377 | - fileName = request->fileName.name; | ||
| 378 | - fileNameLength = &request->fileName.length; | ||
| 379 | reqSize = sizeof *request; | ||
| 380 | - | ||
| 381 | + /* Convert to CP name. */ | ||
| 382 | + result = CPName_ConvertTo(path, | ||
| 383 | + HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 384 | + request->fileName.name); | ||
| 385 | + if (result < 0) { | ||
| 386 | + LOG(4, ("CP conversion failed.\n")); | ||
| 387 | + return -EINVAL; | ||
| 388 | + } | ||
| 389 | + request->fileName.length = result; | ||
| 390 | + reqSize += result; | ||
| 391 | /* Set permissions. */ | ||
| 392 | request->permissions = (permsMode & S_IRWXU) >> 6; | ||
| 393 | break; | ||
| 394 | @@ -693,18 +709,7 @@ HgfsPackCreateDirRequest(const char *path, | ||
| 395 | return -EPROTO; | ||
| 396 | } | ||
| 397 | |||
| 398 | - | ||
| 399 | - /* Convert to CP name. */ | ||
| 400 | - result = CPName_ConvertTo(path, | ||
| 401 | - HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 402 | - fileName); | ||
| 403 | - if (result < 0) { | ||
| 404 | - LOG(4, ("CP conversion failed.\n")); | ||
| 405 | - return -EINVAL; | ||
| 406 | - } | ||
| 407 | - | ||
| 408 | - *fileNameLength = result; | ||
| 409 | - req->payloadSize = reqSize + result; | ||
| 410 | + req->payloadSize = reqSize; | ||
| 411 | |||
| 412 | /* Fill in header here as payloadSize needs to be there. */ | ||
| 413 | HgfsPackHeader(req, opUsed); | ||
| 414 | @@ -827,8 +832,6 @@ HgfsDelete(const char* path, // IN: Path to file | ||
| 415 | HgfsReq *req = NULL; | ||
| 416 | int result = 0; | ||
| 417 | HgfsStatus replyStatus; | ||
| 418 | - char *fileName = NULL; | ||
| 419 | - uint32 *fileNameLength; | ||
| 420 | uint32 reqSize; | ||
| 421 | HgfsOp opUsed; | ||
| 422 | HgfsAttrInfo newAttr = {0}; | ||
| 423 | @@ -862,8 +865,17 @@ HgfsDelete(const char* path, // IN: Path to file | ||
| 424 | |||
| 425 | reqSize = sizeof(*request) + HgfsGetRequestHeaderSize(); | ||
| 426 | request->hints = 0; | ||
| 427 | - fileName = request->fileName.name; | ||
| 428 | - fileNameLength = &request->fileName.length; | ||
| 429 | + /* Convert to CP name. */ | ||
| 430 | + result = CPName_ConvertTo(path, | ||
| 431 | + HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize), | ||
| 432 | + request->fileName.name); | ||
| 433 | + if (result < 0) { | ||
| 434 | + LOG(4, ("CP conversion failed.\n")); | ||
| 435 | + result = -EINVAL; | ||
| 436 | + goto out; | ||
| 437 | + } | ||
| 438 | + request->fileName.length = result; | ||
| 439 | + reqSize += result; | ||
| 440 | request->fileName.fid = HGFS_INVALID_HANDLE; | ||
| 441 | request->fileName.flags = 0; | ||
| 442 | request->fileName.caseType = HGFS_FILE_NAME_DEFAULT_CASE; | ||
| 443 | @@ -874,24 +886,21 @@ HgfsDelete(const char* path, // IN: Path to file | ||
| 444 | |||
| 445 | request = (HgfsRequestDelete *)(HGFS_REQ_PAYLOAD(req)); | ||
| 446 | /* Fill out the request packet. */ | ||
| 447 | - fileName = request->fileName.name; | ||
| 448 | - fileNameLength = &request->fileName.length; | ||
| 449 | reqSize = sizeof *request; | ||
| 450 | + /* Convert to CP name. */ | ||
| 451 | + result = CPName_ConvertTo(path, | ||
| 452 | + HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize), | ||
| 453 | + request->fileName.name); | ||
| 454 | + if (result < 0) { | ||
| 455 | + LOG(4, ("CP conversion failed.\n")); | ||
| 456 | + result = -EINVAL; | ||
| 457 | + goto out; | ||
| 458 | + } | ||
| 459 | + request->fileName.length = result; | ||
| 460 | + reqSize += result; | ||
| 461 | } | ||
| 462 | |||
| 463 | - | ||
| 464 | - /* Convert to CP name. */ | ||
| 465 | - result = CPName_ConvertTo(path, | ||
| 466 | - HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize), | ||
| 467 | - fileName); | ||
| 468 | - if (result < 0) { | ||
| 469 | - LOG(4, ("CP conversion failed.\n")); | ||
| 470 | - result = -EINVAL; | ||
| 471 | - goto out; | ||
| 472 | - } | ||
| 473 | - | ||
| 474 | - *fileNameLength = result; | ||
| 475 | - req->payloadSize = reqSize + result; | ||
| 476 | + req->payloadSize = reqSize; | ||
| 477 | |||
| 478 | /* Fill in header here as payloadSize needs to be there. */ | ||
| 479 | HgfsPackHeader(req, opUsed); | ||
| 480 | diff --git a/open-vm-tools/vmhgfs-fuse/file.c b/open-vm-tools/vmhgfs-fuse/file.c | ||
| 481 | index 389ebba8..0b6c48bc 100644 | ||
| 482 | --- a/open-vm-tools/vmhgfs-fuse/file.c | ||
| 483 | +++ b/open-vm-tools/vmhgfs-fuse/file.c | ||
| 484 | @@ -1,5 +1,5 @@ | ||
| 485 | /********************************************************* | ||
| 486 | - * Copyright (C) 2013,2017 VMware, Inc. All rights reserved. | ||
| 487 | + * Copyright (C) 2013,2018-2019 VMware, Inc. All rights reserved. | ||
| 488 | * | ||
| 489 | * This program is free software; you can redistribute it and/or modify it | ||
| 490 | * under the terms of the GNU Lesser General Public License as published | ||
| 491 | @@ -66,10 +66,7 @@ HgfsPackOpenRequest(const char *path, // IN: Path to file | ||
| 492 | HgfsOp opUsed, // IN: Op to use | ||
| 493 | HgfsReq *req) // IN/OUT: Packet to write into | ||
| 494 | { | ||
| 495 | - char *name; | ||
| 496 | - uint32 *nameLength; | ||
| 497 | size_t reqSize; | ||
| 498 | - int result; | ||
| 499 | int openMode, openFlags; | ||
| 500 | |||
| 501 | ASSERT(path); | ||
| 502 | @@ -88,14 +85,22 @@ HgfsPackOpenRequest(const char *path, // IN: Path to file | ||
| 503 | |||
| 504 | switch (opUsed) { | ||
| 505 | case HGFS_OP_OPEN_V3: { | ||
| 506 | + int result; | ||
| 507 | HgfsRequestOpenV3 *requestV3 = HgfsGetRequestPayload(req); | ||
| 508 | |||
| 509 | reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize(); | ||
| 510 | |||
| 511 | - /* We'll use these later. */ | ||
| 512 | - name = requestV3->fileName.name; | ||
| 513 | - nameLength = &requestV3->fileName.length; | ||
| 514 | + /* Convert to CP name. */ | ||
| 515 | + result = CPName_ConvertTo(path, | ||
| 516 | + HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 517 | + requestV3->fileName.name); | ||
| 518 | + if (result < 0) { | ||
| 519 | + LOG(4, ("CP conversion failed.\n")); | ||
| 520 | + return -EINVAL; | ||
| 521 | + } | ||
| 522 | |||
| 523 | + requestV3->fileName.length = result; | ||
| 524 | + reqSize += result; | ||
| 525 | /* Linux clients need case-sensitive lookups. */ | ||
| 526 | requestV3->fileName.flags = 0; | ||
| 527 | requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 528 | @@ -122,15 +127,24 @@ HgfsPackOpenRequest(const char *path, // IN: Path to file | ||
| 529 | } | ||
| 530 | |||
| 531 | case HGFS_OP_OPEN_V2: { | ||
| 532 | + int result; | ||
| 533 | HgfsRequestOpenV2 *requestV2; | ||
| 534 | |||
| 535 | requestV2 = (HgfsRequestOpenV2 *)(HGFS_REQ_PAYLOAD(req)); | ||
| 536 | |||
| 537 | - /* We'll use these later. */ | ||
| 538 | - name = requestV2->fileName.name; | ||
| 539 | - nameLength = &requestV2->fileName.length; | ||
| 540 | reqSize = sizeof *requestV2; | ||
| 541 | |||
| 542 | + /* Convert to CP name. */ | ||
| 543 | + result = CPName_ConvertTo(path, | ||
| 544 | + HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 545 | + requestV2->fileName.name); | ||
| 546 | + if (result < 0) { | ||
| 547 | + LOG(4, ("CP conversion failed.\n")); | ||
| 548 | + return -EINVAL; | ||
| 549 | + } | ||
| 550 | + | ||
| 551 | + requestV2->fileName.length = result; | ||
| 552 | + reqSize += result; | ||
| 553 | requestV2->mask = mask; | ||
| 554 | requestV2->mode = openMode; | ||
| 555 | requestV2->flags = openFlags; | ||
| 556 | @@ -148,14 +162,23 @@ HgfsPackOpenRequest(const char *path, // IN: Path to file | ||
| 557 | break; | ||
| 558 | } | ||
| 559 | case HGFS_OP_OPEN: { | ||
| 560 | + int result; | ||
| 561 | HgfsRequestOpen *request; | ||
| 562 | |||
| 563 | request = (HgfsRequestOpen *)(HGFS_REQ_PAYLOAD(req)); | ||
| 564 | - /* We'll use these later. */ | ||
| 565 | - name = request->fileName.name; | ||
| 566 | - nameLength = &request->fileName.length; | ||
| 567 | reqSize = sizeof *request; | ||
| 568 | |||
| 569 | + /* Convert to CP name. */ | ||
| 570 | + result = CPName_ConvertTo(path, | ||
| 571 | + HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 572 | + request->fileName.name); | ||
| 573 | + if (result < 0) { | ||
| 574 | + LOG(4, ("CP conversion failed.\n")); | ||
| 575 | + return -EINVAL; | ||
| 576 | + } | ||
| 577 | + | ||
| 578 | + request->fileName.length = result; | ||
| 579 | + reqSize += result; | ||
| 580 | request->mode = openMode; | ||
| 581 | request->flags = openFlags; | ||
| 582 | |||
| 583 | @@ -168,18 +191,7 @@ HgfsPackOpenRequest(const char *path, // IN: Path to file | ||
| 584 | return -EPROTO; | ||
| 585 | } | ||
| 586 | |||
| 587 | - | ||
| 588 | - /* Convert to CP name. */ | ||
| 589 | - result = CPName_ConvertTo(path, | ||
| 590 | - HGFS_LARGE_PACKET_MAX - (reqSize - 1), | ||
| 591 | - name); | ||
| 592 | - if (result < 0) { | ||
| 593 | - LOG(4, ("CP conversion failed.\n")); | ||
| 594 | - return -EINVAL; | ||
| 595 | - } | ||
| 596 | - | ||
| 597 | - *nameLength = (uint32) result; | ||
| 598 | - req->payloadSize = reqSize + result; | ||
| 599 | + req->payloadSize = reqSize; | ||
| 600 | |||
| 601 | /* Fill in header here as payloadSize needs to be there. */ | ||
| 602 | HgfsPackHeader(req, opUsed); | ||
| 603 | @@ -915,10 +927,6 @@ int | ||
| 604 | HgfsRename(const char* from, const char* to) | ||
| 605 | { | ||
| 606 | HgfsReq *req = NULL; | ||
| 607 | - char *oldName; | ||
| 608 | - char *newName; | ||
| 609 | - uint32 *oldNameLength; | ||
| 610 | - uint32 *newNameLength; | ||
| 611 | int result = 0; | ||
| 612 | uint32 reqSize; | ||
| 613 | HgfsOp opUsed; | ||
| 614 | @@ -942,33 +950,41 @@ retry: | ||
| 615 | if (opUsed == HGFS_OP_RENAME_V3) { | ||
| 616 | HgfsRequestRenameV3 *requestV3 = HgfsGetRequestPayload(req); | ||
| 617 | |||
| 618 | - oldName = requestV3->oldName.name; | ||
| 619 | - oldNameLength = &requestV3->oldName.length; | ||
| 620 | requestV3->hints = 0; | ||
| 621 | requestV3->oldName.flags = 0; | ||
| 622 | requestV3->oldName.fid = HGFS_INVALID_HANDLE; | ||
| 623 | requestV3->oldName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 624 | requestV3->reserved = 0; | ||
| 625 | reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize(); | ||
| 626 | + /* Convert old name to CP format. */ | ||
| 627 | + result = CPName_ConvertTo(from, | ||
| 628 | + HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize), | ||
| 629 | + requestV3->oldName.name); | ||
| 630 | + if (result < 0) { | ||
| 631 | + LOG(4, ("oldName CP conversion failed\n")); | ||
| 632 | + result = -EINVAL; | ||
| 633 | + goto out; | ||
| 634 | + } | ||
| 635 | + | ||
| 636 | + requestV3->oldName.length = result; | ||
| 637 | + reqSize += result; | ||
| 638 | } else { | ||
| 639 | HgfsRequestRename *request = (HgfsRequestRename *)HGFS_REQ_PAYLOAD(req); | ||
| 640 | |||
| 641 | - oldName = request->oldName.name; | ||
| 642 | - oldNameLength = &request->oldName.length; | ||
| 643 | reqSize = sizeof *request; | ||
| 644 | - } | ||
| 645 | - /* Convert old name to CP format. */ | ||
| 646 | - result = CPName_ConvertTo(from, | ||
| 647 | - HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize), | ||
| 648 | - oldName); | ||
| 649 | - if (result < 0) { | ||
| 650 | - LOG(4, ("oldName CP conversion failed\n")); | ||
| 651 | - result = -EINVAL; | ||
| 652 | - goto out; | ||
| 653 | - } | ||
| 654 | + /* Convert old name to CP format. */ | ||
| 655 | + result = CPName_ConvertTo(from, | ||
| 656 | + HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize), | ||
| 657 | + request->oldName.name); | ||
| 658 | + if (result < 0) { | ||
| 659 | + LOG(4, ("oldName CP conversion failed\n")); | ||
| 660 | + result = -EINVAL; | ||
| 661 | + goto out; | ||
| 662 | + } | ||
| 663 | |||
| 664 | - *oldNameLength = result; | ||
| 665 | - reqSize += result; | ||
| 666 | + request->oldName.length = result; | ||
| 667 | + reqSize += result; | ||
| 668 | + } | ||
| 669 | |||
| 670 | /* | ||
| 671 | * Build full new name to send to server. | ||
| 672 | @@ -983,8 +999,20 @@ retry: | ||
| 673 | |||
| 674 | newNameP = (HgfsFileNameV3 *)((char *)&requestV3->oldName + | ||
| 675 | sizeof requestV3->oldName + result); | ||
| 676 | - newName = newNameP->name; | ||
| 677 | - newNameLength = &newNameP->length; | ||
| 678 | + | ||
| 679 | + LOG(6, ("New name: \"%s\"\n", newNameP->name)); | ||
| 680 | + | ||
| 681 | + /* Convert new name to CP format. */ | ||
| 682 | + result = CPName_ConvertTo(to, | ||
| 683 | + HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result, | ||
| 684 | + newNameP->name); | ||
| 685 | + if (result < 0) { | ||
| 686 | + LOG(4, ("newName CP conversion failed\n")); | ||
| 687 | + result = -EINVAL; | ||
| 688 | + goto out; | ||
| 689 | + } | ||
| 690 | + newNameP->length = result; | ||
| 691 | + reqSize += result; | ||
| 692 | newNameP->flags = 0; | ||
| 693 | newNameP->fid = HGFS_INVALID_HANDLE; | ||
| 694 | newNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 695 | @@ -993,24 +1021,22 @@ retry: | ||
| 696 | HgfsFileName *newNameP; | ||
| 697 | newNameP = (HgfsFileName *)((char *)&request->oldName + | ||
| 698 | sizeof request->oldName + result); | ||
| 699 | - newName = newNameP->name; | ||
| 700 | - newNameLength = &newNameP->length; | ||
| 701 | - } | ||
| 702 | |||
| 703 | - LOG(6, ("New name: \"%s\"\n", newName)); | ||
| 704 | + LOG(6, ("New name: \"%s\"\n", newNameP->name)); | ||
| 705 | |||
| 706 | - /* Convert new name to CP format. */ | ||
| 707 | - result = CPName_ConvertTo(to, | ||
| 708 | - HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result, | ||
| 709 | - newName); | ||
| 710 | - if (result < 0) { | ||
| 711 | - LOG(4, ("newName CP conversion failed\n")); | ||
| 712 | - result = -EINVAL; | ||
| 713 | - goto out; | ||
| 714 | + /* Convert new name to CP format. */ | ||
| 715 | + result = CPName_ConvertTo(to, | ||
| 716 | + HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result, | ||
| 717 | + newNameP->name); | ||
| 718 | + if (result < 0) { | ||
| 719 | + LOG(4, ("newName CP conversion failed\n")); | ||
| 720 | + result = -EINVAL; | ||
| 721 | + goto out; | ||
| 722 | + } | ||
| 723 | + newNameP->length = result; | ||
| 724 | + reqSize += result; | ||
| 725 | } | ||
| 726 | |||
| 727 | - *newNameLength = result; | ||
| 728 | - reqSize += result; | ||
| 729 | req->payloadSize = reqSize; | ||
| 730 | |||
| 731 | /* Fill in header here as payloadSize needs to be there. */ | ||
| 732 | @@ -1068,7 +1094,7 @@ retry: | ||
| 733 | } | ||
| 734 | break; | ||
| 735 | default: | ||
| 736 | - LOG(4, ("failed with result %d\n", result)); | ||
| 737 | + LOG(4, ("Server protocol result %d\n", result)); | ||
| 738 | } | ||
| 739 | break; | ||
| 740 | default: | ||
| 741 | @@ -1109,21 +1135,17 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file | ||
| 742 | { | ||
| 743 | HgfsAttrV2 *attrV2; | ||
| 744 | HgfsAttr *attrV1; | ||
| 745 | - HgfsAttrHint *hints; | ||
| 746 | HgfsAttrChanges *update; | ||
| 747 | - char *fileName = NULL; | ||
| 748 | - uint32 *fileNameLength = NULL; | ||
| 749 | size_t reqBufferSize; | ||
| 750 | size_t reqSize; | ||
| 751 | - int result = 0; | ||
| 752 | ASSERT(req); | ||
| 753 | |||
| 754 | switch (opUsed) { | ||
| 755 | case HGFS_OP_SETATTR_V3: { | ||
| 756 | + int result; | ||
| 757 | HgfsRequestSetattrV3 *requestV3 = HgfsGetRequestPayload(req); | ||
| 758 | |||
| 759 | attrV2 = &requestV3->attr; | ||
| 760 | - hints = &requestV3->hints; | ||
| 761 | |||
| 762 | /* | ||
| 763 | * Clear attributes, mask, and hints before touching them. | ||
| 764 | @@ -1131,7 +1153,7 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file | ||
| 765 | * make sure to zero them all here. | ||
| 766 | */ | ||
| 767 | memset(attrV2, 0, sizeof *attrV2); | ||
| 768 | - memset(hints, 0, sizeof *hints); | ||
| 769 | + requestV3->hints = 0; | ||
| 770 | |||
| 771 | /* | ||
| 772 | * When possible, issue a setattr using an existing handle. This will | ||
| 773 | @@ -1143,14 +1165,21 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file | ||
| 774 | * the times also requires write permissions on Windows, so we require it | ||
| 775 | * here too. Otherwise, any handle will do. | ||
| 776 | */ | ||
| 777 | - fileName = requestV3->fileName.name; | ||
| 778 | - fileNameLength = &requestV3->fileName.length; | ||
| 779 | requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 780 | requestV3->fileName.fid = HGFS_INVALID_HANDLE; | ||
| 781 | requestV3->fileName.flags = 0; | ||
| 782 | requestV3->reserved = 0; | ||
| 783 | reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize(); | ||
| 784 | reqBufferSize = HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize); | ||
| 785 | + result = CPName_ConvertTo(path, | ||
| 786 | + reqBufferSize, | ||
| 787 | + requestV3->fileName.name); | ||
| 788 | + if (result < 0) { | ||
| 789 | + LOG(4, ("CP conversion failed.\n")); | ||
| 790 | + return -EINVAL; | ||
| 791 | + } | ||
| 792 | + requestV3->fileName.length = result; | ||
| 793 | + reqSize += result; | ||
| 794 | |||
| 795 | attrV2->mask = attr->mask; | ||
| 796 | if (attr->mask & (HGFS_ATTR_VALID_SPECIAL_PERMS | | ||
| 797 | @@ -1173,22 +1202,22 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file | ||
| 798 | } | ||
| 799 | if (attr->mask & HGFS_ATTR_VALID_ACCESS_TIME) { | ||
| 800 | attrV2->accessTime = attr->accessTime; | ||
| 801 | - *hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME; | ||
| 802 | + requestV3->hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME; | ||
| 803 | } | ||
| 804 | if (attr->mask & HGFS_ATTR_VALID_WRITE_TIME) { | ||
| 805 | attrV2->writeTime = attr->writeTime; | ||
| 806 | - *hints |= HGFS_ATTR_HINT_SET_WRITE_TIME; | ||
| 807 | + requestV3->hints |= HGFS_ATTR_HINT_SET_WRITE_TIME; | ||
| 808 | } | ||
| 809 | |||
| 810 | break; | ||
| 811 | } | ||
| 812 | case HGFS_OP_SETATTR_V2: { | ||
| 813 | + int result; | ||
| 814 | HgfsRequestSetattrV2 *requestV2; | ||
| 815 | |||
| 816 | requestV2 = (HgfsRequestSetattrV2 *)(HGFS_REQ_PAYLOAD(req)); | ||
| 817 | |||
| 818 | attrV2 = &requestV2->attr; | ||
| 819 | - hints = &requestV2->hints; | ||
| 820 | |||
| 821 | /* | ||
| 822 | * Clear attributes, mask, and hints before touching them. | ||
| 823 | @@ -1196,13 +1225,19 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file | ||
| 824 | * make sure to zero them all here. | ||
| 825 | */ | ||
| 826 | memset(attrV2, 0, sizeof *attrV2); | ||
| 827 | - memset(hints, 0, sizeof *hints); | ||
| 828 | - | ||
| 829 | - fileName = requestV2->fileName.name; | ||
| 830 | - fileNameLength = &requestV2->fileName.length; | ||
| 831 | + requestV2->hints = 0; | ||
| 832 | |||
| 833 | reqSize = sizeof *requestV2; | ||
| 834 | reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV2); | ||
| 835 | + result = CPName_ConvertTo(path, | ||
| 836 | + reqBufferSize, | ||
| 837 | + requestV2->fileName.name); | ||
| 838 | + if (result < 0) { | ||
| 839 | + LOG(4, ("CP conversion failed.\n")); | ||
| 840 | + return -EINVAL; | ||
| 841 | + } | ||
| 842 | + requestV2->fileName.length = result; | ||
| 843 | + reqSize += result; | ||
| 844 | |||
| 845 | if (attr->mask & (HGFS_ATTR_VALID_SPECIAL_PERMS | | ||
| 846 | HGFS_ATTR_VALID_OWNER_PERMS | | ||
| 847 | @@ -1224,16 +1259,17 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file | ||
| 848 | } | ||
| 849 | if (attr->mask & HGFS_ATTR_VALID_ACCESS_TIME) { | ||
| 850 | attrV2->accessTime = attr->accessTime; | ||
| 851 | - *hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME; | ||
| 852 | + requestV2->hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME; | ||
| 853 | } | ||
| 854 | if (attr->mask & HGFS_ATTR_VALID_WRITE_TIME) { | ||
| 855 | attrV2->writeTime = attr->writeTime; | ||
| 856 | - *hints |= HGFS_ATTR_HINT_SET_WRITE_TIME; | ||
| 857 | + requestV2->hints |= HGFS_ATTR_HINT_SET_WRITE_TIME; | ||
| 858 | } | ||
| 859 | |||
| 860 | break; | ||
| 861 | } | ||
| 862 | case HGFS_OP_SETATTR: { | ||
| 863 | + int result; | ||
| 864 | HgfsRequestSetattr *request; | ||
| 865 | |||
| 866 | request = (HgfsRequestSetattr *)(HGFS_REQ_PAYLOAD(req)); | ||
| 867 | @@ -1241,11 +1277,17 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file | ||
| 868 | attrV1 = &request->attr; | ||
| 869 | update = &request->update; | ||
| 870 | |||
| 871 | - /* We'll use these later. */ | ||
| 872 | - fileName = request->fileName.name; | ||
| 873 | - fileNameLength = &request->fileName.length; | ||
| 874 | reqSize = sizeof *request; | ||
| 875 | reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, request); | ||
| 876 | + result = CPName_ConvertTo(path, | ||
| 877 | + reqBufferSize, | ||
| 878 | + request->fileName.name); | ||
| 879 | + if (result < 0) { | ||
| 880 | + LOG(4, ("CP conversion failed.\n")); | ||
| 881 | + return -EINVAL; | ||
| 882 | + } | ||
| 883 | + request->fileName.length = result; | ||
| 884 | + reqSize += result; | ||
| 885 | |||
| 886 | /* | ||
| 887 | * Clear attributes before touching them. | ||
| 888 | @@ -1284,16 +1326,7 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file | ||
| 889 | return -EPROTO; | ||
| 890 | } | ||
| 891 | |||
| 892 | - result = CPName_ConvertTo(path, | ||
| 893 | - reqBufferSize, | ||
| 894 | - fileName); | ||
| 895 | - if (result < 0) { | ||
| 896 | - LOG(4, ("CP conversion failed.\n")); | ||
| 897 | - return -EINVAL; | ||
| 898 | - } | ||
| 899 | - | ||
| 900 | - *fileNameLength = result; | ||
| 901 | - req->payloadSize = reqSize + result; | ||
| 902 | + req->payloadSize = reqSize; | ||
| 903 | |||
| 904 | /* Fill in header here as payloadSize needs to be there. */ | ||
| 905 | HgfsPackHeader(req, opUsed); | ||
| 906 | diff --git a/open-vm-tools/vmhgfs-fuse/filesystem.c b/open-vm-tools/vmhgfs-fuse/filesystem.c | ||
| 907 | index fb9d547d..1931a5d2 100644 | ||
| 908 | --- a/open-vm-tools/vmhgfs-fuse/filesystem.c | ||
| 909 | +++ b/open-vm-tools/vmhgfs-fuse/filesystem.c | ||
| 910 | @@ -1,5 +1,5 @@ | ||
| 911 | /********************************************************* | ||
| 912 | - * Copyright (C) 2013 VMware, Inc. All rights reserved. | ||
| 913 | + * Copyright (C) 2013,2019 VMware, Inc. All rights reserved. | ||
| 914 | * | ||
| 915 | * This program is free software; you can redistribute it and/or modify it | ||
| 916 | * under the terms of the GNU Lesser General Public License as published | ||
| 917 | @@ -123,36 +123,50 @@ HgfsPackQueryVolumeRequest(const char *path, // IN: File pointer for this | ||
| 918 | HgfsOp opUsed, // IN: Op to be used. | ||
| 919 | HgfsReq *req) // IN/OUT: Packet to write into | ||
| 920 | { | ||
| 921 | - char *name; | ||
| 922 | - uint32 *nameLength; | ||
| 923 | size_t requestSize; | ||
| 924 | - int result; | ||
| 925 | + | ||
| 926 | |||
| 927 | ASSERT(req); | ||
| 928 | |||
| 929 | switch (opUsed) { | ||
| 930 | case HGFS_OP_QUERY_VOLUME_INFO_V3: { | ||
| 931 | + int result; | ||
| 932 | HgfsRequestQueryVolumeV3 *requestV3 = HgfsGetRequestPayload(req); | ||
| 933 | |||
| 934 | - /* We'll use these later. */ | ||
| 935 | - name = requestV3->fileName.name; | ||
| 936 | - nameLength = &requestV3->fileName.length; | ||
| 937 | requestV3->fileName.flags = 0; | ||
| 938 | requestV3->fileName.fid = HGFS_INVALID_HANDLE; | ||
| 939 | requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 940 | requestV3->reserved = 0; | ||
| 941 | requestSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize(); | ||
| 942 | + /* Convert to CP name. */ | ||
| 943 | + result = CPName_ConvertTo(path, | ||
| 944 | + HGFS_LARGE_PACKET_MAX - (requestSize - 1), | ||
| 945 | + requestV3->fileName.name); | ||
| 946 | + if (result < 0) { | ||
| 947 | + LOG(4, ("CP conversion failed.\n")); | ||
| 948 | + return -EINVAL; | ||
| 949 | + } | ||
| 950 | + requestV3->fileName.length = result; | ||
| 951 | + requestSize += result; | ||
| 952 | break; | ||
| 953 | } | ||
| 954 | case HGFS_OP_QUERY_VOLUME_INFO: { | ||
| 955 | + int result; | ||
| 956 | HgfsRequestQueryVolume *request; | ||
| 957 | |||
| 958 | request = (HgfsRequestQueryVolume *)(HGFS_REQ_PAYLOAD(req)); | ||
| 959 | |||
| 960 | - /* We'll use these later. */ | ||
| 961 | - name = request->fileName.name; | ||
| 962 | - nameLength = &request->fileName.length; | ||
| 963 | requestSize = sizeof *request; | ||
| 964 | + /* Convert to CP name. */ | ||
| 965 | + result = CPName_ConvertTo(path, | ||
| 966 | + HGFS_LARGE_PACKET_MAX - (requestSize - 1), | ||
| 967 | + request->fileName.name); | ||
| 968 | + if (result < 0) { | ||
| 969 | + LOG(4, ("CP conversion failed.\n")); | ||
| 970 | + return -EINVAL; | ||
| 971 | + } | ||
| 972 | + request->fileName.length = result; | ||
| 973 | + requestSize += result; | ||
| 974 | break; | ||
| 975 | } | ||
| 976 | default: | ||
| 977 | @@ -160,17 +174,7 @@ HgfsPackQueryVolumeRequest(const char *path, // IN: File pointer for this | ||
| 978 | return -EPROTO; | ||
| 979 | } | ||
| 980 | |||
| 981 | - /* Convert to CP name. */ | ||
| 982 | - result = CPName_ConvertTo(path, | ||
| 983 | - HGFS_LARGE_PACKET_MAX - (requestSize - 1), | ||
| 984 | - name); | ||
| 985 | - if (result < 0) { | ||
| 986 | - LOG(4, ("CP conversion failed.\n")); | ||
| 987 | - return -EINVAL; | ||
| 988 | - } | ||
| 989 | - | ||
| 990 | - *nameLength = (uint32) result; | ||
| 991 | - req->payloadSize = requestSize + result; | ||
| 992 | + req->payloadSize = requestSize; | ||
| 993 | |||
| 994 | /* Fill in header here as payloadSize needs to be there. */ | ||
| 995 | HgfsPackHeader(req, opUsed); | ||
| 996 | diff --git a/open-vm-tools/vmhgfs-fuse/fsutil.c b/open-vm-tools/vmhgfs-fuse/fsutil.c | ||
| 997 | index 042c223c..af85c405 100644 | ||
| 998 | --- a/open-vm-tools/vmhgfs-fuse/fsutil.c | ||
| 999 | +++ b/open-vm-tools/vmhgfs-fuse/fsutil.c | ||
| 1000 | @@ -1,5 +1,5 @@ | ||
| 1001 | /********************************************************* | ||
| 1002 | - * Copyright (C) 2013 VMware, Inc. All rights reserved. | ||
| 1003 | + * Copyright (C) 2013,2019 VMware, Inc. All rights reserved. | ||
| 1004 | * | ||
| 1005 | * This program is free software; you can redistribute it and/or modify it | ||
| 1006 | * under the terms of the GNU Lesser General Public License as published | ||
| 1007 | @@ -189,8 +189,6 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer | ||
| 1008 | size_t reqBufferSize; | ||
| 1009 | size_t reqSize; | ||
| 1010 | int result = 0; | ||
| 1011 | - char *fileName = NULL; | ||
| 1012 | - uint32 *fileNameLength = NULL; | ||
| 1013 | ASSERT(attr); | ||
| 1014 | ASSERT(req); | ||
| 1015 | ASSERT(path); | ||
| 1016 | @@ -204,8 +202,6 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer | ||
| 1017 | |||
| 1018 | /* Fill out the request packet. */ | ||
| 1019 | requestV3->hints = 0; | ||
| 1020 | - fileName = requestV3->fileName.name; | ||
| 1021 | - fileNameLength = &requestV3->fileName.length; | ||
| 1022 | requestV3->fileName.flags = 0; | ||
| 1023 | requestV3->fileName.fid = HGFS_INVALID_HANDLE; | ||
| 1024 | requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 1025 | @@ -213,6 +209,19 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer | ||
| 1026 | requestV3->reserved = 0; | ||
| 1027 | reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize(); | ||
| 1028 | reqBufferSize = HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize); | ||
| 1029 | + if (requestV3->fileName.name != NULL) { | ||
| 1030 | + /* Convert to CP name. */ | ||
| 1031 | + result = CPName_ConvertTo(path, | ||
| 1032 | + reqBufferSize, | ||
| 1033 | + requestV3->fileName.name); | ||
| 1034 | + LOG(8, ("Converted path %s\n", requestV3->fileName.name)); | ||
| 1035 | + if (result < 0) { | ||
| 1036 | + LOG(8, ("CP conversion failed.\n")); | ||
| 1037 | + result = -EINVAL; | ||
| 1038 | + goto out; | ||
| 1039 | + } | ||
| 1040 | + requestV3->fileName.length = result; | ||
| 1041 | + } | ||
| 1042 | break; | ||
| 1043 | } | ||
| 1044 | |||
| 1045 | @@ -223,20 +232,42 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer | ||
| 1046 | |||
| 1047 | requestV2 = (HgfsRequestGetattrV2 *)(HGFS_REQ_PAYLOAD(req)); | ||
| 1048 | requestV2->hints = 0; | ||
| 1049 | - fileName = requestV2->fileName.name; | ||
| 1050 | - fileNameLength = &requestV2->fileName.length; | ||
| 1051 | reqSize = sizeof *requestV2; | ||
| 1052 | reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV2); | ||
| 1053 | + if (requestV2->fileName.name != NULL) { | ||
| 1054 | + /* Convert to CP name. */ | ||
| 1055 | + result = CPName_ConvertTo(path, | ||
| 1056 | + reqBufferSize, | ||
| 1057 | + requestV2->fileName.name); | ||
| 1058 | + LOG(8, ("Converted path %s\n", requestV2->fileName.name)); | ||
| 1059 | + if (result < 0) { | ||
| 1060 | + LOG(8, ("CP conversion failed.\n")); | ||
| 1061 | + result = -EINVAL; | ||
| 1062 | + goto out; | ||
| 1063 | + } | ||
| 1064 | + requestV2->fileName.length = result; | ||
| 1065 | + } | ||
| 1066 | break; | ||
| 1067 | } | ||
| 1068 | |||
| 1069 | case HGFS_OP_GETATTR: { | ||
| 1070 | HgfsRequestGetattr *requestV1; | ||
| 1071 | requestV1 = (HgfsRequestGetattr *)(HGFS_REQ_PAYLOAD(req)); | ||
| 1072 | - fileName = requestV1->fileName.name; | ||
| 1073 | - fileNameLength = &requestV1->fileName.length; | ||
| 1074 | reqSize = sizeof *requestV1; | ||
| 1075 | reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV1); | ||
| 1076 | + if (requestV1->fileName.name != NULL) { | ||
| 1077 | + /* Convert to CP name. */ | ||
| 1078 | + result = CPName_ConvertTo(path, | ||
| 1079 | + reqBufferSize, | ||
| 1080 | + requestV1->fileName.name); | ||
| 1081 | + LOG(8, ("Converted path %s\n", requestV1->fileName.name)); | ||
| 1082 | + if (result < 0) { | ||
| 1083 | + LOG(8, ("CP conversion failed.\n")); | ||
| 1084 | + result = -EINVAL; | ||
| 1085 | + goto out; | ||
| 1086 | + } | ||
| 1087 | + requestV1->fileName.length = result; | ||
| 1088 | + } | ||
| 1089 | break; | ||
| 1090 | } | ||
| 1091 | |||
| 1092 | @@ -246,20 +277,6 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer | ||
| 1093 | goto out; | ||
| 1094 | } | ||
| 1095 | |||
| 1096 | - if (fileName != NULL) { | ||
| 1097 | - /* Convert to CP name. */ | ||
| 1098 | - result = CPName_ConvertTo(path, | ||
| 1099 | - reqBufferSize, | ||
| 1100 | - fileName); | ||
| 1101 | - LOG(8, ("Converted path %s\n", fileName)); | ||
| 1102 | - if (result < 0) { | ||
| 1103 | - LOG(8, ("CP conversion failed.\n")); | ||
| 1104 | - result = -EINVAL; | ||
| 1105 | - goto out; | ||
| 1106 | - } | ||
| 1107 | - *fileNameLength = result; | ||
| 1108 | - } | ||
| 1109 | - | ||
| 1110 | req->payloadSize = reqSize + result; | ||
| 1111 | |||
| 1112 | /* Fill in header here as payloadSize needs to be there. */ | ||
| 1113 | diff --git a/open-vm-tools/vmhgfs-fuse/link.c b/open-vm-tools/vmhgfs-fuse/link.c | ||
| 1114 | index a00e8446..777eb76e 100644 | ||
| 1115 | --- a/open-vm-tools/vmhgfs-fuse/link.c | ||
| 1116 | +++ b/open-vm-tools/vmhgfs-fuse/link.c | ||
| 1117 | @@ -1,5 +1,5 @@ | ||
| 1118 | /********************************************************* | ||
| 1119 | - * Copyright (C) 2013 VMware, Inc. All rights reserved. | ||
| 1120 | + * Copyright (C) 2013,2019 VMware, Inc. All rights reserved. | ||
| 1121 | * | ||
| 1122 | * This program is free software; you can redistribute it and/or modify it | ||
| 1123 | * under the terms of the GNU Lesser General Public License as published | ||
| 1124 | @@ -51,36 +51,81 @@ HgfsPackSymlinkCreateRequest(const char* symlink, // IN: path of the link | ||
| 1125 | { | ||
| 1126 | HgfsRequestSymlinkCreateV3 *requestV3 = NULL; | ||
| 1127 | HgfsRequestSymlinkCreate *request = NULL; | ||
| 1128 | - char *symlinkName; | ||
| 1129 | - uint32 *symlinkNameLength; | ||
| 1130 | - char *targetName; | ||
| 1131 | - uint32 *targetNameLength; | ||
| 1132 | size_t targetNameBytes; | ||
| 1133 | - | ||
| 1134 | size_t requestSize; | ||
| 1135 | - int result; | ||
| 1136 | + | ||
| 1137 | + targetNameBytes = strlen(symname) + 1; | ||
| 1138 | |||
| 1139 | switch (opUsed) { | ||
| 1140 | case HGFS_OP_CREATE_SYMLINK_V3: { | ||
| 1141 | + int result; | ||
| 1142 | + HgfsFileNameV3 *fileNameP; | ||
| 1143 | requestV3 = HgfsGetRequestPayload(req); | ||
| 1144 | |||
| 1145 | - /* We'll use these later. */ | ||
| 1146 | - symlinkName = requestV3->symlinkName.name; | ||
| 1147 | - symlinkNameLength = &requestV3->symlinkName.length; | ||
| 1148 | requestV3->symlinkName.flags = 0; | ||
| 1149 | requestV3->symlinkName.fid = HGFS_INVALID_HANDLE; | ||
| 1150 | requestV3->symlinkName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 1151 | requestV3->reserved = 0; | ||
| 1152 | requestSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize(); | ||
| 1153 | + /* Convert symlink name to CP format. */ | ||
| 1154 | + result = CPName_ConvertTo(symlink, | ||
| 1155 | + HGFS_LARGE_PACKET_MAX - (requestSize - 1), | ||
| 1156 | + requestV3->symlinkName.name); | ||
| 1157 | + if (result < 0) { | ||
| 1158 | + LOG(4, ("SymlinkName CP conversion failed.\n")); | ||
| 1159 | + return -EINVAL; | ||
| 1160 | + } | ||
| 1161 | + requestV3->symlinkName.length = result; | ||
| 1162 | + requestSize += result; | ||
| 1163 | + | ||
| 1164 | + /* Copy target name into request packet. */ | ||
| 1165 | + if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) { | ||
| 1166 | + LOG(4, ("Target name is too long.\n")); | ||
| 1167 | + return -EINVAL; | ||
| 1168 | + } | ||
| 1169 | + | ||
| 1170 | + fileNameP = (HgfsFileNameV3 *)((char *)&requestV3->symlinkName + | ||
| 1171 | + sizeof requestV3->symlinkName + result); | ||
| 1172 | + memcpy(fileNameP->name, symname, targetNameBytes); | ||
| 1173 | + LOG(6, ("Target name: \"%s\"\n", fileNameP->name)); | ||
| 1174 | + /* Convert target name to CPName-lite format. */ | ||
| 1175 | + CPNameLite_ConvertTo(fileNameP->name, targetNameBytes - 1, '/'); | ||
| 1176 | + fileNameP->length = targetNameBytes - 1; | ||
| 1177 | + fileNameP->flags = 0; | ||
| 1178 | + fileNameP->fid = HGFS_INVALID_HANDLE; | ||
| 1179 | + fileNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 1180 | break; | ||
| 1181 | } | ||
| 1182 | case HGFS_OP_CREATE_SYMLINK: { | ||
| 1183 | + int result; | ||
| 1184 | + HgfsFileName *fileNameP; | ||
| 1185 | request = (HgfsRequestSymlinkCreate *)(HGFS_REQ_PAYLOAD(req)); | ||
| 1186 | |||
| 1187 | - /* We'll use these later. */ | ||
| 1188 | - symlinkName = request->symlinkName.name; | ||
| 1189 | - symlinkNameLength = &request->symlinkName.length; | ||
| 1190 | requestSize = sizeof *request; | ||
| 1191 | + /* Convert symlink name to CP format. */ | ||
| 1192 | + result = CPName_ConvertTo(symlink, | ||
| 1193 | + HGFS_LARGE_PACKET_MAX - (requestSize - 1), | ||
| 1194 | + request->symlinkName.name); | ||
| 1195 | + if (result < 0) { | ||
| 1196 | + LOG(4, ("SymlinkName CP conversion failed.\n")); | ||
| 1197 | + return -EINVAL; | ||
| 1198 | + } | ||
| 1199 | + request->symlinkName.length = result; | ||
| 1200 | + requestSize += result; | ||
| 1201 | + | ||
| 1202 | + /* Copy target name into request packet. */ | ||
| 1203 | + if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) { | ||
| 1204 | + LOG(4, ("Target name is too long.\n")); | ||
| 1205 | + return -EINVAL; | ||
| 1206 | + } | ||
| 1207 | + | ||
| 1208 | + fileNameP = (HgfsFileName *)((char *)&request->symlinkName + | ||
| 1209 | + sizeof request->symlinkName + result); | ||
| 1210 | + memcpy(fileNameP->name, symname, targetNameBytes); | ||
| 1211 | + LOG(6, ("Target name: \"%s\"\n", fileNameP->name)); | ||
| 1212 | + /* Convert target name to CPName-lite format. */ | ||
| 1213 | + CPNameLite_ConvertTo(fileNameP->name, targetNameBytes - 1, '/'); | ||
| 1214 | + fileNameP->length = targetNameBytes - 1; | ||
| 1215 | break; | ||
| 1216 | } | ||
| 1217 | default: | ||
| 1218 | @@ -88,59 +133,13 @@ HgfsPackSymlinkCreateRequest(const char* symlink, // IN: path of the link | ||
| 1219 | return -EPROTO; | ||
| 1220 | } | ||
| 1221 | |||
| 1222 | - | ||
| 1223 | - /* Convert symlink name to CP format. */ | ||
| 1224 | - result = CPName_ConvertTo(symlink, | ||
| 1225 | - HGFS_LARGE_PACKET_MAX - (requestSize - 1), | ||
| 1226 | - symlinkName); | ||
| 1227 | - if (result < 0) { | ||
| 1228 | - LOG(4, ("SymlinkName CP conversion failed.\n")); | ||
| 1229 | - return -EINVAL; | ||
| 1230 | - } | ||
| 1231 | - | ||
| 1232 | - *symlinkNameLength = result; | ||
| 1233 | - req->payloadSize = requestSize + result; | ||
| 1234 | + req->payloadSize = requestSize; | ||
| 1235 | |||
| 1236 | /* | ||
| 1237 | - * Note the different buffer length. This is because HgfsRequestSymlink | ||
| 1238 | - * contains two filenames, and once we place the first into the packet we | ||
| 1239 | - * must account for it when determining the amount of buffer available for | ||
| 1240 | - * the second. | ||
| 1241 | - * | ||
| 1242 | - * Also note that targetNameBytes accounts for the NUL character. Once | ||
| 1243 | - * we've converted it to CP name, it won't be NUL-terminated and the length | ||
| 1244 | - * of the string in the packet itself won't account for it. | ||
| 1245 | + * targetNameBytes accounts for the NUL character. Once we've converted | ||
| 1246 | + * it to CP name, it won't be NUL-terminated and the length of the string | ||
| 1247 | + * in the packet itself won't account for it. | ||
| 1248 | */ | ||
| 1249 | - if (opUsed == HGFS_OP_CREATE_SYMLINK_V3) { | ||
| 1250 | - HgfsFileNameV3 *fileNameP; | ||
| 1251 | - fileNameP = (HgfsFileNameV3 *)((char *)&requestV3->symlinkName + | ||
| 1252 | - sizeof requestV3->symlinkName + result); | ||
| 1253 | - targetName = fileNameP->name; | ||
| 1254 | - targetNameLength = &fileNameP->length; | ||
| 1255 | - fileNameP->flags = 0; | ||
| 1256 | - fileNameP->fid = HGFS_INVALID_HANDLE; | ||
| 1257 | - fileNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE; | ||
| 1258 | - } else { | ||
| 1259 | - HgfsFileName *fileNameP; | ||
| 1260 | - fileNameP = (HgfsFileName *)((char *)&request->symlinkName + | ||
| 1261 | - sizeof request->symlinkName + result); | ||
| 1262 | - targetName = fileNameP->name; | ||
| 1263 | - targetNameLength = &fileNameP->length; | ||
| 1264 | - } | ||
| 1265 | - targetNameBytes = strlen(symname) + 1; | ||
| 1266 | - | ||
| 1267 | - /* Copy target name into request packet. */ | ||
| 1268 | - if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) { | ||
| 1269 | - LOG(4, ("Target name is too long.\n")); | ||
| 1270 | - return -EINVAL; | ||
| 1271 | - } | ||
| 1272 | - memcpy(targetName, symname, targetNameBytes); | ||
| 1273 | - LOG(6, ("Target name: \"%s\"\n", targetName)); | ||
| 1274 | - | ||
| 1275 | - /* Convert target name to CPName-lite format. */ | ||
| 1276 | - CPNameLite_ConvertTo(targetName, targetNameBytes - 1, '/'); | ||
| 1277 | - | ||
| 1278 | - *targetNameLength = targetNameBytes - 1; | ||
| 1279 | req->payloadSize += targetNameBytes - 1; | ||
| 1280 | |||
| 1281 | /* Fill in header here as payloadSize needs to be there. */ | ||
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.3.5.bb b/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.3.5.bb index cea18c6c4e..63a64fc712 100644 --- a/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.3.5.bb +++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.3.5.bb | |||
| @@ -38,6 +38,7 @@ SRC_URI = "git://github.com/vmware/open-vm-tools.git;protocol=https \ | |||
| 38 | file://0011-Use-uintmax_t-for-handling-rlim_t.patch;patchdir=.. \ | 38 | file://0011-Use-uintmax_t-for-handling-rlim_t.patch;patchdir=.. \ |
| 39 | file://0012-Use-off64_t-instead-of-__off64_t.patch;patchdir=.. \ | 39 | file://0012-Use-off64_t-instead-of-__off64_t.patch;patchdir=.. \ |
| 40 | file://0013-misc-Do-not-print-NULL-string-into-logs.patch;patchdir=.. \ | 40 | file://0013-misc-Do-not-print-NULL-string-into-logs.patch;patchdir=.. \ |
| 41 | file://0014-Fix-new-warnings-from-gcc9.patch;patchdir=.. \ | ||
| 41 | " | 42 | " |
| 42 | # stable-10.3.5 | 43 | # stable-10.3.5 |
| 43 | SRCREV = "f2ff192717375b95a6b7e278fb47dbb3d3bc56d1" | 44 | SRCREV = "f2ff192717375b95a6b7e278fb47dbb3d3bc56d1" |
