]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
HGFS: Fix Windows server virtual folders
authorVMware, Inc <>
Wed, 26 Dec 2012 21:20:31 +0000 (13:20 -0800)
committerDmitry Torokhov <dtor@vmware.com>
Thu, 27 Dec 2012 19:15:59 +0000 (11:15 -0800)
For the UNC or DRIVE virtual folders enabled by setting the share's host
path to an empty string, currently are not quite handled correctly.
The shares with empty host names are listed in their Shared Folders virtual
folder but have incorrect attriubtes. This is because the shares host paths
are passed to the real get attributes function which fails when the path
is an empty string. These entries should be defaulted to the HGFS virtual
folder attributes.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/hgfsServer/hgfsServer.c

index 40e1aa9342005f2e496dda45e1ad9c6bf7f23421..9f1da8112b84d9f9831fa76338a4a9e2c80b964e 100644 (file)
@@ -7904,13 +7904,24 @@ HgfsGetDirEntry(HgfsHandle hgfsSearchHandle,     // IN: ID for search data
                    * problems on the host, the server still enumerates it and
                    * returns to the client.
                    */
+#if defined(_WIN32)
                   /*
-                   * XXX: We will open a new handle for this, but it should be safe
-                   * from oplock-induced deadlock because these are all directories,
-                   * and thus cannot have oplocks placed on them.
+                   * For Windows hosts an empty share path has special meaning and we
+                   * treat it the same as another virtual folder. E.g. Drive or UNC.
                    */
-                  status = HgfsPlatformGetattrFromName(sharePath, configOptions,
-                                                       dent->d_name, attr, NULL);
+                  if (0 == sharePathLen) {
+                     HgfsPlatformGetDefaultDirAttrs(attr);
+                  } else
+#endif
+                  {
+                     /*
+                      * XXX: We will open a new handle for this, but it should be safe
+                      * from oplock-induced deadlock because these are all directories,
+                      * and thus cannot have oplocks placed on them.
+                      */
+                     status = HgfsPlatformGetattrFromName(sharePath, configOptions,
+                                                          dent->d_name, attr, NULL);
+                  }
 
                   /*
                    * For some reason, Windows marks drives as hidden and system. So