OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "net/tools/transport_security_state_generator/input_file_parsers.h" | 5 #include "net/tools/transport_security_state_generator/input_file_parsers.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 296 |
297 std::unique_ptr<TransportSecurityStateEntry> entry( | 297 std::unique_ptr<TransportSecurityStateEntry> entry( |
298 new TransportSecurityStateEntry()); | 298 new TransportSecurityStateEntry()); |
299 | 299 |
300 if (!parsed->GetString("name", &entry->hostname)) { | 300 if (!parsed->GetString("name", &entry->hostname)) { |
301 LOG(ERROR) << "Could not extract the hostname for entry " | 301 LOG(ERROR) << "Could not extract the hostname for entry " |
302 << base::SizeTToString(i) << " from the input JSON"; | 302 << base::SizeTToString(i) << " from the input JSON"; |
303 return false; | 303 return false; |
304 } | 304 } |
305 | 305 |
| 306 if (entry->hostname.empty()) { |
| 307 LOG(ERROR) << "The hostname for entry " << base::SizeTToString(i) |
| 308 << " is empty"; |
| 309 return false; |
| 310 } |
| 311 |
306 parsed->GetBoolean("include_subdomains", &entry->include_subdomains); | 312 parsed->GetBoolean("include_subdomains", &entry->include_subdomains); |
307 std::string mode; | 313 std::string mode; |
308 parsed->GetString("mode", &mode); | 314 parsed->GetString("mode", &mode); |
309 entry->force_https = (mode == "force-https"); | 315 entry->force_https = (mode == "force-https"); |
310 parsed->GetBoolean("include_subdomains_for_pinning", | 316 parsed->GetBoolean("include_subdomains_for_pinning", |
311 &entry->hpkp_include_subdomains); | 317 &entry->hpkp_include_subdomains); |
312 parsed->GetString("pins", &entry->pinset); | 318 parsed->GetString("pins", &entry->pinset); |
313 parsed->GetBoolean("expect_ct", &entry->expect_ct); | 319 parsed->GetBoolean("expect_ct", &entry->expect_ct); |
314 parsed->GetString("expect_ct_report_uri", &entry->expect_ct_report_uri); | 320 parsed->GetString("expect_ct_report_uri", &entry->expect_ct_report_uri); |
315 parsed->GetBoolean("expect_staple", &entry->expect_staple); | 321 parsed->GetBoolean("expect_staple", &entry->expect_staple); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 374 |
369 pinsets->RegisterPinset(std::move(pinset)); | 375 pinsets->RegisterPinset(std::move(pinset)); |
370 } | 376 } |
371 | 377 |
372 return true; | 378 return true; |
373 } | 379 } |
374 | 380 |
375 } // namespace transport_security_state | 381 } // namespace transport_security_state |
376 | 382 |
377 } // namespace net | 383 } // namespace net |
OLD | NEW |