]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Hgfs Server Plugin: only handle the shared folders client in hosted products
authorOliver Kurth <okurth@vmware.com>
Tue, 19 Jun 2018 18:07:43 +0000 (11:07 -0700)
committerOliver Kurth <okurth@vmware.com>
Tue, 19 Jun 2018 18:07:43 +0000 (11:07 -0700)
Only initialize the Shared Folders client redirector in hosted product
environments.

Details: Check if the tools system service started in a non-hosted product
and if so do not start the shared folders client redirector.
Check if the tools user service started in a non-hosted product product and if
so then skip reconnecting any Shared Folders mapped drives.

open-vm-tools/services/plugins/hgfsServer/hgfsPlugin.c

index dc041665d42aa33558723cc78b9dcb50e943a573..c5ef8726b96052db3ff7f5e5e2c545ea84e90dd4 100644 (file)
@@ -35,6 +35,8 @@
 #include "hgfsServerManager.h"
 #include "vm_basic_defs.h"
 #include "vm_assert.h"
+#include "vm_vmx_type.h"
+#include "vmcheck.h"
 #include "vmware/guestrpc/tclodefs.h"
 #include "vmware/tools/log.h"
 #include "vmware/tools/plugin.h"
@@ -1079,24 +1081,35 @@ ToolsOnLoad(ToolsAppCtx *ctx)
       NULL
    };
    HgfsServerMgrData *mgrData;
+   uint32 vmxVersion = 0;
+   uint32 vmxType = VMX_TYPE_UNSET;
 
    if (!TOOLS_IS_MAIN_SERVICE(ctx) && !TOOLS_IS_USER_SERVICE(ctx)) {
       g_info("Unknown container '%s', not loading HGFS plugin.", ctx->name);
       return NULL;
    }
 
-   if (TOOLS_IS_MAIN_SERVICE(ctx)) {
-      /* Start the Shared Folders redirector client. */
-      HgfsServerClientRdrStart();
-   } else if (TOOLS_IS_USER_SERVICE(ctx)) {
-      /*
-       * If Explorer recreated the mapped drives prior to the client being up and
-       * running by the main service, we will need to reconnect the Shared Folders
-       * drives.
-       */
-      HgfsServerClientRdrConnectDrives();
+   /*
+    * Check for VM is running in a hosted environment and if so initialize
+    * the Shared Folders HGFS client redirector.
+    */
+   if (VmCheck_GetVersion(&vmxVersion, &vmxType) &&
+       vmxType != VMX_TYPE_SCALABLE_SERVER) {
+      if (TOOLS_IS_MAIN_SERVICE(ctx)) {
+         /* Start the Shared Folders redirector client. */
+         HgfsServerClientRdrStart();
+      } else if (TOOLS_IS_USER_SERVICE(ctx)) {
+         /*
+          * If Explorer recreated the mapped drives prior to the client being up and
+          * running by the main service, we will need to reconnect the Shared Folders
+          * drives.
+          */
+         HgfsServerClientRdrConnectDrives();
+      } else {
+         NOT_REACHED();
+      }
    } else {
-      NOT_REACHED();
+      g_debug("VM is not running in a hosted product skip HGFS client redirector initialization.");
    }
 
    mgrData = g_malloc0(sizeof *mgrData);