OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/negotiating_host_authenticator.h" | 5 #include "remoting/protocol/negotiating_host_authenticator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (supported_methods_attr.empty()) { | 92 if (supported_methods_attr.empty()) { |
93 // Message contains neither method nor supported-methods attributes. | 93 // Message contains neither method nor supported-methods attributes. |
94 state_ = REJECTED; | 94 state_ = REJECTED; |
95 rejection_reason_ = PROTOCOL_ERROR; | 95 rejection_reason_ = PROTOCOL_ERROR; |
96 resume_callback.Run(); | 96 resume_callback.Run(); |
97 return; | 97 return; |
98 } | 98 } |
99 | 99 |
100 // Find the first mutually-supported method in the client's list of | 100 // Find the first mutually-supported method in the client's list of |
101 // supported-methods. | 101 // supported-methods. |
102 for (const std::string& method_str : | 102 std::vector<std::string> supported_methods_strs; |
103 base::SplitString(supported_methods_attr, | 103 base::SplitString(supported_methods_attr, kSupportedMethodsSeparator, |
104 std::string(1, kSupportedMethodsSeparator), | 104 &supported_methods_strs); |
105 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { | 105 for (std::vector<std::string>::iterator it = supported_methods_strs.begin(); |
106 AuthenticationMethod list_value = | 106 it != supported_methods_strs.end(); ++it) { |
107 AuthenticationMethod::FromString(method_str); | 107 AuthenticationMethod list_value = AuthenticationMethod::FromString(*it); |
108 if (list_value.is_valid() && | 108 if (list_value.is_valid() && |
109 std::find(methods_.begin(), | 109 std::find(methods_.begin(), |
110 methods_.end(), list_value) != methods_.end()) { | 110 methods_.end(), list_value) != methods_.end()) { |
111 // Found common method. | 111 // Found common method. |
112 method = list_value; | 112 method = list_value; |
113 break; | 113 break; |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 if (!method.is_valid()) { | 117 if (!method.is_valid()) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 current_method_.type() == AuthenticationMethod::SPAKE2_PAIR); | 181 current_method_.type() == AuthenticationMethod::SPAKE2_PAIR); |
182 current_authenticator_ = V2Authenticator::CreateForHost( | 182 current_authenticator_ = V2Authenticator::CreateForHost( |
183 local_cert_, local_key_pair_, shared_secret_hash_, | 183 local_cert_, local_key_pair_, shared_secret_hash_, |
184 preferred_initial_state); | 184 preferred_initial_state); |
185 } | 185 } |
186 resume_callback.Run(); | 186 resume_callback.Run(); |
187 } | 187 } |
188 | 188 |
189 } // namespace protocol | 189 } // namespace protocol |
190 } // namespace remoting | 190 } // namespace remoting |
OLD | NEW |