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

Side by Side Diff: net/base/x509_cert_types.cc

Issue 3412016: FBTF: Move a bunch of code to the headers and remove includes. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Rebase + fixed windows issues locally Created 10 years, 3 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 | « net/base/x509_cert_types.h ('k') | net/http/http_stream_parser.h » ('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) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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/base/x509_cert_types.h" 5 #include "net/base/x509_cert_types.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "net/base/x509_certificate.h" 9 #include "net/base/x509_certificate.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 18 matching lines...) Expand all
29 for (i2 = 0; i2 < rdn2.size(); ++i2) { 29 for (i2 = 0; i2 < rdn2.size(); ++i2) {
30 if (match(rdn1[i1], rdn2[i2])) 30 if (match(rdn1[i1], rdn2[i2]))
31 break; 31 break;
32 } 32 }
33 if (i2 == rdn2.size()) 33 if (i2 == rdn2.size())
34 return false; 34 return false;
35 } 35 }
36 return true; 36 return true;
37 } 37 }
38 38
39 CertPrincipal::CertPrincipal() {
40 }
41
42 CertPrincipal::CertPrincipal(const std::string& name) : common_name(name) {}
43
44 CertPrincipal::~CertPrincipal() {
45 }
39 46
40 bool CertPrincipal::Matches(const CertPrincipal& against) const { 47 bool CertPrincipal::Matches(const CertPrincipal& against) const {
41 return match(common_name, against.common_name) && 48 return match(common_name, against.common_name) &&
42 match(common_name, against.common_name) && 49 match(common_name, against.common_name) &&
43 match(locality_name, against.locality_name) && 50 match(locality_name, against.locality_name) &&
44 match(state_or_province_name, against.state_or_province_name) && 51 match(state_or_province_name, against.state_or_province_name) &&
45 match(country_name, against.country_name) && 52 match(country_name, against.country_name) &&
46 match(street_addresses, against.street_addresses) && 53 match(street_addresses, against.street_addresses) &&
47 match(organization_names, against.organization_names) && 54 match(organization_names, against.organization_names) &&
48 match(organization_unit_names, against.organization_unit_names) && 55 match(organization_unit_names, against.organization_unit_names) &&
(...skipping 25 matching lines...) Expand all
74 s << "ou=\"" << p.organization_unit_names[i] << "\" "; 81 s << "ou=\"" << p.organization_unit_names[i] << "\" ";
75 if (!p.state_or_province_name.empty()) 82 if (!p.state_or_province_name.empty())
76 s << "st=\"" << p.state_or_province_name << "\" "; 83 s << "st=\"" << p.state_or_province_name << "\" ";
77 if (!p.country_name.empty()) 84 if (!p.country_name.empty())
78 s << "c=\"" << p.country_name << "\" "; 85 s << "c=\"" << p.country_name << "\" ";
79 for (unsigned i = 0; i < p.domain_components.size(); ++i) 86 for (unsigned i = 0; i < p.domain_components.size(); ++i)
80 s << "dc=\"" << p.domain_components[i] << "\" "; 87 s << "dc=\"" << p.domain_components[i] << "\" ";
81 return s << "]"; 88 return s << "]";
82 } 89 }
83 90
91 CertPolicy::CertPolicy() {
92 }
93
94 CertPolicy::~CertPolicy() {
95 }
96
84 CertPolicy::Judgment CertPolicy::Check( 97 CertPolicy::Judgment CertPolicy::Check(
85 X509Certificate* cert) const { 98 X509Certificate* cert) const {
86 // It shouldn't matter which set we check first, but we check denied first 99 // It shouldn't matter which set we check first, but we check denied first
87 // in case something strange has happened. 100 // in case something strange has happened.
88 101
89 if (denied_.find(cert->fingerprint()) != denied_.end()) { 102 if (denied_.find(cert->fingerprint()) != denied_.end()) {
90 // DCHECK that the order didn't matter. 103 // DCHECK that the order didn't matter.
91 DCHECK(allowed_.find(cert->fingerprint()) == allowed_.end()); 104 DCHECK(allowed_.find(cert->fingerprint()) == allowed_.end());
92 return DENIED; 105 return DENIED;
93 } 106 }
(...skipping 22 matching lines...) Expand all
116 129
117 bool CertPolicy::HasAllowedCert() const { 130 bool CertPolicy::HasAllowedCert() const {
118 return !allowed_.empty(); 131 return !allowed_.empty();
119 } 132 }
120 133
121 bool CertPolicy::HasDeniedCert() const { 134 bool CertPolicy::HasDeniedCert() const {
122 return !denied_.empty(); 135 return !denied_.empty();
123 } 136 }
124 137
125 } // namespace net 138 } // namespace net
OLDNEW
« no previous file with comments | « net/base/x509_cert_types.h ('k') | net/http/http_stream_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698