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

Side by Side Diff: remoting/protocol/client_message_dispatcher.cc

Issue 6724033: Remove authenticated_ fields from stubs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak. Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "net/base/io_buffer.h" 6 #include "net/base/io_buffer.h"
7 #include "remoting/proto/control.pb.h" 7 #include "remoting/proto/control.pb.h"
8 #include "remoting/proto/event.pb.h" 8 #include "remoting/proto/event.pb.h"
9 #include "remoting/proto/internal.pb.h" 9 #include "remoting/proto/internal.pb.h"
10 #include "remoting/protocol/client_message_dispatcher.h" 10 #include "remoting/protocol/client_message_dispatcher.h"
(...skipping 21 matching lines...) Expand all
32 client_stub_ = client_stub; 32 client_stub_ = client_stub;
33 33
34 control_message_reader_->Init( 34 control_message_reader_->Init(
35 session->control_channel(), 35 session->control_channel(),
36 NewCallback(this, &ClientMessageDispatcher::OnControlMessageReceived)); 36 NewCallback(this, &ClientMessageDispatcher::OnControlMessageReceived));
37 return; 37 return;
38 } 38 }
39 39
40 void ClientMessageDispatcher::OnControlMessageReceived( 40 void ClientMessageDispatcher::OnControlMessageReceived(
41 ControlMessage* message, Task* done_task) { 41 ControlMessage* message, Task* done_task) {
42 if (!client_stub_->authenticated()) { 42 // TODO(sergeyu): Add message validation.
43 // When the client has not authenticated with the host, we restrict the 43 if (message->has_notify_resolution()) {
44 // control messages that we support. 44 client_stub_->NotifyResolution(
45 if (message->has_begin_session_response()) { 45 &message->notify_resolution(), done_task);
46 client_stub_->BeginSessionResponse( 46 return;
47 &message->begin_session_response().login_status(), done_task); 47 } else if (message->has_begin_session_response()) {
48 return; 48 client_stub_->BeginSessionResponse(
49 } else { 49 &message->begin_session_response().login_status(), done_task);
50 LOG(WARNING) << "Invalid control message received " 50 return;
51 << "(client not authenticated).";
52 }
53 } else { 51 } else {
54 // TODO(sergeyu): Add message validation. 52 LOG(WARNING) << "Invalid control message received.";
Wez 2011/03/30 20:24:57 If not authenticated, disconnect?
simonmorris 2011/03/31 11:14:00 Could be good, in another CL.
55 if (message->has_notify_resolution()) {
56 client_stub_->NotifyResolution(
57 &message->notify_resolution(), done_task);
58 return;
59 } else if (message->has_begin_session_response()) {
60 LOG(WARNING) << "BeginSessionResponse sent after client already "
61 << "authorized.";
62 } else {
63 LOG(WARNING) << "Invalid control message received.";
64 }
65 } 53 }
54
66 done_task->Run(); 55 done_task->Run();
67 delete done_task; 56 delete done_task;
68 } 57 }
69 58
70 } // namespace protocol 59 } // namespace protocol
71 } // namespace remoting 60 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698