Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: remoting/host/security_key/security_key_auth_handler_win.cc

Issue 2162083003: Renaming Gnubby and RemoteSecurityKey files/classes/members (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a GYP build error Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/security_key/gnubby_auth_handler.h" 5 #include "remoting/host/security_key/security_key_auth_handler.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
19 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "base/timer/timer.h" 21 #include "base/timer/timer.h"
22 #include "base/win/win_util.h" 22 #include "base/win/win_util.h"
23 #include "ipc/ipc_channel.h" 23 #include "ipc/ipc_channel.h"
24 #include "ipc/ipc_listener.h" 24 #include "ipc/ipc_listener.h"
25 #include "ipc/ipc_message.h" 25 #include "ipc/ipc_message.h"
26 #include "ipc/ipc_message_macros.h" 26 #include "ipc/ipc_message_macros.h"
27 #include "remoting/base/logging.h" 27 #include "remoting/base/logging.h"
28 #include "remoting/host/chromoting_messages.h" 28 #include "remoting/host/chromoting_messages.h"
29 #include "remoting/host/client_session_details.h" 29 #include "remoting/host/client_session_details.h"
30 #include "remoting/host/ipc_util.h" 30 #include "remoting/host/ipc_util.h"
31 #include "remoting/host/security_key/remote_security_key_ipc_constants.h" 31 #include "remoting/host/security_key/security_key_ipc_constants.h"
32 #include "remoting/host/security_key/remote_security_key_ipc_server.h" 32 #include "remoting/host/security_key/security_key_ipc_server.h"
33 33
34 namespace { 34 namespace {
35 35
36 // The timeout used to disconnect a client from the IPC Server channel if it 36 // The timeout used to disconnect a client from the IPC Server channel if it
37 // forgets to do so. This ensures the server channel is not blocked forever. 37 // forgets to do so. This ensures the server channel is not blocked forever.
38 const int kInitialRequestTimeoutSeconds = 5; 38 const int kInitialRequestTimeoutSeconds = 5;
39 39
40 // This value represents the amount of time to wait for a gnubby request from 40 // This value represents the amount of time to wait for a security key request
41 // the client before terminating the connection. 41 // from the client before terminating the connection.
42 const int kGnubbyRequestTimeoutSeconds = 60; 42 const int kSecurityKeyRequestTimeoutSeconds = 60;
43 43
44 } // namespace 44 } // namespace
45 45
46 namespace remoting { 46 namespace remoting {
47 47
48 // Creates an IPC server channel which services IPC clients that want to start 48 // Creates an IPC server channel which services IPC clients that want to start
49 // a security key forwarding session. Once an IPC Client connects to the 49 // a security key forwarding session. Once an IPC Client connects to the
50 // server, the GnubbyAuthHandlerWin class will create a new 50 // server, the SecurityKeyAuthHandlerWin class will create a new
51 // RemoteSecurityKeyIpcServer instance that will service that request. The new 51 // SecurityKeyIpcServer instance that will service that request. The new
52 // instance will exist for the lifetime of the security key request and will be 52 // instance will exist for the lifetime of the security key request and will be
53 // assigned a unique IPC channel name and connection id. The channel name is 53 // assigned a unique IPC channel name and connection id. The channel name is
54 // sent to the client which should disconnect the IPC server channel and 54 // sent to the client which should disconnect the IPC server channel and
55 // connect to the security key forwarding session IPC channel to send/receive 55 // connect to the security key forwarding session IPC channel to send/receive
56 // security key messages. The IPC server channel will then be reset so it can 56 // security key messages. The IPC server channel will then be reset so it can
57 // can service the next client/request. This system allows multiple security 57 // can service the next client/request. This system allows multiple security
58 // key forwarding sessions to occur concurrently. 58 // key forwarding sessions to occur concurrently.
59 // TODO(joedow): Update GnubbyAuthHandler impls to run on a separate IO thread 59 // TODO(joedow): Update SecurityKeyAuthHandler impls to run on a separate IO
60 // instead of the thread it was created on: crbug.com/591739 60 // thread instead of the thread it was created on: crbug.com/591739
61 class GnubbyAuthHandlerWin : public GnubbyAuthHandler, public IPC::Listener { 61 class SecurityKeyAuthHandlerWin : public SecurityKeyAuthHandler,
62 public IPC::Listener {
62 public: 63 public:
63 explicit GnubbyAuthHandlerWin(ClientSessionDetails* client_session_details); 64 explicit SecurityKeyAuthHandlerWin(
64 ~GnubbyAuthHandlerWin() override; 65 ClientSessionDetails* client_session_details);
66 ~SecurityKeyAuthHandlerWin() override;
65 67
66 private: 68 private:
67 typedef std::map<int, std::unique_ptr<RemoteSecurityKeyIpcServer>> 69 typedef std::map<int, std::unique_ptr<SecurityKeyIpcServer>> ActiveChannels;
68 ActiveChannels;
69 70
70 // GnubbyAuthHandler interface. 71 // SecurityKeyAuthHandler interface.
71 void CreateGnubbyConnection() override; 72 void CreateSecurityKeyConnection() override;
72 bool IsValidConnectionId(int gnubby_connection_id) const override; 73 bool IsValidConnectionId(int security_key_connection_id) const override;
73 void SendClientResponse(int gnubby_connection_id, 74 void SendClientResponse(int security_key_connection_id,
74 const std::string& response) override; 75 const std::string& response) override;
75 void SendErrorAndCloseConnection(int gnubby_connection_id) override; 76 void SendErrorAndCloseConnection(int security_key_connection_id) override;
76 void SetSendMessageCallback(const SendMessageCallback& callback) override; 77 void SetSendMessageCallback(const SendMessageCallback& callback) override;
77 size_t GetActiveConnectionCountForTest() const override; 78 size_t GetActiveConnectionCountForTest() const override;
78 void SetRequestTimeoutForTest(base::TimeDelta timeout) override; 79 void SetRequestTimeoutForTest(base::TimeDelta timeout) override;
79 80
80 // IPC::Listener implementation. 81 // IPC::Listener implementation.
81 bool OnMessageReceived(const IPC::Message& message) override; 82 bool OnMessageReceived(const IPC::Message& message) override;
82 void OnChannelConnected(int32_t peer_pid) override; 83 void OnChannelConnected(int32_t peer_pid) override;
83 void OnChannelError() override; 84 void OnChannelError() override;
84 85
85 // Creates the IPC server channel and waits for a connection using 86 // Creates the IPC server channel and waits for a connection using
86 // |ipc_server_channel_name_|. 87 // |ipc_server_channel_name_|.
87 void StartIpcServerChannel(); 88 void StartIpcServerChannel();
88 89
89 // Restarts the IPC server channel to prepare for another connection. 90 // Restarts the IPC server channel to prepare for another connection.
90 void RecreateIpcServerChannel(); 91 void RecreateIpcServerChannel();
91 92
92 // Closes the IPC channel created for a security key forwarding session. 93 // Closes the IPC channel created for a security key forwarding session.
93 void CloseSecurityKeyRequestIpcChannel(int connection_id); 94 void CloseSecurityKeyRequestIpcChannel(int connection_id);
94 95
95 // Returns the IPC Channel instance created for |connection_id|. 96 // Returns the IPC Channel instance created for |connection_id|.
96 ActiveChannels::const_iterator GetChannelForConnectionId( 97 ActiveChannels::const_iterator GetChannelForConnectionId(
97 int connection_id) const; 98 int connection_id) const;
98 99
99 // Creates a unique name based on the well-known IPC channel name. 100 // Creates a unique name based on the well-known IPC channel name.
100 std::string GenerateUniqueChannelName(); 101 std::string GenerateUniqueChannelName();
101 102
102 // Represents the last id assigned to a new security key request IPC channel. 103 // Represents the last id assigned to a new security key request IPC channel.
103 int last_connection_id_ = 0; 104 int last_connection_id_ = 0;
104 105
105 // Sends a gnubby extension messages to the remote client when called. 106 // Sends a security key extension message to the client when called.
106 SendMessageCallback send_message_callback_; 107 SendMessageCallback send_message_callback_;
107 108
108 // Interface which provides details about the client session. 109 // Interface which provides details about the client session.
109 ClientSessionDetails* client_session_details_ = nullptr; 110 ClientSessionDetails* client_session_details_ = nullptr;
110 111
111 // Tracks the IPC channel created for each security key forwarding session. 112 // Tracks the IPC channel created for each security key forwarding session.
112 ActiveChannels active_channels_; 113 ActiveChannels active_channels_;
113 114
114 // The amount of time to wait for a client to process the connection details 115 // The amount of time to wait for a client to process the connection details
115 // message and disconnect from the IPC server channel before disconnecting it. 116 // message and disconnect from the IPC server channel before disconnecting it.
116 base::TimeDelta disconnect_timeout_; 117 base::TimeDelta disconnect_timeout_;
117 118
118 // Used to recreate the IPC server channel if a client forgets to disconnect. 119 // Used to recreate the IPC server channel if a client forgets to disconnect.
119 base::OneShotTimer timer_; 120 base::OneShotTimer timer_;
120 121
121 // IPC Clients connect to this channel first to receive their own IPC 122 // IPC Clients connect to this channel first to receive their own IPC
122 // channel to start a security key forwarding session on. 123 // channel to start a security key forwarding session on.
123 std::unique_ptr<IPC::Channel> ipc_server_channel_; 124 std::unique_ptr<IPC::Channel> ipc_server_channel_;
124 125
125 // Ensures GnubbyAuthHandlerWin methods are called on the same thread. 126 // Ensures SecurityKeyAuthHandlerWin methods are called on the same thread.
126 base::ThreadChecker thread_checker_; 127 base::ThreadChecker thread_checker_;
127 128
128 base::WeakPtrFactory<GnubbyAuthHandlerWin> weak_factory_; 129 base::WeakPtrFactory<SecurityKeyAuthHandlerWin> weak_factory_;
129 130
130 DISALLOW_COPY_AND_ASSIGN(GnubbyAuthHandlerWin); 131 DISALLOW_COPY_AND_ASSIGN(SecurityKeyAuthHandlerWin);
131 }; 132 };
132 133
133 std::unique_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create( 134 std::unique_ptr<SecurityKeyAuthHandler> SecurityKeyAuthHandler::Create(
134 ClientSessionDetails* client_session_details, 135 ClientSessionDetails* client_session_details,
135 const SendMessageCallback& send_message_callback) { 136 const SendMessageCallback& send_message_callback) {
136 std::unique_ptr<GnubbyAuthHandler> auth_handler( 137 std::unique_ptr<SecurityKeyAuthHandler> auth_handler(
137 new GnubbyAuthHandlerWin(client_session_details)); 138 new SecurityKeyAuthHandlerWin(client_session_details));
138 auth_handler->SetSendMessageCallback(send_message_callback); 139 auth_handler->SetSendMessageCallback(send_message_callback);
139 return auth_handler; 140 return auth_handler;
140 } 141 }
141 142
142 GnubbyAuthHandlerWin::GnubbyAuthHandlerWin( 143 SecurityKeyAuthHandlerWin::SecurityKeyAuthHandlerWin(
143 ClientSessionDetails* client_session_details) 144 ClientSessionDetails* client_session_details)
144 : client_session_details_(client_session_details), 145 : client_session_details_(client_session_details),
145 disconnect_timeout_( 146 disconnect_timeout_(
146 base::TimeDelta::FromSeconds(kInitialRequestTimeoutSeconds)), 147 base::TimeDelta::FromSeconds(kInitialRequestTimeoutSeconds)),
147 weak_factory_(this) { 148 weak_factory_(this) {
148 DCHECK(client_session_details_); 149 DCHECK(client_session_details_);
149 } 150 }
150 151
151 GnubbyAuthHandlerWin::~GnubbyAuthHandlerWin() {} 152 SecurityKeyAuthHandlerWin::~SecurityKeyAuthHandlerWin() {}
152 153
153 void GnubbyAuthHandlerWin::CreateGnubbyConnection() { 154 void SecurityKeyAuthHandlerWin::CreateSecurityKeyConnection() {
154 DCHECK(thread_checker_.CalledOnValidThread()); 155 DCHECK(thread_checker_.CalledOnValidThread());
155 StartIpcServerChannel(); 156 StartIpcServerChannel();
156 } 157 }
157 158
158 bool GnubbyAuthHandlerWin::IsValidConnectionId(int connection_id) const { 159 bool SecurityKeyAuthHandlerWin::IsValidConnectionId(int connection_id) const {
159 DCHECK(thread_checker_.CalledOnValidThread()); 160 DCHECK(thread_checker_.CalledOnValidThread());
160 return (GetChannelForConnectionId(connection_id) != active_channels_.end()); 161 return (GetChannelForConnectionId(connection_id) != active_channels_.end());
161 } 162 }
162 163
163 void GnubbyAuthHandlerWin::SendClientResponse( 164 void SecurityKeyAuthHandlerWin::SendClientResponse(
164 int connection_id, 165 int connection_id,
165 const std::string& response_data) { 166 const std::string& response_data) {
166 DCHECK(thread_checker_.CalledOnValidThread()); 167 DCHECK(thread_checker_.CalledOnValidThread());
167 168
168 ActiveChannels::const_iterator iter = 169 ActiveChannels::const_iterator iter =
169 GetChannelForConnectionId(connection_id); 170 GetChannelForConnectionId(connection_id);
170 if (iter == active_channels_.end()) { 171 if (iter == active_channels_.end()) {
171 HOST_LOG << "Invalid gnubby connection ID received: " << connection_id; 172 HOST_LOG << "Invalid security key connection ID received: "
173 << connection_id;
172 return; 174 return;
173 } 175 }
174 176
175 if (!iter->second->SendResponse(response_data)) { 177 if (!iter->second->SendResponse(response_data)) {
176 CloseSecurityKeyRequestIpcChannel(connection_id); 178 CloseSecurityKeyRequestIpcChannel(connection_id);
177 } 179 }
178 } 180 }
179 181
180 void GnubbyAuthHandlerWin::SendErrorAndCloseConnection(int connection_id) { 182 void SecurityKeyAuthHandlerWin::SendErrorAndCloseConnection(int connection_id) {
181 DCHECK(thread_checker_.CalledOnValidThread()); 183 DCHECK(thread_checker_.CalledOnValidThread());
182 184
183 SendClientResponse(connection_id, kRemoteSecurityKeyConnectionError); 185 SendClientResponse(connection_id, kSecurityKeyConnectionError);
184 CloseSecurityKeyRequestIpcChannel(connection_id); 186 CloseSecurityKeyRequestIpcChannel(connection_id);
185 } 187 }
186 188
187 void GnubbyAuthHandlerWin::SetSendMessageCallback( 189 void SecurityKeyAuthHandlerWin::SetSendMessageCallback(
188 const SendMessageCallback& callback) { 190 const SendMessageCallback& callback) {
189 DCHECK(thread_checker_.CalledOnValidThread()); 191 DCHECK(thread_checker_.CalledOnValidThread());
190 send_message_callback_ = callback; 192 send_message_callback_ = callback;
191 } 193 }
192 194
193 size_t GnubbyAuthHandlerWin::GetActiveConnectionCountForTest() const { 195 size_t SecurityKeyAuthHandlerWin::GetActiveConnectionCountForTest() const {
194 return active_channels_.size(); 196 return active_channels_.size();
195 } 197 }
196 198
197 void GnubbyAuthHandlerWin::SetRequestTimeoutForTest(base::TimeDelta timeout) { 199 void SecurityKeyAuthHandlerWin::SetRequestTimeoutForTest(
200 base::TimeDelta timeout) {
198 disconnect_timeout_ = timeout; 201 disconnect_timeout_ = timeout;
199 } 202 }
200 203
201 void GnubbyAuthHandlerWin::StartIpcServerChannel() { 204 void SecurityKeyAuthHandlerWin::StartIpcServerChannel() {
202 DCHECK(thread_checker_.CalledOnValidThread()); 205 DCHECK(thread_checker_.CalledOnValidThread());
203 206
204 // Create a named pipe owned by the current user (the LocalService account 207 // Create a named pipe owned by the current user (the LocalService account
205 // (SID: S-1-5-19) when running in the network process) which is available to 208 // (SID: S-1-5-19) when running in the network process) which is available to
206 // all authenticated users. 209 // all authenticated users.
207 // presubmit: allow wstring 210 // presubmit: allow wstring
208 std::wstring user_sid; 211 std::wstring user_sid;
209 CHECK(base::win::GetUserSidString(&user_sid)); 212 CHECK(base::win::GetUserSidString(&user_sid));
210 std::string user_sid_utf8 = base::WideToUTF8(user_sid); 213 std::string user_sid_utf8 = base::WideToUTF8(user_sid);
211 std::string security_descriptor = base::StringPrintf( 214 std::string security_descriptor = base::StringPrintf(
212 "O:%sG:%sD:(A;;GA;;;AU)", user_sid_utf8.c_str(), user_sid_utf8.c_str()); 215 "O:%sG:%sD:(A;;GA;;;AU)", user_sid_utf8.c_str(), user_sid_utf8.c_str());
213 216
214 base::win::ScopedHandle pipe; 217 base::win::ScopedHandle pipe;
215 CHECK(CreateIpcChannel(remoting::GetRemoteSecurityKeyIpcChannelName(), 218 CHECK(CreateIpcChannel(remoting::GetSecurityKeyIpcChannelName(),
216 security_descriptor, &pipe)); 219 security_descriptor, &pipe));
217 ipc_server_channel_ = 220 ipc_server_channel_ =
218 IPC::Channel::CreateNamedServer(IPC::ChannelHandle(pipe.Get()), this); 221 IPC::Channel::CreateNamedServer(IPC::ChannelHandle(pipe.Get()), this);
219 CHECK(ipc_server_channel_->Connect()); 222 CHECK(ipc_server_channel_->Connect());
220 } 223 }
221 224
222 void GnubbyAuthHandlerWin::RecreateIpcServerChannel() { 225 void SecurityKeyAuthHandlerWin::RecreateIpcServerChannel() {
223 DCHECK(thread_checker_.CalledOnValidThread()); 226 DCHECK(thread_checker_.CalledOnValidThread());
224 227
225 timer_.Stop(); 228 timer_.Stop();
226 ipc_server_channel_.reset(); 229 ipc_server_channel_.reset();
227 230
228 StartIpcServerChannel(); 231 StartIpcServerChannel();
229 } 232 }
230 233
231 void GnubbyAuthHandlerWin::CloseSecurityKeyRequestIpcChannel( 234 void SecurityKeyAuthHandlerWin::CloseSecurityKeyRequestIpcChannel(
232 int connection_id) { 235 int connection_id) {
233 active_channels_.erase(connection_id); 236 active_channels_.erase(connection_id);
234 } 237 }
235 238
236 GnubbyAuthHandlerWin::ActiveChannels::const_iterator 239 SecurityKeyAuthHandlerWin::ActiveChannels::const_iterator
237 GnubbyAuthHandlerWin::GetChannelForConnectionId(int connection_id) const { 240 SecurityKeyAuthHandlerWin::GetChannelForConnectionId(int connection_id) const {
238 return active_channels_.find(connection_id); 241 return active_channels_.find(connection_id);
239 } 242 }
240 243
241 std::string GnubbyAuthHandlerWin::GenerateUniqueChannelName() { 244 std::string SecurityKeyAuthHandlerWin::GenerateUniqueChannelName() {
242 return GetRemoteSecurityKeyIpcChannelName() + "." + 245 return GetSecurityKeyIpcChannelName() + "." +
243 IPC::Channel::GenerateUniqueRandomChannelID(); 246 IPC::Channel::GenerateUniqueRandomChannelID();
244 } 247 }
245 248
246 bool GnubbyAuthHandlerWin::OnMessageReceived(const IPC::Message& message) { 249 bool SecurityKeyAuthHandlerWin::OnMessageReceived(const IPC::Message& message) {
247 DCHECK(thread_checker_.CalledOnValidThread()); 250 DCHECK(thread_checker_.CalledOnValidThread());
248 // This class does handle any IPC messages sent by the client. 251 // This class does handle any IPC messages sent by the client.
249 return false; 252 return false;
250 } 253 }
251 254
252 void GnubbyAuthHandlerWin::OnChannelConnected(int32_t peer_pid) { 255 void SecurityKeyAuthHandlerWin::OnChannelConnected(int32_t peer_pid) {
253 DCHECK(thread_checker_.CalledOnValidThread()); 256 DCHECK(thread_checker_.CalledOnValidThread());
254 257
255 timer_.Start(FROM_HERE, disconnect_timeout_, 258 timer_.Start(FROM_HERE, disconnect_timeout_,
256 base::Bind(&GnubbyAuthHandlerWin::OnChannelError, 259 base::Bind(&SecurityKeyAuthHandlerWin::OnChannelError,
257 base::Unretained(this))); 260 base::Unretained(this)));
258 261
259 // Verify the IPC connection attempt originated from the session we are 262 // Verify the IPC connection attempt originated from the session we are
260 // currently remoting. We don't want to service requests from arbitrary 263 // currently remoting. We don't want to service requests from arbitrary
261 // Windows sessions. 264 // Windows sessions.
262 bool close_connection = false; 265 bool close_connection = false;
263 DWORD peer_session_id; 266 DWORD peer_session_id;
264 if (!ProcessIdToSessionId(peer_pid, &peer_session_id)) { 267 if (!ProcessIdToSessionId(peer_pid, &peer_session_id)) {
265 PLOG(ERROR) << "ProcessIdToSessionId() failed"; 268 PLOG(ERROR) << "ProcessIdToSessionId() failed";
266 close_connection = true; 269 close_connection = true;
267 } else if (peer_session_id != client_session_details_->desktop_session_id()) { 270 } else if (peer_session_id != client_session_details_->desktop_session_id()) {
268 LOG(INFO) << "Ignoring connection attempt from outside remoted session."; 271 LOG(INFO) << "Ignoring connection attempt from outside remoted session.";
269 close_connection = true; 272 close_connection = true;
270 } 273 }
271 if (close_connection) { 274 if (close_connection) {
272 base::ThreadTaskRunnerHandle::Get()->PostTask( 275 base::ThreadTaskRunnerHandle::Get()->PostTask(
273 FROM_HERE, base::Bind(&GnubbyAuthHandlerWin::OnChannelError, 276 FROM_HERE, base::Bind(&SecurityKeyAuthHandlerWin::OnChannelError,
274 weak_factory_.GetWeakPtr())); 277 weak_factory_.GetWeakPtr()));
275 return; 278 return;
276 } 279 }
277 280
278 int new_connection_id = ++last_connection_id_; 281 int new_connection_id = ++last_connection_id_;
279 std::unique_ptr<RemoteSecurityKeyIpcServer> ipc_server( 282 std::unique_ptr<SecurityKeyIpcServer> ipc_server(SecurityKeyIpcServer::Create(
280 RemoteSecurityKeyIpcServer::Create( 283 new_connection_id, peer_session_id, disconnect_timeout_,
281 new_connection_id, peer_session_id, disconnect_timeout_, 284 send_message_callback_,
282 send_message_callback_, 285 base::Bind(&SecurityKeyAuthHandlerWin::CloseSecurityKeyRequestIpcChannel,
283 base::Bind(&GnubbyAuthHandlerWin::CloseSecurityKeyRequestIpcChannel, 286 base::Unretained(this), new_connection_id)));
284 base::Unretained(this), new_connection_id)));
285 287
286 std::string unique_channel_name = GenerateUniqueChannelName(); 288 std::string unique_channel_name = GenerateUniqueChannelName();
287 if (ipc_server->CreateChannel( 289 if (ipc_server->CreateChannel(
288 unique_channel_name, 290 unique_channel_name,
289 base::TimeDelta::FromSeconds(kGnubbyRequestTimeoutSeconds))) { 291 base::TimeDelta::FromSeconds(kSecurityKeyRequestTimeoutSeconds))) {
290 active_channels_[new_connection_id] = std::move(ipc_server); 292 active_channels_[new_connection_id] = std::move(ipc_server);
291 ipc_server_channel_->Send( 293 ipc_server_channel_->Send(
292 new ChromotingNetworkToRemoteSecurityKeyMsg_ConnectionDetails( 294 new ChromotingNetworkToRemoteSecurityKeyMsg_ConnectionDetails(
293 unique_channel_name)); 295 unique_channel_name));
294 } 296 }
295 } 297 }
296 298
297 void GnubbyAuthHandlerWin::OnChannelError() { 299 void SecurityKeyAuthHandlerWin::OnChannelError() {
298 DCHECK(thread_checker_.CalledOnValidThread()); 300 DCHECK(thread_checker_.CalledOnValidThread());
299 301
300 // Could be an error, most likely the client disconnected though. Either way 302 // Could be an error, most likely the client disconnected though. Either way
301 // we should restart the server to prepare for the next connection. 303 // we should restart the server to prepare for the next connection.
302 RecreateIpcServerChannel(); 304 RecreateIpcServerChannel();
303 } 305 }
304 306
305 } // namespace remoting 307 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698