/*********************************************************
- * Copyright (C) 2011-2019,2023 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
/** Where the localized version of the messages were installed. */
#define VGAUTH_PREF_LOCALIZATION_DIR "msgCatalog"
+/** If symlinks or junctions are allowed in alias store file path */
+#define VGAUTH_PREF_ALLOW_SYMLINKS "allowSymlinks"
+
/*
* Pref values
*/
#define ALIASSTORE_FILE_PREFIX "user-"
#define ALIASSTORE_FILE_SUFFIX ".xml"
+static gboolean allowSymlinks = FALSE;
static gchar *aliasStoreRootDir = DEFAULT_ALIASSTORE_ROOT_DIR;
#ifdef _WIN32
goto done;
}
- /*
- * Check if fileName is real path.
- */
- if ((realPath = ServiceFileGetPathByHandle(hFile)) == NULL) {
- err = VGAUTH_E_FAIL;
- goto done;
- }
- if (g_strcmp0(realPath, fileName) != 0) {
- Warning("%s: Real path (%s) is not same as file path (%s)\n",
- __FUNCTION__, realPath, fileName);
- err = VGAUTH_E_FAIL;
- goto done;
+ if (!allowSymlinks) {
+ /*
+ * Check if fileName is real path.
+ */
+ if ((realPath = ServiceFileGetPathByHandle(hFile)) == NULL) {
+ err = VGAUTH_E_FAIL;
+ goto done;
+ }
+ if (_stricmp(realPath, fileName) != 0) {
+ Warning("%s: Real path (%s) is not same as file path (%s)\n",
+ __FUNCTION__, realPath, fileName);
+ err = VGAUTH_E_FAIL;
+ goto done;
+ }
}
/*
goto done;
}
- /*
- * Check if fileName is real path.
- */
- if (realpath(fileName, realPath) == NULL) {
- Warning("%s: realpath() failed. errno (%d)\n", __FUNCTION__, errno);
- err = VGAUTH_E_FAIL;
- goto done;
- }
- if (g_strcmp0(realPath, fileName) != 0) {
- Warning("%s: Real path (%s) is not same as file path (%s)\n",
- __FUNCTION__, realPath, fileName);
- err = VGAUTH_E_FAIL;
- goto done;
+ if (!allowSymlinks) {
+ /*
+ * Check if fileName is real path.
+ */
+ if (realpath(fileName, realPath) == NULL) {
+ Warning("%s: realpath() failed. errno (%d)\n", __FUNCTION__, errno);
+ err = VGAUTH_E_FAIL;
+ goto done;
+ }
+ if (g_strcmp0(realPath, fileName) != 0) {
+ Warning("%s: Real path (%s) is not same as file path (%s)\n",
+ __FUNCTION__, realPath, fileName);
+ err = VGAUTH_E_FAIL;
+ goto done;
+ }
}
/*
defaultDir = g_strdup(DEFAULT_ALIASSTORE_ROOT_DIR);
#endif
+ allowSymlinks = Pref_GetBool(gPrefs,
+ VGAUTH_PREF_ALLOW_SYMLINKS,
+ VGAUTH_PREF_GROUP_NAME_SERVICE,
+ FALSE);
/*
* Find the alias store directory. This allows an installer to put
* it somewhere else if necessary.