#include "VGAuthUtil.h"
#ifdef _WIN32
#include "winUtil.h"
-#include <gmodule.h>
+#include <glib.h>
#endif
static ServiceStartListeningForIOFunc startListeningIOFunc = NULL;
{
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,