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

Side by Side Diff: chromeos/network/managed_network_configuration_handler_impl.cc

Issue 884013007: MNCH: Check result before accessing validated_user_settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chromeos/network/managed_network_configuration_handler_impl.h" 5 #include "chromeos/network/managed_network_configuration_handler_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 false, // Ignore invalid recommended field names. 281 false, // Ignore invalid recommended field names.
282 false, // Ignore missing fields. 282 false, // Ignore missing fields.
283 false); // This ONC does not come from policy. 283 false); // This ONC does not come from policy.
284 284
285 onc::Validator::Result validation_result; 285 onc::Validator::Result validation_result;
286 scoped_ptr<base::DictionaryValue> validated_user_settings = 286 scoped_ptr<base::DictionaryValue> validated_user_settings =
287 validator.ValidateAndRepairObject( 287 validator.ValidateAndRepairObject(
288 &onc::kNetworkConfigurationSignature, 288 &onc::kNetworkConfigurationSignature,
289 *user_settings_copy, 289 *user_settings_copy,
290 &validation_result); 290 &validation_result);
291
292 // Fill in HexSSID field from contents of SSID field if not set already.
293 if (user_settings_copy) {
294 onc::FillInHexSSIDFieldsInOncObject(
295 onc::kNetworkConfigurationSignature, validated_user_settings.get());
296 }
297
298
299 if (validation_result == onc::Validator::INVALID) { 291 if (validation_result == onc::Validator::INVALID) {
300 InvokeErrorCallback(service_path, error_callback, kInvalidUserSettings); 292 InvokeErrorCallback(service_path, error_callback, kInvalidUserSettings);
301 return; 293 return;
302 } 294 }
303 if (validation_result == onc::Validator::VALID_WITH_WARNINGS) 295 if (validation_result == onc::Validator::VALID_WITH_WARNINGS)
304 LOG(WARNING) << "Validation of ONC user settings produced warnings."; 296 LOG(WARNING) << "Validation of ONC user settings produced warnings.";
305 297
298 // Fill in HexSSID field from contents of SSID field if not set already.
299 if (user_settings_copy) {
300 onc::FillInHexSSIDFieldsInOncObject(onc::kNetworkConfigurationSignature,
301 validated_user_settings.get());
302 }
303
306 const base::DictionaryValue* network_policy = 304 const base::DictionaryValue* network_policy =
307 GetByGUID(policies->per_network_config, guid); 305 GetByGUID(policies->per_network_config, guid);
308 VLOG(2) << "This configuration is " << (network_policy ? "" : "not ") 306 VLOG(2) << "This configuration is " << (network_policy ? "" : "not ")
309 << "managed."; 307 << "managed.";
310 308
311 scoped_ptr<base::DictionaryValue> shill_dictionary( 309 scoped_ptr<base::DictionaryValue> shill_dictionary(
312 policy_util::CreateShillConfiguration(*profile, 310 policy_util::CreateShillConfiguration(*profile,
313 guid, 311 guid,
314 &policies->global_network_config, 312 &policies->global_network_config,
315 network_policy, 313 network_policy,
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 scoped_ptr<base::DictionaryValue> network_properties, 809 scoped_ptr<base::DictionaryValue> network_properties,
812 GetDevicePropertiesCallback send_callback, 810 GetDevicePropertiesCallback send_callback,
813 const std::string& error_name, 811 const std::string& error_name,
814 scoped_ptr<base::DictionaryValue> error_data) { 812 scoped_ptr<base::DictionaryValue> error_data) {
815 NET_LOG_ERROR("Error getting device properties", service_path); 813 NET_LOG_ERROR("Error getting device properties", service_path);
816 send_callback.Run(service_path, network_properties.Pass()); 814 send_callback.Run(service_path, network_properties.Pass());
817 } 815 }
818 816
819 817
820 } // namespace chromeos 818 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698