]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Hgfs Server Linux: fix the share permissions on a file rename or delete
authorOliver Kurth <okurth@vmware.com>
Mon, 17 Sep 2018 23:41:19 +0000 (16:41 -0700)
committerOliver Kurth <okurth@vmware.com>
Mon, 17 Sep 2018 23:41:19 +0000 (16:41 -0700)
Coverity found that the argumeents to obtain the share permissions
on a file rename were swapped. Even though they are tested together
in an if statement which is not an issue, it could be in the future.

Reverse arguments so the share read and write permissions are correct.

open-vm-tools/lib/hgfsServer/hgfsServer.c
open-vm-tools/lib/hgfsServer/hgfsServerLinux.c

index bcde636694bd84cf7dfb95cbb1dc885f94b4a135..7ea3b7f48f5e5666f4a65615ddab34527abe7158 100644 (file)
@@ -7246,8 +7246,8 @@ HgfsValidateRenameFile(Bool useHandle,            // IN:
       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
index c4f7c89e6043c4f09bec4d6446d5e767095a6054..f2b7ce67e1113a96e2e0ed90091a52e224ec1653 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 1998-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2018 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
@@ -4583,8 +4583,8 @@ HgfsPlatformDeleteFileByHandle(HgfsHandle file,          // IN: File being delet
    char *localName;
    size_t localNameSize;
 
-   if (HgfsHandle2FileNameMode(file, session, &writePermissions,
-                               &readPermissions, &localName, &localNameSize)) {
+   if (HgfsHandle2FileNameMode(file, session, &readPermissions, &writePermissions,
+                               &localName, &localNameSize)) {
       if (writePermissions && readPermissions) {
          status = HgfsPlatformDeleteFileByName(localName);
       } else {
@@ -4665,8 +4665,8 @@ HgfsPlatformDeleteDirByHandle(HgfsHandle file,          // IN: File being delete
    char *localName;
    size_t localNameSize;
 
-   if (HgfsHandle2FileNameMode(file, session, &writePermissions,
-                               &readPermissions, &localName, &localNameSize)) {
+   if (HgfsHandle2FileNameMode(file, session, &readPermissions, &writePermissions,
+                               &localName, &localNameSize)) {
       if (writePermissions && readPermissions) {
          status = HgfsPlatformDeleteDirByName(localName);
       } else {