From: Oliver Kurth Date: Wed, 4 Mar 2020 20:07:12 +0000 (-0800) Subject: Replace VixTools_ConfigGetBoolean with VMTools_ConfigGetBoolean X-Git-Tag: stable-11.1.0~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=281bef810a9aa6e666635de716a56fd9898c835a;p=thirdparty%2Fopen-vm-tools.git Replace VixTools_ConfigGetBoolean with VMTools_ConfigGetBoolean Initially came up with a utility function named VixTools_ConfigGetBoolean to retrieve the boolean value from the config dictionary. This function was designed as local/specific to VIX plugin. Later, VMTools_ConfigGetBoolean function was designed with the same functionality and is being used everywhere in the Tools repository. This changeset gets rid of VixTools_ConfigGetBoolean and replaces all those occurrences with VMTools_ConfigGetBoolean. --- diff --git a/open-vm-tools/services/plugins/vix/foundryToolsDaemon.c b/open-vm-tools/services/plugins/vix/foundryToolsDaemon.c index dd969a626..52ca0ca48 100644 --- a/open-vm-tools/services/plugins/vix/foundryToolsDaemon.c +++ b/open-vm-tools/services/plugins/vix/foundryToolsDaemon.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2003-2019 VMware, Inc. All rights reserved. + * Copyright (C) 2003-2020 VMware, Inc. All rights reserved. * * 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 @@ -577,10 +577,10 @@ ToolsDaemonTcloSyncDriverFreeze(RpcInData *data) goto abort; } - enableNullDriver = VixTools_ConfigGetBoolean(confDictRef, - "vmbackup", - "enableNullDriver", - FALSE); + enableNullDriver = VMTools_ConfigGetBoolean(confDictRef, + "vmbackup", + "enableNullDriver", + FALSE); /* Perform the actual freeze. */ if (!SyncDriver_Freeze(driveList, enableNullDriver, &gSyncDriverHandle, diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c index ffe77abe2..05add2545 100644 --- a/open-vm-tools/services/plugins/vix/vixTools.c +++ b/open-vm-tools/services/plugins/vix/vixTools.c @@ -5600,12 +5600,12 @@ VixToolsListProcessesExGenerateData(uint32 numPids, // IN * being clobbered. */ #ifdef _WIN32 - useRemoteThreadProcCmdLine = VixTools_ConfigGetBoolean(confDictRef, + useRemoteThreadProcCmdLine = VMTools_ConfigGetBoolean(confDictRef, VIX_TOOLS_CONFIG_API_GROUPNAME, VIXTOOLS_CONFIG_USE_REMOTE_THREAD_PROCESS_COMMAND_LINE, USE_REMOTE_THREAD_PROCESS_COMMAND_LINE_DEFAULT); - useWMIProcCmdLine = VixTools_ConfigGetBoolean(confDictRef, + useWMIProcCmdLine = VMTools_ConfigGetBoolean(confDictRef, VIX_TOOLS_CONFIG_API_GROUPNAME, VIXTOOLS_CONFIG_USE_WMI_PROCESS_COMMAND_LINE, USE_WMI_PROCESS_COMMAND_LINE_DEFAULT); @@ -10847,10 +10847,10 @@ VixToolsCheckIfAuthenticationTypeEnabled(GKeyFile *confDictRef, // IN * have the one typeName (VIX_TOOLS_CONFIG_AUTHTYPE_AGENTS), and default * it to VIX_TOOLS_CONFIG_INFRA_AGENT_DISABLED_DEFAULT. */ - disabled = VixTools_ConfigGetBoolean(confDictRef, - VIX_TOOLS_CONFIG_API_GROUPNAME, - authnDisabledName, - VIX_TOOLS_CONFIG_INFRA_AGENT_DISABLED_DEFAULT); + disabled = VMTools_ConfigGetBoolean(confDictRef, + VIX_TOOLS_CONFIG_API_GROUPNAME, + authnDisabledName, + VIX_TOOLS_CONFIG_INFRA_AGENT_DISABLED_DEFAULT); return !disabled; } @@ -11913,8 +11913,8 @@ GuestAuthSAMLAuthenticateAndImpersonate( /* * If the config is off, bypass the special-case. */ - if (!VixTools_ConfigGetBoolean(gConfDictRef, - VIX_TOOLS_CONFIG_API_GROUPNAME, + if (!VMTools_ConfigGetBoolean(gConfDictRef, + VIX_TOOLS_CONFIG_API_GROUPNAME, VIXTOOLS_CONFIG_ALLOW_LOCAL_SYSTEM_IMPERSONATION_BYPASS, ALLOW_LOCAL_SYSTEM_IMPERSONATION_BYPASS_DEFAULT)) { g_debug("%s: SAML authn failed, %s not set, skipping local SYSTEM check", @@ -12039,54 +12039,6 @@ GuestAuthUnimpersonate(void) } -/** - *----------------------------------------------------------------------------- - * VixTools_ConfigGetBoolean - * - * Get boolean entry for the key from the config file. - * - * Return value: - * Value for the key if key is found; otherwise defValue. - * - * Side effects: - * None - * - *----------------------------------------------------------------------------- - */ - -gboolean -VixTools_ConfigGetBoolean(GKeyFile *confDictRef, // IN - const char *group, // IN - const char *key, // IN - gboolean defValue) // IN -{ - GError *gErr = NULL; - gboolean value = defValue; - - ASSERT(confDictRef != NULL && group != NULL && key != NULL); - - if (confDictRef == NULL || group == NULL || key == NULL) { - goto done; - } - - value = g_key_file_get_boolean(confDictRef, group, key, &gErr); - - /* - * g_key_file_get_boolean() will return FALSE and set an error - * if the value isn't in config, so use the default in that - * case. - */ - if (!value && gErr != NULL) { - g_clear_error(&gErr); - value = defValue; - } - -done: - - return value; -} - - #if SUPPORT_VGAUTH /* *----------------------------------------------------------------------------- @@ -12110,10 +12062,10 @@ QueryVGAuthConfig(GKeyFile *confDictRef) // IN gboolean retVal = USE_VGAUTH_DEFAULT; if (confDictRef != NULL) { - retVal = VixTools_ConfigGetBoolean(confDictRef, - VIX_TOOLS_CONFIG_API_GROUPNAME, - VIXTOOLS_CONFIG_USE_VGAUTH_NAME, - USE_VGAUTH_DEFAULT); + retVal = VMTools_ConfigGetBoolean(confDictRef, + VIX_TOOLS_CONFIG_API_GROUPNAME, + VIXTOOLS_CONFIG_USE_VGAUTH_NAME, + USE_VGAUTH_DEFAULT); } g_message("%s: vgauth usage is: %d\n", __FUNCTION__, retVal); diff --git a/open-vm-tools/services/plugins/vix/vixToolsInt.h b/open-vm-tools/services/plugins/vix/vixToolsInt.h index 4aab92b2a..03a6847f2 100644 --- a/open-vm-tools/services/plugins/vix/vixToolsInt.h +++ b/open-vm-tools/services/plugins/vix/vixToolsInt.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2010-2019 VMware, Inc. All rights reserved. + * Copyright (C) 2010-2020 VMware, Inc. All rights reserved. * * 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 @@ -83,11 +83,6 @@ void VixTools_SetConsoleUserPolicy(Bool allowConsoleUserOpsParam); void VixTools_SetRunProgramCallback(VixToolsReportProgramDoneProcType reportProgramDoneProc, void *clientData); -gboolean VixTools_ConfigGetBoolean(GKeyFile *confDictRef, - const char *group, - const char *key, - gboolean defValue); - void VixTools_RestrictCommands(gboolean restricted); /*