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

Side by Side Diff: chromeos/network/onc/onc_validator.h

Issue 166903002: Identify and repair ONC files with duplicate GUIDs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Issue_23567011
Patch Set: Identify and repair ONC files with duplicate GUIDs Created 6 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 | chromeos/network/onc/onc_validator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_
6 #define CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ 6 #define CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_
7 7
8 #include <set>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "chromeos/chromeos_export.h" 13 #include "chromeos/chromeos_export.h"
13 #include "chromeos/network/onc/onc_mapper.h" 14 #include "chromeos/network/onc/onc_mapper.h"
14 #include "components/onc/onc_constants.h" 15 #include "components/onc/onc_constants.h"
15 16
16 namespace base { 17 namespace base {
17 class DictionaryValue; 18 class DictionaryValue;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 bool FieldExistsAndIsNotInRange(const base::DictionaryValue& object, 168 bool FieldExistsAndIsNotInRange(const base::DictionaryValue& object,
168 const std::string &field_name, 169 const std::string &field_name,
169 int lower_bound, 170 int lower_bound,
170 int upper_bound); 171 int upper_bound);
171 172
172 bool FieldExistsAndIsEmpty(const base::DictionaryValue& object, 173 bool FieldExistsAndIsEmpty(const base::DictionaryValue& object,
173 const std::string& field_name); 174 const std::string& field_name);
174 175
175 bool RequireField(const base::DictionaryValue& dict, const std::string& key); 176 bool RequireField(const base::DictionaryValue& dict, const std::string& key);
176 177
178 // Returns true if the GUID is unique or if the GUID is not a string
179 // and false otherwise. The function also adds the GUID to a set in
180 // order to identify duplicates.
181 bool CheckGuidIsUniqueAndAddToSet(const base::DictionaryValue& dict,
182 const std::string& kGUID,
183 std::set<std::string> *guids);
184
177 // Prohibit certificate patterns for device policy ONC so that an unmanaged 185 // Prohibit certificate patterns for device policy ONC so that an unmanaged
178 // user won't have a certificate presented for them involuntarily. 186 // user won't have a certificate presented for them involuntarily.
179 bool IsCertPatternInDevicePolicy(const std::string& cert_type); 187 bool IsCertPatternInDevicePolicy(const std::string& cert_type);
180 188
181 // Prohibit global network configuration in user ONC imports. 189 // Prohibit global network configuration in user ONC imports.
182 bool IsGlobalNetworkConfigInUserImport( 190 bool IsGlobalNetworkConfigInUserImport(
183 const base::DictionaryValue& onc_object); 191 const base::DictionaryValue& onc_object);
184 192
185 std::string MessageHeader(); 193 std::string MessageHeader();
186 194
187 const bool error_on_unknown_field_; 195 const bool error_on_unknown_field_;
188 const bool error_on_wrong_recommended_; 196 const bool error_on_wrong_recommended_;
189 const bool error_on_missing_field_; 197 const bool error_on_missing_field_;
190 const bool managed_onc_; 198 const bool managed_onc_;
191 199
192 ::onc::ONCSource onc_source_; 200 ::onc::ONCSource onc_source_;
193 201
194 // The path of field names and indices to the current value. Indices 202 // The path of field names and indices to the current value. Indices
195 // are stored as strings in decimal notation. 203 // are stored as strings in decimal notation.
196 std::vector<std::string> path_; 204 std::vector<std::string> path_;
197 205
206 // Accumulates all network GUIDs during validation. Used to identify
207 // duplicate GUIDs.
208 std::set<std::string> network_guids_;
209
210 // Accumulates all certificate GUIDs during validation. Used to identify
211 // duplicate GUIDs.
212 std::set<std::string> certificate_guids_;
213
198 // Tracks if an error or warning occurred within validation initiated by 214 // Tracks if an error or warning occurred within validation initiated by
199 // function ValidateAndRepairObject. 215 // function ValidateAndRepairObject.
200 bool error_or_warning_found_; 216 bool error_or_warning_found_;
201 217
202 DISALLOW_COPY_AND_ASSIGN(Validator); 218 DISALLOW_COPY_AND_ASSIGN(Validator);
203 }; 219 };
204 220
205 } // namespace onc 221 } // namespace onc
206 } // namespace chromeos 222 } // namespace chromeos
207 223
208 #endif // CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ 224 #endif // CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/network/onc/onc_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698