From: Kruti Pendharkar Date: Wed, 11 Jun 2025 00:48:53 +0000 (-0700) Subject: Change to common source file not applicable to open-vm-tools. X-Git-Tag: stable-13.0.0~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d91778dcdf1cc11268222cad783eedbe06bbc2d0;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 481af4b21..bb605a6cd 100644 --- a/open-vm-tools/vgauth/serviceImpl/service.c +++ b/open-vm-tools/vgauth/serviceImpl/service.c @@ -29,7 +29,7 @@ #include "VGAuthUtil.h" #ifdef _WIN32 #include "winUtil.h" -#include +#include #endif static ServiceStartListeningForIOFunc startListeningIOFunc = NULL; @@ -286,14 +286,21 @@ ServiceUserNameToPipeName(const char *userName) { gchar *escapedName = ServiceEncodeUserName(userName); #ifdef _WIN32 + gchar *uuidStr = g_uuid_string_random(); /* * Add a unique suffix to avoid a name collision with an existing named pipe * created by someone else (intentionally or by accident). + * This is not needed for Linux; name collisions on sockets are already + * avoided there since (1) file system paths to VGAuthService sockets are in + * a directory that is writable only by root and (2) VGAuthService unlinks a + * socket path before binding it to a newly created socket. */ - gchar *pipeName = g_strdup_printf("%s-%s-%u", + gchar *pipeName = g_strdup_printf("%s-%s-%s", SERVICE_PUBLIC_PIPE_NAME, escapedName, - g_random_int()); + uuidStr); + + g_free(uuidStr); #else gchar *pipeName = g_strdup_printf("%s-%s", SERVICE_PUBLIC_PIPE_NAME,