From: Kruti Pendharkar Date: Tue, 3 Jun 2025 06:30:24 +0000 (-0700) Subject: Change to common source file not applicable to open-vm-tools. X-Git-Tag: stable-13.1.0~183 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=de4d5ea805bed88ce9338ae5d47962813d6045fe;p=thirdparty%2Fopen-vm-tools.git Change to common source file not applicable to open-vm-tools. --- diff --git a/open-vm-tools/vgauth/serviceImpl/service.c b/open-vm-tools/vgauth/serviceImpl/service.c index d4716526c..481af4b21 100644 --- a/open-vm-tools/vgauth/serviceImpl/service.c +++ b/open-vm-tools/vgauth/serviceImpl/service.c @@ -1,5 +1,6 @@ /********************************************************* - * Copyright (C) 2011-2016,2019 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 @@ -28,6 +29,7 @@ #include "VGAuthUtil.h" #ifdef _WIN32 #include "winUtil.h" +#include #endif static ServiceStartListeningForIOFunc startListeningIOFunc = NULL; @@ -283,9 +285,20 @@ static gchar * ServiceUserNameToPipeName(const char *userName) { gchar *escapedName = ServiceEncodeUserName(userName); +#ifdef _WIN32 + /* + * Add a unique suffix to avoid a name collision with an existing named pipe + * created by someone else (intentionally or by accident). + */ + gchar *pipeName = g_strdup_printf("%s-%s-%u", + SERVICE_PUBLIC_PIPE_NAME, + escapedName, + g_random_int()); +#else gchar *pipeName = g_strdup_printf("%s-%s", SERVICE_PUBLIC_PIPE_NAME, escapedName); +#endif g_free(escapedName); return pipeName;