OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/protocol/me2me_host_authenticator_factory.h" | 5 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // the host owner email. Figure out a way to verify the JID in other cases. | 88 // the host owner email. Figure out a way to verify the JID in other cases. |
89 remote_jid_prefix = host_owner_; | 89 remote_jid_prefix = host_owner_; |
90 } | 90 } |
91 | 91 |
92 // Verify that the client's jid is an ASCII string, and then check that the | 92 // Verify that the client's jid is an ASCII string, and then check that the |
93 // client JID has the expected prefix. Comparison is case insensitive. | 93 // client JID has the expected prefix. Comparison is case insensitive. |
94 if (!base::IsStringASCII(remote_jid) || | 94 if (!base::IsStringASCII(remote_jid) || |
95 !base::StartsWith(remote_jid, remote_jid_prefix + '/', | 95 !base::StartsWith(remote_jid, remote_jid_prefix + '/', |
96 base::CompareCase::INSENSITIVE_ASCII)) { | 96 base::CompareCase::INSENSITIVE_ASCII)) { |
97 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid | 97 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid |
98 << ": Prefix mismatch."; | 98 << ": Prefix mismatch. Expected: " << remote_jid_prefix; |
99 return base::WrapUnique( | 99 return base::WrapUnique( |
100 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); | 100 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); |
101 } | 101 } |
102 | 102 |
103 // If necessary, verify that the client's jid belongs to the correct domain. | 103 // If necessary, verify that the client's jid belongs to the correct domain. |
104 if (!required_client_domain_.empty()) { | 104 if (!required_client_domain_.empty()) { |
105 std::string client_username = remote_jid; | 105 std::string client_username = remote_jid; |
106 size_t pos = client_username.find('/'); | 106 size_t pos = client_username.find('/'); |
107 if (pos != std::string::npos) { | 107 if (pos != std::string::npos) { |
108 client_username.replace(pos, std::string::npos, ""); | 108 client_username.replace(pos, std::string::npos, ""); |
(...skipping 22 matching lines...) Expand all Loading... |
131 normalized_local_jid, normalized_remote_jid, local_cert_, key_pair_, | 131 normalized_local_jid, normalized_remote_jid, local_cert_, key_pair_, |
132 pin_hash_, pairing_registry_); | 132 pin_hash_, pairing_registry_); |
133 } | 133 } |
134 | 134 |
135 return base::WrapUnique( | 135 return base::WrapUnique( |
136 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); | 136 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); |
137 } | 137 } |
138 | 138 |
139 } // namespace protocol | 139 } // namespace protocol |
140 } // namespace remoting | 140 } // namespace remoting |
OLD | NEW |