| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/gnubby_auth_handler_posix.h" | 5 #include "remoting/host/gnubby_auth_handler_posix.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 7 #include <unistd.h> | 8 #include <unistd.h> |
| 8 #include <utility> | 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 12 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 13 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
| 14 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 const char kConnectionId[] = "connectionId"; | 31 const char kConnectionId[] = "connectionId"; |
| 31 const char kControlMessage[] = "control"; | 32 const char kControlMessage[] = "control"; |
| 32 const char kControlOption[] = "option"; | 33 const char kControlOption[] = "option"; |
| 33 const char kDataMessage[] = "data"; | 34 const char kDataMessage[] = "data"; |
| 34 const char kDataPayload[] = "data"; | 35 const char kDataPayload[] = "data"; |
| 35 const char kErrorMessage[] = "error"; | 36 const char kErrorMessage[] = "error"; |
| 36 const char kGnubbyAuthMessage[] = "gnubby-auth"; | 37 const char kGnubbyAuthMessage[] = "gnubby-auth"; |
| 37 const char kGnubbyAuthV1[] = "auth-v1"; | 38 const char kGnubbyAuthV1[] = "auth-v1"; |
| 38 const char kMessageType[] = "type"; | 39 const char kMessageType[] = "type"; |
| 39 | 40 |
| 40 const int64 kDefaultRequestTimeoutSeconds = 60; | 41 const int64_t kDefaultRequestTimeoutSeconds = 60; |
| 41 | 42 |
| 42 // The name of the socket to listen for gnubby requests on. | 43 // The name of the socket to listen for gnubby requests on. |
| 43 base::LazyInstance<base::FilePath>::Leaky g_gnubby_socket_name = | 44 base::LazyInstance<base::FilePath>::Leaky g_gnubby_socket_name = |
| 44 LAZY_INSTANCE_INITIALIZER; | 45 LAZY_INSTANCE_INITIALIZER; |
| 45 | 46 |
| 46 // Socket authentication function that only allows connections from callers with | 47 // Socket authentication function that only allows connections from callers with |
| 47 // the current uid. | 48 // the current uid. |
| 48 bool MatchUid(const net::UnixDomainServerSocket::Credentials& credentials) { | 49 bool MatchUid(const net::UnixDomainServerSocket::Credentials& credentials) { |
| 49 bool allowed = credentials.user_id == getuid(); | 50 bool allowed = credentials.user_id == getuid(); |
| 50 if (!allowed) | 51 if (!allowed) |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 293 } |
| 293 | 294 |
| 294 void GnubbyAuthHandlerPosix::RequestTimedOut(int connection_id) { | 295 void GnubbyAuthHandlerPosix::RequestTimedOut(int connection_id) { |
| 295 HOST_LOG << "Gnubby request timed out"; | 296 HOST_LOG << "Gnubby request timed out"; |
| 296 ActiveSockets::iterator iter = active_sockets_.find(connection_id); | 297 ActiveSockets::iterator iter = active_sockets_.find(connection_id); |
| 297 if (iter != active_sockets_.end()) | 298 if (iter != active_sockets_.end()) |
| 298 SendErrorAndCloseActiveSocket(iter); | 299 SendErrorAndCloseActiveSocket(iter); |
| 299 } | 300 } |
| 300 | 301 |
| 301 } // namespace remoting | 302 } // namespace remoting |
| OLD | NEW |