From: Kruti Pendharkar Date: Mon, 1 Dec 2025 06:48:33 +0000 (-0800) Subject: Change to common source files not applicable to open-vm-tools. X-Git-Tag: stable-13.1.0~44 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=8747ca4feb22be1848c0009e92fa235b4774c64b;p=thirdparty%2Fopen-vm-tools.git Change to common source files not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/include/vmware/tools/log.h b/open-vm-tools/lib/include/vmware/tools/log.h index ab8cc0e2b..5e5669455 100644 --- a/open-vm-tools/lib/include/vmware/tools/log.h +++ b/open-vm-tools/lib/include/vmware/tools/log.h @@ -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, ...) \ diff --git a/open-vm-tools/lib/include/vmware/tools/utils.h b/open-vm-tools/lib/include/vmware/tools/utils.h index 0417b431b..d31a03eba 100644 --- a/open-vm-tools/lib/include/vmware/tools/utils.h +++ b/open-vm-tools/lib/include/vmware/tools/utils.h @@ -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. */ diff --git a/open-vm-tools/libvmtools/vmtoolsLog.c b/open-vm-tools/libvmtools/vmtoolsLog.c index 679467572..ed1d8526c 100644 --- a/open-vm-tools/libvmtools/vmtoolsLog.c +++ b/open-vm-tools/libvmtools/vmtoolsLog.c @@ -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); + } +} diff --git a/open-vm-tools/services/plugins/componentMgr/componentMgrInstallManager.c b/open-vm-tools/services/plugins/componentMgr/componentMgrInstallManager.c index 960baa861..1f185c91f 100644 --- a/open-vm-tools/services/plugins/componentMgr/componentMgrInstallManager.c +++ b/open-vm-tools/services/plugins/componentMgr/componentMgrInstallManager.c @@ -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 @@ -31,7 +32,12 @@ */ #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); diff --git a/open-vm-tools/services/vmtoolsd/l10n/en.vmsg b/open-vm-tools/services/vmtoolsd/l10n/en.vmsg index 458b825d2..df3859592 100644 --- a/open-vm-tools/services/vmtoolsd/l10n/en.vmsg +++ b/open-vm-tools/services/vmtoolsd/l10n/en.vmsg @@ -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." diff --git a/open-vm-tools/services/vmtoolsd/l10n/es.vmsg b/open-vm-tools/services/vmtoolsd/l10n/es.vmsg index a68eb854c..34ea58d80 100644 --- a/open-vm-tools/services/vmtoolsd/l10n/es.vmsg +++ b/open-vm-tools/services/vmtoolsd/l10n/es.vmsg @@ -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." diff --git a/open-vm-tools/services/vmtoolsd/l10n/fr.vmsg b/open-vm-tools/services/vmtoolsd/l10n/fr.vmsg index eb1dd6c7f..cba3166ef 100644 --- a/open-vm-tools/services/vmtoolsd/l10n/fr.vmsg +++ b/open-vm-tools/services/vmtoolsd/l10n/fr.vmsg @@ -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." diff --git a/open-vm-tools/services/vmtoolsd/l10n/ja.vmsg b/open-vm-tools/services/vmtoolsd/l10n/ja.vmsg index dff50ef5f..295a08110 100644 --- a/open-vm-tools/services/vmtoolsd/l10n/ja.vmsg +++ b/open-vm-tools/services/vmtoolsd/l10n/ja.vmsg @@ -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."