]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common source files not applicable to open-vm-tools.
authorKruti Pendharkar <kp025370@broadcom.com>
Mon, 1 Dec 2025 06:48:33 +0000 (22:48 -0800)
committerKruti Pendharkar <kp025370@broadcom.com>
Mon, 1 Dec 2025 06:48:33 +0000 (22:48 -0800)
open-vm-tools/lib/include/vmware/tools/log.h
open-vm-tools/lib/include/vmware/tools/utils.h
open-vm-tools/libvmtools/vmtoolsLog.c
open-vm-tools/services/plugins/componentMgr/componentMgrInstallManager.c
open-vm-tools/services/vmtoolsd/l10n/en.vmsg
open-vm-tools/services/vmtoolsd/l10n/es.vmsg
open-vm-tools/services/vmtoolsd/l10n/fr.vmsg
open-vm-tools/services/vmtoolsd/l10n/ja.vmsg

index ab8cc0e2b25430b20a0b04f0bd18bed5e8c5c5df..5e566945510e8c8220b4ac36532692cbb14bebfb 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (c) 2011-2021 VMware, Inc. All rights reserved.
+ * Copyright (c) 2011-2025 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * 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
@@ -362,6 +363,10 @@ VMTools_VmxLogThrottled(uint32 *count,
                         const gchar *fmt,
                         ...);
 
+void
+VMTools_LogThrottled(uint32 *count,
+                     const gchar *fmt,
+                     ...);
 G_END_DECLS
 
 #define host_warning(fmt, ...)                                          \
index 0417b431b3dd70c3eb690f94cbf3882c8171a957..d31a03eba39b7b1f8f71fd1700c8eef2099ecc48 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (C) 2008-2020 VMware, Inc. All rights reserved.
+ * Copyright (c) 2008-2025 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * 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
@@ -144,12 +145,25 @@ VMTools_ConfigGetString(GKeyFile *config,
 
 #if defined(G_PLATFORM_WIN32)
 
+#define VMTOOLS_CERT_MSG "Verify that a valid \"Broadcom Inc\" certificate "\
+                         "is present in the Trusted Publishers certificate "\
+                         "store. Refer to the VMware Tools Administration "\
+                         "Guide for details."
+
 gboolean
 VMTools_AttachConsole(void);
 
 GSource *
 VMTools_NewHandleSource(HANDLE h);
 
+gboolean
+VMTools_IsGPOExecPolicyAllSigned(void);
+
+gboolean
+VMTools_IsCertPresent(void);
+
+void
+VMTools_LogWinEvent(const gchar *certMsg);
 #else
 
 /** Type of callback used by the signal event source. */
index 679467572d0f0eda1faaa785ac1921be19f14b22..ed1d8526c58aa59f19782c4ab302fce7a2ef9256 100644 (file)
@@ -2943,3 +2943,47 @@ VMTools_VmxLogThrottled(uint32 *count,
       va_end(args);
    }
 }
+
+
+/*
+ ******************************************************************************
+ * VMTools_LogThrottled --
+ *
+ * Logs a message at 'message' log level after checking for throttling
+ * condition.
+ *
+ * @param[in/out]  count     Throttle count.
+ * @param[in]      fmt       Log message output format.
+ *
+ * XXX: In future, this function can be enhanced to log messages at different
+ *      log levels.
+ *
+ * @return None
+ *
+ ******************************************************************************
+ */
+
+void
+VMTools_LogThrottled(uint32 *count,
+                     const gchar *fmt,
+                     ...)
+{
+   if (Util_Throttle(++*count)) {
+      va_list args;
+      gchar *msg;
+      gint length;
+
+      va_start(args, fmt);
+      length = g_vasprintf(&msg, fmt, args);
+      va_end(args);
+
+      if (length < 0) {
+         g_warning("%s g_vasprintf failed\n.", __FUNCTION__);
+         return;
+      }
+
+      g_message("%s\n", msg);
+
+      g_free(msg);
+   }
+}
index 960baa8616a6c5d314a85be6e5d9ba321e052aa7..1f185c91f5e3b09b9638aa8fbcefa65d12a09283 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (c) 2021,2023 VMware, Inc. All rights reserved.
+ * Copyright (c) 2021-2025 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * 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
  */
 
 #include "componentMgrPlugin.h"
-
+#if defined(_WIN32)
+#include "codeset.h"
+#define VMW_TEXT_DOMAIN "vmtoolsd" // Has to be before i18h.h
+#include "vmware/tools/i18n.h"
+#include "vmware/tools/log.h"
+#endif
 
 /*
  *****************************************************************************
@@ -71,6 +77,38 @@ ComponentMgr_FreeAsyncProc(AsyncProcessInfo *procInfo) // IN
    ComponentMgr_ResetComponentAsyncProcInfo(componentIndex);
 }
 
+#if defined (_WIN32)
+/*
+ *****************************************************************************
+ * ComponentMgrLogWinEvent --
+ *
+ * This function logs the windows event related to certificate.
+ * The event is logged only once for the lifetime of vmtoolsd.
+ *
+ * @return
+ *      None.
+ *
+ * Side effects:
+ *      None.
+ *
+ *****************************************************************************
+ */
+
+static void
+ComponentMgrLogWinEvent()
+{
+   static gboolean cmEventLogged = FALSE;
+
+   if (cmEventLogged) {
+      return;
+   }
+
+   cmEventLogged = TRUE;
+
+   VMTools_LogWinEvent(SU_(vmtools.cert, VMTOOLS_CERT_MSG));
+}
+#endif
+
 
 /*
  *****************************************************************************
@@ -126,9 +164,29 @@ ComponentMgrCheckStatusMonitor(void *data) // IN
          exitCode = SCRIPTFAILED;
       }
 #else
-      if (ProcMgr_GetExitCode(procInfo->asyncProc, &exitCode)) {
+      int ret;
+
+      ret = ProcMgr_GetExitCode(procInfo->asyncProc, &exitCode);
+      if (ret != 0) {
          exitCode = SCRIPTFAILED;
       }
+
+      if ((ret != 0 ||
+           exitCode == 1) &&
+          VMTools_IsGPOExecPolicyAllSigned() &&
+          !VMTools_IsCertPresent()) {
+         static uint32 logCount = 0;
+         /*
+          * Exit code 1 is a special case. We assume this is because the
+          * componentMgr process/script failed to launch. Check if there
+          * is a certificate issue and log appropriately.
+          *
+          * If the componentMgr process/script ran and it didn't result in
+          * a desired state, those exit codes will be different.
+          */
+         VMTools_LogThrottled(&logCount, "%s", VMTOOLS_CERT_MSG);
+         ComponentMgrLogWinEvent();
+      }
 #endif
      g_debug("%s: Checking status of a component has terminated gracefully"
              " with exit code %d.\n", __FUNCTION__, exitCode);
@@ -240,7 +298,29 @@ ComponentMgrProcessMonitor(void *data) // IN
        * Free all the async process resources and destroy the GSource timer.
        */
       g_debug("%s: Async process has exited.\n", __FUNCTION__);
+#if defined(_WIN32)
+      int exitCode;
+      int ret;
+
+      ret = ProcMgr_GetExitCode(procInfo->asyncProc, &exitCode);
 
+      if ((ret != 0 ||
+           exitCode == 1) &&
+          VMTools_IsGPOExecPolicyAllSigned() &&
+          !VMTools_IsCertPresent()) {
+         static uint32 logCount = 0;
+         /*
+          * Exit code 1 is a special case. We assume this is because the
+          * componentMgr process/script failed to launch. Check if there
+          * is a certificate issue and log appropriately.
+          *
+          * If the componentMgr process/script ran and it didn't result in
+          * a desired state, those exit codes will be different.
+          */
+         VMTools_LogThrottled(&logCount, "%s", VMTOOLS_CERT_MSG);
+         ComponentMgrLogWinEvent();
+      }
+#endif
       ComponentMgr_FreeAsyncProc(procInfo);
       ComponentMgr_ResetComponentGSourceTimer(componentIndex);
 
index 458b825d2f5812e2fb1a372f64ecb67114daeb41..df38595923e485f36ec29a6a5906f3c72f5c996a 100644 (file)
@@ -1,5 +1,6 @@
 ##########################################################
-# Copyright (C) 2010, 2020-2021 VMware, Inc. All rights reserved.
+# Copyright (c) 2010-2025 Broadcom. All Rights Reserved.
+# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
 #
 # 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
@@ -75,3 +76,4 @@ cmdline.uninstall = "Uninstalls the service from the Service Control Manager."
 
 cmdline.version = "Prints the daemon version and exits."
 
+vmtools.cert  = "Verify that a valid \"Broadcom Inc\" certificate is present in the Trusted Publishers certificate store. Refer to the VMware Tools Administration Guide for details."
index a68eb854cf96b2dc765142d00929e7f878952acd..34ea58d80d786754f78724332b011c2ec281ab6e 100644 (file)
@@ -1,5 +1,5 @@
 ##########################################################
-# Copyright (c) 2010-2024 Broadcom. All Rights Reserved.
+# Copyright (c) 2010-2025 Broadcom. All Rights Reserved.
 # The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
 #
 # This program is free software; you can redistribute it and/or modify it
@@ -76,3 +76,4 @@ cmdline.uninstall = "Desinstala el servicio desde el Administrador de control de
 
 cmdline.version = "Imprime la versión daemon y sale."
 
+vmtools.cert  = "Verify that a valid \"Broadcom Inc\" certificate is present in the Trusted Publishers certificate store. Refer to the VMware Tools Administration Guide for details."
index eb1dd6c7f5324a0cd458f7e6d2ef70361ae3fa20..cba3166ef1ef4f16c316c85f87fdd1c1730eca97 100644 (file)
@@ -1,5 +1,5 @@
 ##########################################################
-# Copyright (c) 2010-2024 Broadcom. All Rights Reserved.
+# Copyright (c) 2010-2025 Broadcom. All Rights Reserved.
 # The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
 #
 # This program is free software; you can redistribute it and/or modify it
@@ -73,6 +73,7 @@ cmdline.uinputfd = "Descripteur de fichier pour le périphérique uinput."
 cmdline.uinputfd.fd = "fd"
 
 cmdline.uninstall = "Désinstalle le service du Gestionnaire de contrôle du service."
-
+s
 cmdline.version = "Imprime la version démon et quitte l'application."
 
+vmtools.cert  = "Verify that a valid \"Broadcom Inc\" certificate is present in the Trusted Publishers certificate store. Refer to the VMware Tools Administration Guide for details."
index dff50ef5f9dbe1126587dd44d0773d42a055f962..295a08110596004f0ef62ef0d7a4948526e16a1f 100644 (file)
@@ -1,5 +1,5 @@
 ##########################################################
-# Copyright (c) 2010-2024 Broadcom. All Rights Reserved.
+# Copyright (c) 2010-2025 Broadcom. All Rights Reserved.
 # The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
 #
 # This program is free software; you can redistribute it and/or modify it
@@ -76,3 +76,4 @@ cmdline.uninstall = "Service Control Manager からサービスをアンイン
 
 cmdline.version = "デーモンのバージョンを出力し、終了します。"
 
+vmtools.cert  = "Verify that a valid \"Broadcom Inc\" certificate is present in the Trusted Publishers certificate store. Refer to the VMware Tools Administration Guide for details."