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

Side by Side Diff: remoting/host/chromoting_host.cc

Issue 3303001: Basic user access check for chromoting host. (Closed)
Patch Set: - Created 10 years, 3 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
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/heartbeat_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/chromoting_host.h" 5 #include "remoting/host/chromoting_host.h"
6 6
7 #include "base/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "remoting/base/constants.h" 10 #include "remoting/base/constants.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 AutoLock auto_lock(lock_); 161 AutoLock auto_lock(lock_);
162 if (state_ != kStarted) 162 if (state_ != kStarted)
163 return false; 163 return false;
164 164
165 DCHECK_EQ(jingle_client_.get(), jingle_client); 165 DCHECK_EQ(jingle_client_.get(), jingle_client);
166 166
167 // TODO(hclam): Allow multiple clients to connect to the host. 167 // TODO(hclam): Allow multiple clients to connect to the host.
168 if (client_.get()) 168 if (client_.get())
169 return false; 169 return false;
170 170
171 // Check that the user has access to the host.
172 if (!access_verifier_.VerifyPermissions(jid))
173 return false;
174
171 LOG(INFO) << "Client connected: " << jid << std::endl; 175 LOG(INFO) << "Client connected: " << jid << std::endl;
172 176
173 // If we accept the connected then create a client object and set the 177 // If we accept the connected then create a client object and set the
174 // callback. 178 // callback.
175 client_ = new ClientConnection(context_->main_message_loop(), 179 client_ = new ClientConnection(context_->main_message_loop(),
176 new ProtocolDecoder(), this); 180 new ProtocolDecoder(), this);
177 *channel_callback = client_.get(); 181 *channel_callback = client_.get();
178 return true; 182 return true;
179 } 183 }
180 184
(...skipping 24 matching lines...) Expand all
205 state_ = kStarted; 209 state_ = kStarted;
206 } 210 }
207 211
208 // Save the shutdown task. 212 // Save the shutdown task.
209 shutdown_task_.reset(shutdown_task); 213 shutdown_task_.reset(shutdown_task);
210 214
211 std::string xmpp_login; 215 std::string xmpp_login;
212 std::string xmpp_auth_token; 216 std::string xmpp_auth_token;
213 if (!config_->GetString(kXmppLoginConfigPath, &xmpp_login) || 217 if (!config_->GetString(kXmppLoginConfigPath, &xmpp_login) ||
214 !config_->GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token)) { 218 !config_->GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token)) {
215 LOG(ERROR) << "XMMP credentials are not defined in config."; 219 LOG(ERROR) << "XMPP credentials are not defined in the config.";
216 return; 220 return;
217 } 221 }
218 222
223 if (!access_verifier_.Init(config_))
224 return;
225
219 // Connect to the talk network with a JingleClient. 226 // Connect to the talk network with a JingleClient.
220 jingle_client_ = new JingleClient(context_->jingle_thread()); 227 jingle_client_ = new JingleClient(context_->jingle_thread());
221 jingle_client_->Init(xmpp_login, xmpp_auth_token, 228 jingle_client_->Init(xmpp_login, xmpp_auth_token,
222 kChromotingTokenServiceName, this); 229 kChromotingTokenServiceName, this);
223 230
224 heartbeat_sender_ = new HeartbeatSender(); 231 heartbeat_sender_ = new HeartbeatSender();
225 if (!heartbeat_sender_->Init(config_, jingle_client_.get())) { 232 if (!heartbeat_sender_->Init(config_, jingle_client_.get())) {
226 LOG(ERROR) << "Failed to initialize HeartbeatSender."; 233 LOG(ERROR) << "Failed to initialize HeartbeatSender.";
227 return; 234 return;
228 } 235 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 heartbeat_sender_->Stop(); 267 heartbeat_sender_->Stop();
261 } 268 }
262 269
263 // Lastly call the shutdown task. 270 // Lastly call the shutdown task.
264 if (shutdown_task_.get()) { 271 if (shutdown_task_.get()) {
265 shutdown_task_->Run(); 272 shutdown_task_->Run();
266 } 273 }
267 } 274 }
268 275
269 } // namespace remoting 276 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/heartbeat_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698