]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commit
InitiateFileTransferToGuest fails when uploading file to root directory
authorOliver Kurth <okurth@vmware.com>
Wed, 10 Apr 2019 21:14:52 +0000 (14:14 -0700)
committerOliver Kurth <okurth@vmware.com>
Wed, 10 Apr 2019 21:14:52 +0000 (14:14 -0700)
commit13f457aa737d8bca27f09862cf2a45df8f4a425b
tree3517d6ac21ae3a3574ea4579bc1dbafd3c5fe38d
parent022121ce185662c05b3e1bf7166500f4f0f72bb2
InitiateFileTransferToGuest fails when uploading file to root directory

File upload to '/' on Linux fails the directory exists check.
This is caused by the file dirname being an empty string when parsed from
the guest file path name per the documented behavior of File_GetPathName.

The caller of File_GetPathName needs to handle the expected empty dirname
string when dealing with file path in the root ('/') filesystem on Linux.

Proposed fix is to replace the dirname string with the root path ('/') when:
A. dirname obtained from File_GetPathName call is an empty string AND
B. the original file path name starts with the path separator ('/') on
   Linux (or *nix like) GOSes

This allows for the directory checks to inspect the root folder before
proceeding with the file transfer.
open-vm-tools/services/plugins/vix/vixTools.c