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

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

Issue 6594138: Block event processing on host/client until the client has authenticated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix merge conflict Created 9 years, 9 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
« no previous file with comments | « remoting/protocol/connection_to_host.cc ('k') | remoting/protocol/host_stub.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 "base/ref_counted.h" 5 #include "base/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/host_message_dispatcher.h" 10 #include "remoting/protocol/host_message_dispatcher.h"
(...skipping 30 matching lines...) Expand all
41 event_message_reader_->Init( 41 event_message_reader_->Init(
42 session->event_channel(), 42 session->event_channel(),
43 NewCallback(this, &HostMessageDispatcher::OnEventMessageReceived)); 43 NewCallback(this, &HostMessageDispatcher::OnEventMessageReceived));
44 control_message_reader_->Init( 44 control_message_reader_->Init(
45 session->control_channel(), 45 session->control_channel(),
46 NewCallback(this, &HostMessageDispatcher::OnControlMessageReceived)); 46 NewCallback(this, &HostMessageDispatcher::OnControlMessageReceived));
47 } 47 }
48 48
49 void HostMessageDispatcher::OnControlMessageReceived( 49 void HostMessageDispatcher::OnControlMessageReceived(
50 ControlMessage* message, Task* done_task) { 50 ControlMessage* message, Task* done_task) {
51 // TODO(sergeyu): Add message validation. 51 if (!host_stub_->authenticated()) {
52 if (message->has_suggest_resolution()) { 52 // When the client has not authenticated with the host, we restrict the
53 host_stub_->SuggestResolution(&message->suggest_resolution(), done_task); 53 // control messages that we support.
54 } else if (message->has_begin_session_request()) { 54 if (message->has_begin_session_request()) {
55 host_stub_->BeginSessionRequest( 55 host_stub_->BeginSessionRequest(
56 &message->begin_session_request().credentials(), done_task); 56 &message->begin_session_request().credentials(), done_task);
57 return;
58 } else {
59 LOG(WARNING) << "Invalid control message received "
60 << "(client not authenticated).";
61 }
57 } else { 62 } else {
58 LOG(WARNING) << "Invalid control message received."; 63 // TODO(sergeyu): Add message validation.
59 done_task->Run(); 64 if (message->has_suggest_resolution()) {
60 delete done_task; 65 host_stub_->SuggestResolution(&message->suggest_resolution(), done_task);
66 return;
67 } else if (message->has_begin_session_request()) {
68 LOG(WARNING) << "BeginSessionRequest sent after client already "
69 << "authorized.";
70 } else {
71 LOG(WARNING) << "Invalid control message received.";
72 }
61 } 73 }
74 done_task->Run();
75 delete done_task;
62 } 76 }
63 77
64 void HostMessageDispatcher::OnEventMessageReceived( 78 void HostMessageDispatcher::OnEventMessageReceived(
65 EventMessage* message, Task* done_task) { 79 EventMessage* message, Task* done_task) {
66 // TODO(sergeyu): Add message validation. 80 if (input_stub_->authenticated()) {
67 if (message->has_key_event()) { 81 // TODO(sergeyu): Add message validation.
68 input_stub_->InjectKeyEvent(&message->key_event(), done_task); 82 if (message->has_key_event()) {
69 } else if (message->has_mouse_event()) { 83 input_stub_->InjectKeyEvent(&message->key_event(), done_task);
70 input_stub_->InjectMouseEvent(&message->mouse_event(), done_task); 84 } else if (message->has_mouse_event()) {
71 } else { 85 input_stub_->InjectMouseEvent(&message->mouse_event(), done_task);
72 LOG(WARNING) << "Invalid event message received."; 86 } else {
73 done_task->Run(); 87 LOG(WARNING) << "Invalid event message received.";
74 delete done_task; 88 done_task->Run();
89 delete done_task;
90 }
75 } 91 }
76 } 92 }
77 93
78 } // namespace protocol 94 } // namespace protocol
79 } // namespace remoting 95 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_host.cc ('k') | remoting/protocol/host_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698