]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Replace VixTools_ConfigGetBoolean with VMTools_ConfigGetBoolean
authorOliver Kurth <okurth@vmware.com>
Wed, 4 Mar 2020 20:07:12 +0000 (12:07 -0800)
committerOliver Kurth <okurth@vmware.com>
Wed, 4 Mar 2020 20:07:12 +0000 (12:07 -0800)
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.

open-vm-tools/services/plugins/vix/foundryToolsDaemon.c
open-vm-tools/services/plugins/vix/vixTools.c
open-vm-tools/services/plugins/vix/vixToolsInt.h

index dd969a626aadc68c0a2fb8c529d77afaf9d5f9c6..52ca0ca48dca2705986ba2dc23909f901416f835 100644 (file)
@@ -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,
index ffe77abe2b8ba7fff6064093819e7aa30691a1ff..05add254546969e8a7cb0f70c9a8650a16a96b0b 100644 (file)
@@ -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);
index 4aab92b2a5f3a06d620846ca411801b82ca05ebf..03a6847f2f2c3a723d9f82650e1436b8b4246e5f 100644 (file)
@@ -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);
 
 /*