]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Re-Apply: Disambiguate socket API pathes on Windows with user name
authorDaniel Molkentin <danimo@owncloud.com>
Wed, 20 Apr 2016 14:51:17 +0000 (16:51 +0200)
committerDaniel Molkentin <danimo@owncloud.com>
Mon, 2 May 2016 14:09:48 +0000 (16:09 +0200)
Addresses #3411

binary
shell_integration/windows/OCUtil/RemotePathChecker.cpp
src/gui/socketapi.cpp

diff --git a/binary b/binary
index ac422574995d2339d98fff552f11450b18d7bcff..a56480559ddda3af36b63bb42cfc6cfe05ebc6db 160000 (submodule)
--- a/binary
+++ b/binary
@@ -1 +1 @@
-Subproject commit ac422574995d2339d98fff552f11450b18d7bcff
+Subproject commit a56480559ddda3af36b63bb42cfc6cfe05ebc6db
index 85b01350fc5f13990f7e1b8d71e1265db5213947..d03a38350030effa73bbd60146744a0a430c0e3d 100644 (file)
 
 using namespace std;
 
+#define BUFSIZE 512
+
+std::wstring getUserName() {
+    DWORD  len = BUFSIZE;
+    TCHAR  buf[BUFSIZE];
+    if (GetUserName(buf, &len)) {
+        return std::wstring(&buf[0], len);
+    } else {
+        return std::wstring();
+    }
+}
 
 // This code is run in a thread
 void RemotePathChecker::workerThreadLoop()
 {
     auto pipename = std::wstring(L"\\\\.\\pipe\\");
-    pipename += L"ownCloud";
+    pipename += L"ownCloud\\";
+    pipename += getUserName();
 
     bool connected = false;
     CommunicationSocket socket;
@@ -241,4 +253,4 @@ RemotePathChecker::FileState RemotePathChecker::_StrToFileState(const std::wstri
        }
 
        return StateNone;
-}
\ No newline at end of file
+}
index 91887f003765b93b78976bfac2c4c44dcc865b0c..06141684b9a765d133d2b118378dbe29dd32fabe 100644 (file)
@@ -67,7 +67,8 @@ SocketApi::SocketApi(QObject* parent)
 
     if (Utility::isWindows()) {
         socketPath = QLatin1String("\\\\.\\pipe\\")
-        + QLatin1String("ownCloud");
+                + QLatin1String("ownCloud") + '\\'
+                + QString::fromLocal8Bit(qgetenv("USERNAME"));
         // TODO: once the windows extension supports multiple
         // client connections, switch back to the theme name
         // See issue #2388