From: Oliver Kurth Date: Fri, 26 Oct 2018 17:44:57 +0000 (-0700) Subject: Hgfs Server Linux: fix the share permissions on a file rename or delete X-Git-Tag: stable-11.0.0~373 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac5341917916d37120b35dbe3d1a9ef1dfe61f92;p=thirdparty%2Fopen-vm-tools.git Hgfs Server Linux: fix the share permissions on a file rename or delete 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. --- diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c index ea8d15888..b335bbbc3 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c @@ -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 diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c index c4f7c89e6..f2b7ce67e 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c @@ -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 {