OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/ipc_util.h" | 5 #include "remoting/host/ipc_util.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 std::wstring user_sid; | 32 std::wstring user_sid; |
33 if (!base::win::GetUserSidString(&user_sid)) { | 33 if (!base::win::GetUserSidString(&user_sid)) { |
34 LOG(ERROR) << "Failed to query the current user SID."; | 34 LOG(ERROR) << "Failed to query the current user SID."; |
35 return false; | 35 return false; |
36 } | 36 } |
37 | 37 |
38 // Create a security descriptor that will be used to protect the named pipe in | 38 // Create a security descriptor that will be used to protect the named pipe in |
39 // between CreateNamedPipe() and CreateFile() calls before it will be passed | 39 // between CreateNamedPipe() and CreateFile() calls before it will be passed |
40 // to the network process. It gives full access to the account that | 40 // to the network process. It gives full access to the account that |
41 // the calling code is running under and denies access by anyone else. | 41 // the calling code is running under and denies access by anyone else. |
42 std::string security_descriptor = base::StringPrintf( | 42 std::string user_sid_utf8 = base::WideToUTF8(user_sid); |
43 "O:%1$sG:%1$sD:(A;;GA;;;%1$s)", base::WideToUTF8(user_sid).c_str()); | 43 std::string security_descriptor = |
| 44 base::StringPrintf("O:%sG:%sD:(A;;GA;;;%s)", user_sid_utf8.c_str(), |
| 45 user_sid_utf8.c_str(), user_sid_utf8.c_str()); |
44 | 46 |
45 // Generate a unique name for the channel. | 47 // Generate a unique name for the channel. |
46 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); | 48 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); |
47 | 49 |
48 // Create the server end of the channel. | 50 // Create the server end of the channel. |
49 ScopedHandle pipe; | 51 ScopedHandle pipe; |
50 if (!CreateIpcChannel(channel_name, security_descriptor, &pipe)) { | 52 if (!CreateIpcChannel(channel_name, security_descriptor, &pipe)) { |
51 return false; | 53 return false; |
52 } | 54 } |
53 | 55 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 PLOG(ERROR) | 126 PLOG(ERROR) |
125 << "Failed to create the server end of the Chromoting IPC channel"; | 127 << "Failed to create the server end of the Chromoting IPC channel"; |
126 return false; | 128 return false; |
127 } | 129 } |
128 | 130 |
129 *pipe_out = pipe.Pass(); | 131 *pipe_out = pipe.Pass(); |
130 return true; | 132 return true; |
131 } | 133 } |
132 | 134 |
133 } // namespace remoting | 135 } // namespace remoting |
OLD | NEW |