From: Oliver Kurth Date: Thu, 28 Mar 2019 19:43:00 +0000 (-0700) Subject: Common source file changes not applicable to open-vm-tools. X-Git-Tag: stable-11.0.0~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=176aa26ae63050e7d10c8413230c566069cb06d9;p=thirdparty%2Fopen-vm-tools.git Common source file changes not applicable to open-vm-tools. Security fix for dll load paths in Tools and vgauth. --- diff --git a/open-vm-tools/checkvm/checkvm.c b/open-vm-tools/checkvm/checkvm.c index 1642d9411..31694f4ec 100644 --- a/open-vm-tools/checkvm/checkvm.c +++ b/open-vm-tools/checkvm/checkvm.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2007-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2007-2019 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 @@ -36,6 +36,7 @@ #include "vmcheck.h" #if defined(_WIN32) #include "getoptwin32.h" +#include "vmware/tools/win32util.h" #endif #include "checkvm_version.h" @@ -84,6 +85,10 @@ main(int argc, uint32 screensize = 0; uint32 hwVersion; +#if defined(_WIN32) + WinUtil_EnableSafePathSearching(TRUE); +#endif + if (!VmCheck_IsVirtualWorld()) { fprintf(stdout, "Not running in a virtual machine.\n"); return 1; diff --git a/open-vm-tools/hgfsclient/hgfsclient.c b/open-vm-tools/hgfsclient/hgfsclient.c index 642b3ea83..8ba516c20 100644 --- a/open-vm-tools/hgfsclient/hgfsclient.c +++ b/open-vm-tools/hgfsclient/hgfsclient.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2006-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2006-2019 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 @@ -37,6 +37,9 @@ #include "str.h" #include "vmware/tools/log.h" #include "vmware/tools/utils.h" +#ifdef _WIN32 +#include "vmware/tools/win32util.h" +#endif #include "hgfsclient_version.h" #include "vm_version.h" @@ -415,6 +418,9 @@ int main(int argc, // IN char *argv[]) // IN { +#ifdef _WIN32 + WinUtil_EnableSafePathSearching(TRUE); +#endif if (argc == 2 && (!strncmp(argv[1], "-h", 2) || !strncmp(argv[1], "--help", 6))) { diff --git a/open-vm-tools/namespacetool/namespacetool.c b/open-vm-tools/namespacetool/namespacetool.c index b3e9700cd..171e35267 100644 --- a/open-vm-tools/namespacetool/namespacetool.c +++ b/open-vm-tools/namespacetool/namespacetool.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2016 VMware, Inc. All rights reserved. + * Copyright (C) 2016-2019 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 @@ -30,6 +30,9 @@ #include "dynbuf.h" #include "vmware/tools/guestrpc.h" #include "vmware/tools/log.h" +#if defined(_WIN32) +#include "vmware/tools/win32util.h" +#endif #include "debug.h" // Core Namespace commands @@ -626,6 +629,10 @@ main(int argc, char *argv[]) { NULL } }; +#if defined(_WIN32) + WinUtil_EnableSafePathSearching(TRUE); +#endif + gAppName = g_path_get_basename(argv[0]); g_set_prgname(gAppName); diff --git a/open-vm-tools/rpctool/rpctool.c b/open-vm-tools/rpctool/rpctool.c index cc83d8b9f..d7bfd5204 100644 --- a/open-vm-tools/rpctool/rpctool.c +++ b/open-vm-tools/rpctool/rpctool.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2002-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2002-2019 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 @@ -35,6 +35,9 @@ #include "rpcout.h" #include "str.h" #include "backdoor_def.h" +#ifdef _WIN32 +#include "vmware/tools/win32util.h" +#endif #define NOT_VMWARE_ERROR "Failed sending message to VMware.\n" @@ -135,6 +138,10 @@ main(int argc, char *argv[]) { int ret = 1; +#ifdef _WIN32 + WinUtil_EnableSafePathSearching(TRUE); +#endif + if (argc <= 1) { PrintUsage(); return 1; diff --git a/open-vm-tools/toolbox/toolbox-cmd.c b/open-vm-tools/toolbox/toolbox-cmd.c index 45a12ef4b..19af5ba3a 100644 --- a/open-vm-tools/toolbox/toolbox-cmd.c +++ b/open-vm-tools/toolbox/toolbox-cmd.c @@ -1,6 +1,6 @@ /********************************************************* - * Copyright (C) 2008-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2019 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 @@ -38,6 +38,10 @@ #include "vmware/tools/i18n.h" #include "vmware/tools/log.h" #include "vmware/tools/utils.h" +#if defined(_WIN32) +#include "vmware/tools/win32util.h" +#endif + #include "vm_version.h" #include "vm_product_versions.h" @@ -447,6 +451,9 @@ main(int argc, // IN: length of command line arguments #if defined(_WIN32) char **argv; + + WinUtil_EnableSafePathSearching(TRUE); + Unicode_InitW(argc, wargv, NULL, &argv, NULL); #else Unicode_Init(argc, &argv, NULL); diff --git a/open-vm-tools/vgauth/service/main.c b/open-vm-tools/vgauth/service/main.c index 1e64cd32d..9f0f337f8 100644 --- a/open-vm-tools/vgauth/service/main.c +++ b/open-vm-tools/vgauth/service/main.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2011-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2011-2019 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 @@ -530,6 +530,10 @@ int main(int argc, char *argv[]) { +#ifdef _WIN32 + WinUtil_EnableSafePathSearching(); +#endif + gPrefs = Pref_Init(VGAUTH_PREF_CONFIG_FILENAME); /* diff --git a/open-vm-tools/xferlogs/xferlogs.c b/open-vm-tools/xferlogs/xferlogs.c index 9aa9b3ac2..0b07ab44a 100644 --- a/open-vm-tools/xferlogs/xferlogs.c +++ b/open-vm-tools/xferlogs/xferlogs.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2006-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2006-2019 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 @@ -55,6 +55,9 @@ #include "xferlogs_version.h" #include "vm_version.h" +#ifdef _WIN32 +#include "vmware/tools/win32util.h" +#endif #include "embed_version.h" VM_EMBED_VERSION(XFERLOGS_VERSION_STRING); @@ -285,6 +288,10 @@ main(int argc, { int status; +#ifdef _WIN32 + WinUtil_EnableSafePathSearching(TRUE); +#endif + if (argc == 2 && (!strncmp(argv[1], "-h", 2) || !strncmp(argv[1], "--help", 6))) {