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

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

Issue 2085353004: Update GnubbyAuthHandler to use the current session ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host_extension
Patch Set: Fixing a non-windows build break and some additional cleanup 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/gnubby_auth_handler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 private: 59 private:
60 typedef std::map<int, GnubbySocket*> ActiveSockets; 60 typedef std::map<int, GnubbySocket*> ActiveSockets;
61 61
62 // GnubbyAuthHandler interface. 62 // GnubbyAuthHandler interface.
63 void CreateGnubbyConnection() override; 63 void CreateGnubbyConnection() override;
64 bool IsValidConnectionId(int gnubby_connection_id) const override; 64 bool IsValidConnectionId(int gnubby_connection_id) const override;
65 void SendClientResponse(int gnubby_connection_id, 65 void SendClientResponse(int gnubby_connection_id,
66 const std::string& response) override; 66 const std::string& response) override;
67 void SendErrorAndCloseConnection(int gnubby_connection_id) override; 67 void SendErrorAndCloseConnection(int gnubby_connection_id) override;
68 void SetSendMessageCallback(const SendMessageCallback& callback) override; 68 void SetSendMessageCallback(const SendMessageCallback& callback) override;
69 void SetSessionIdCallback(const SessionIdCallback& callback) override;
69 size_t GetActiveConnectionCountForTest() const override; 70 size_t GetActiveConnectionCountForTest() const override;
70 void SetRequestTimeoutForTest(base::TimeDelta timeout) override; 71 void SetRequestTimeoutForTest(base::TimeDelta timeout) override;
71 72
72 // Starts listening for connection. 73 // Starts listening for connection.
73 void DoAccept(); 74 void DoAccept();
74 75
75 // Called when a connection is accepted. 76 // Called when a connection is accepted.
76 void OnAccepted(int result); 77 void OnAccepted(int result);
77 78
78 // Called when a GnubbySocket has done reading. 79 // Called when a GnubbySocket has done reading.
(...skipping 27 matching lines...) Expand all
106 // Sockets by connection id used to process gnubbyd requests. 107 // Sockets by connection id used to process gnubbyd requests.
107 ActiveSockets active_sockets_; 108 ActiveSockets active_sockets_;
108 109
109 // Timeout used for a request. 110 // Timeout used for a request.
110 base::TimeDelta request_timeout_; 111 base::TimeDelta request_timeout_;
111 112
112 DISALLOW_COPY_AND_ASSIGN(GnubbyAuthHandlerLinux); 113 DISALLOW_COPY_AND_ASSIGN(GnubbyAuthHandlerLinux);
113 }; 114 };
114 115
115 std::unique_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create( 116 std::unique_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create(
116 const SendMessageCallback& callback) { 117 const SendMessageCallback& send_message_callback,
118 const SessionIdCallback& session_id_callback) {
117 std::unique_ptr<GnubbyAuthHandler> auth_handler(new GnubbyAuthHandlerLinux()); 119 std::unique_ptr<GnubbyAuthHandler> auth_handler(new GnubbyAuthHandlerLinux());
118 auth_handler->SetSendMessageCallback(callback); 120 auth_handler->SetSendMessageCallback(send_message_callback);
119 return auth_handler; 121 return auth_handler;
120 } 122 }
121 123
122 void GnubbyAuthHandler::SetGnubbySocketName( 124 void GnubbyAuthHandler::SetGnubbySocketName(
123 const base::FilePath& gnubby_socket_name) { 125 const base::FilePath& gnubby_socket_name) {
124 g_gnubby_socket_name.Get() = gnubby_socket_name; 126 g_gnubby_socket_name.Get() = gnubby_socket_name;
125 } 127 }
126 128
127 GnubbyAuthHandlerLinux::GnubbyAuthHandlerLinux() 129 GnubbyAuthHandlerLinux::GnubbyAuthHandlerLinux()
128 : last_connection_id_(0), 130 : last_connection_id_(0),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 LOG(WARNING) << "Unknown gnubby-auth data connection: '" 194 LOG(WARNING) << "Unknown gnubby-auth data connection: '"
193 << gnubby_connection_id << "'"; 195 << gnubby_connection_id << "'";
194 } 196 }
195 } 197 }
196 198
197 void GnubbyAuthHandlerLinux::SetSendMessageCallback( 199 void GnubbyAuthHandlerLinux::SetSendMessageCallback(
198 const SendMessageCallback& callback) { 200 const SendMessageCallback& callback) {
199 send_message_callback_ = callback; 201 send_message_callback_ = callback;
200 } 202 }
201 203
204 void GnubbyAuthHandlerLinux::SetSessionIdCallback(
205 const SessionIdCallback& callback) {
206 // SessionIdCallback is not currently used for this platform.
207 NOTREACHED();
208 }
209
202 size_t GnubbyAuthHandlerLinux::GetActiveConnectionCountForTest() const { 210 size_t GnubbyAuthHandlerLinux::GetActiveConnectionCountForTest() const {
203 return active_sockets_.size(); 211 return active_sockets_.size();
204 } 212 }
205 213
206 void GnubbyAuthHandlerLinux::SetRequestTimeoutForTest(base::TimeDelta timeout) { 214 void GnubbyAuthHandlerLinux::SetRequestTimeoutForTest(base::TimeDelta timeout) {
207 request_timeout_ = timeout; 215 request_timeout_ = timeout;
208 } 216 }
209 217
210 void GnubbyAuthHandlerLinux::DoAccept() { 218 void GnubbyAuthHandlerLinux::DoAccept() {
211 int result = auth_socket_->Accept( 219 int result = auth_socket_->Accept(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 281
274 void GnubbyAuthHandlerLinux::RequestTimedOut(int gnubby_connection_id) { 282 void GnubbyAuthHandlerLinux::RequestTimedOut(int gnubby_connection_id) {
275 HOST_LOG << "Gnubby request timed out"; 283 HOST_LOG << "Gnubby request timed out";
276 ActiveSockets::const_iterator iter = 284 ActiveSockets::const_iterator iter =
277 active_sockets_.find(gnubby_connection_id); 285 active_sockets_.find(gnubby_connection_id);
278 if (iter != active_sockets_.end()) 286 if (iter != active_sockets_.end())
279 SendErrorAndCloseActiveSocket(iter); 287 SendErrorAndCloseActiveSocket(iter);
280 } 288 }
281 289
282 } // namespace remoting 290 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698