#endif
-/*
- * The config file groupname for API configuration.
- */
-#define VIX_TOOLS_CONFIG_API_GROUPNAME "guestoperations"
-
/*
* Authentication configuration.
* There are various forms of authentication supported,
#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
-
-
/*
*-----------------------------------------------------------------------------
*
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
#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
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
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,
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);
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;
}