]> 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>
Wed, 10 Dec 2025 05:31:19 +0000 (21:31 -0800)
committerKruti Pendharkar <kp025370@broadcom.com>
Wed, 10 Dec 2025 05:31:19 +0000 (21:31 -0800)
open-vm-tools/services/plugins/vix/vixTools.c
open-vm-tools/services/plugins/vix/vixToolsInt.h
open-vm-tools/vgauth/lib/VGAuthInt.h
open-vm-tools/vgauth/lib/common.c

index 654512c5eb33d215ef123149129f2a26bf7e9a8c..694371d1044053e57dd2d836c03b583597491355 100644 (file)
@@ -241,11 +241,6 @@ char *gImpersonatedUsername = NULL;
 #endif
 
 
-/*
- * The config file groupname for API configuration.
- */
-#define  VIX_TOOLS_CONFIG_API_GROUPNAME               "guestoperations"
-
 /*
  * Authentication configuration.
  * There are various forms of authentication supported,
@@ -2645,65 +2640,6 @@ VixToolsTranslateVGAuthError(VGAuthError vgErr)
 #endif
 
 
-#if defined(_WIN32)
-/*
- *-----------------------------------------------------------------------------
- *
- * VixTools_ConfigGetString --
- *
- *    Wrapper for VMTools_ConfigGetString to retrieve values
- *    from VIX_TOOLS_CONFIG_API_GROUPNAME group.
- *
- * Return value:
- *    Value of the key if the value was read successfully, or else
- *    a copy of defValue unless defValue is NULL, in which case it's NULL.
- *    The returned string should be freed with g_free when no longer
- *    needed.
- *
- * Side effects:
- *    None
- *
- *-----------------------------------------------------------------------------
- */
-gchar *
-VixTools_ConfigGetString(const gchar *key,         // IN
-                         const gchar *defValue)    // In
-{
-
-   return VMTools_ConfigGetString(gConfDictRef,
-                                  VIX_TOOLS_CONFIG_API_GROUPNAME,
-                                  key, defValue);
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * VixTools_ConfigLogInvalidString --
- *
- *    Log a warning when a config string from the
- *    VIX_TOOLS_CONFIG_API_GROUPNAME group has an invalid value.
- *
- * Return value:
- *    None
- *
- * Side effects:
- *    None
- *
- *-----------------------------------------------------------------------------
- */
-void
-VixTools_ConfigLogInvalidString(const gchar *function,    // IN
-                                const gchar *key,         // IN
-                                const gchar *confValue,   // IN
-                                const gchar *usedValue)   // IN
-{
-   g_warning("%s: invalid value '%s' from tools.conf [%s] %s, using %s.\n",
-             function, confValue, VIX_TOOLS_CONFIG_API_GROUPNAME, key, usedValue);
-}
-#endif
-
-
 /*
  *-----------------------------------------------------------------------------
  *
@@ -12238,6 +12174,28 @@ GuestAuthUnloadUserProfileAndToken(HANDLE hToken,
       CloseHandle(hToken);
    }
 }
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixTools_GetConfDict --
+ *
+ *    Return pointer to dictionary used during VixTools_ProcessVixCommand
+ *
+ * Return value:
+ *    Pointer to GKeyFile for dictionary
+ *
+ * Side effects:
+ *    None
+ *
+ *-----------------------------------------------------------------------------
+ */
+GKeyFile *
+VixTools_GetConfDict(void)
+{
+   return gConfDictRef;
+}
 #endif // _WIN32
 
 #endif // SUPPORT_VGAUTH
index b91a9e90b6c1de138f94ebe527c743f12a088c52..834f411ed81376aa572fea50acfc4cdc3051dd9d 100644 (file)
 #include "VGAuthAlias.h"
 #endif
 
+
+/*
+ * The config file groupname for API configuration.
+ */
+#define  VIX_TOOLS_CONFIG_API_GROUPNAME               "guestoperations"
+
 #define PROCESS_CREATOR_USER_TOKEN       ((void *)1)
 
 #ifdef _WIN32
@@ -73,15 +79,10 @@ VixError VixTools_Initialize(Bool thisProcessRunsAsRootArg,
 void VixTools_Uninitialize(void);
 
 #ifdef _WIN32
-VixError VixToolsTranslateVGAuthError(VGAuthError vgErr);
 
-gchar *VixTools_ConfigGetString(const gchar *key,
-                                 const gchar *defValue);
+GKeyFile *VixTools_GetConfDict(void);
 
-void VixTools_ConfigLogInvalidString(const gchar *function,
-                                     const gchar *key,
-                                     const gchar *confValue,
-                                     const gchar *usedValue);
+VixError VixToolsTranslateVGAuthError(VGAuthError vgErr);
 
 #endif
 
index ef24722962165c5ea6b808cac006ca53c12d1b81..73ed659aa857b9e63c6775b3d446eee43642fd28 100644 (file)
@@ -287,14 +287,14 @@ VGAuthError VGAuth_NetworkReadBytes(VGAuthContext *ctx,
                                     gsize *len,
                                     gchar **buffer);
 
-
-VGAuthError VGAuthValidateUsernamePasswordImpl(VGAuthContext *ctx,
-                                               const char *userName,
-                                               const char *password,
-                                               const int numExtraParams,
-                                               const VGAuthExtraParams
-                                                  *extraParams,
-                                               VGAuthUserHandle **handle);
+VGAuthError VGAuthValidateUsernamePasswordImpl(
+               VGAuthContext *ctx,
+               const char *userName,
+               const char *password,
+               const int numExtraParams,
+               const VGAuthExtraParams *extraParams,
+               VGAuthUserHandle **handle
+            );
 
 #ifdef UNITTEST
 VGAuthError VGAuthComm_SetTestBufferInput(VGAuthContext *ctx,
index 366976a6ecf8046bf20d9aecae885bfc8ea5e5bb..1db3a4f706d7ddd8b71ea9116c075b2725cc5fc1 100644 (file)
@@ -195,8 +195,8 @@ VGAuthGetStringExtraParamImpl(const char *funcName,
                               const char *defValue,
                               const char **paramValue)
 {
-   gboolean paramSet = FALSE;
    int i;
+   int paramIndex;
 
    if ((numParams < 0) || (numParams > 0 && NULL == params)) {
       Warning("%s: invalid number of parameters: %d.\n", funcName, numParams);
@@ -207,27 +207,27 @@ VGAuthGetStringExtraParamImpl(const char *funcName,
       return VGAUTH_E_INVALID_ARGUMENT;
    }
 
+   paramIndex = -1;
    for (i = 0; i < numParams; i++) {
       if (g_strcmp0(params[i].name, paramName) == 0) {
-         // only allow it to be set once
-         if (paramSet) {
+         // make sure it's only specified once
+         if (paramIndex >= 0) {
             Warning("%s: extraParam '%s' passed multiple times.\n",
                     funcName, params[i].name);
             return VGAUTH_E_INVALID_ARGUMENT;
          }
-         if (params[i].value) {
-            *paramValue = params[i].value;
-            paramSet = TRUE;
-         } else {
-            Warning("%s: extraParam '%s' has NULL value.\n",
-                    funcName, params[i].name);
-            return VGAUTH_E_INVALID_ARGUMENT;
-         }
+         paramIndex = i;
       }
    }
 
-   if (!paramSet) {
+   if (paramIndex < 0) {
       *paramValue = defValue;
+   } else if (params[paramIndex].value != NULL) {
+      *paramValue = params[paramIndex].value;
+   } else {
+      Warning("%s: extraParam '%s' has NULL value.\n",
+              funcName, params[i].name);
+      return VGAUTH_E_INVALID_ARGUMENT;
    }
    return VGAUTH_E_OK;
 }