OLD | NEW |
1 /* ***** BEGIN LICENSE BLOCK ***** | 1 /* ***** BEGIN LICENSE BLOCK ***** |
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
3 * | 3 * |
4 * The contents of this file are subject to the Mozilla Public License Version | 4 * The contents of this file are subject to the Mozilla Public License Version |
5 * 1.1 (the "License"); you may not use this file except in compliance with | 5 * 1.1 (the "License"); you may not use this file except in compliance with |
6 * the License. You may obtain a copy of the License at | 6 * the License. You may obtain a copy of the License at |
7 * http://www.mozilla.org/MPL/ | 7 * http://www.mozilla.org/MPL/ |
8 * | 8 * |
9 * Software distributed under the License is distributed on an "AS IS" basis, | 9 * Software distributed under the License is distributed on an "AS IS" basis, |
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 srv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), | 214 srv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), |
215 nsscert, | 215 nsscert, |
216 trust.GetTrust()); | 216 trust.GetTrust()); |
217 } else if (type == net::SERVER_CERT) { | 217 } else if (type == net::SERVER_CERT) { |
218 // always start with untrusted and move up | 218 // always start with untrusted and move up |
219 trust.SetValidPeer(); | 219 trust.SetValidPeer(); |
220 trust.AddPeerTrust(trusted & net::CertDatabase::TRUSTED_SSL, 0, 0); | 220 trust.AddPeerTrust(trusted & net::CertDatabase::TRUSTED_SSL, 0, 0); |
221 srv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), | 221 srv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), |
222 nsscert, | 222 nsscert, |
223 trust.GetTrust()); | 223 trust.GetTrust()); |
224 } else if (type == net::EMAIL_CERT) { | |
225 // always start with untrusted and move up | |
226 trust.SetValidPeer(); | |
227 trust.AddPeerTrust(0, trusted & net::CertDatabase::TRUSTED_EMAIL, 0); | |
228 srv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), | |
229 nsscert, | |
230 trust.GetTrust()); | |
231 } else { | 224 } else { |
232 // ignore user certs | 225 // ignore user and email/unknown certs |
233 return true; | 226 return true; |
234 } | 227 } |
235 if (srv != SECSuccess) | 228 if (srv != SECSuccess) |
236 LOG(ERROR) << "SetCertTrust failed with error " << PORT_GetError(); | 229 LOG(ERROR) << "SetCertTrust failed with error " << PORT_GetError(); |
237 return srv == SECSuccess; | 230 return srv == SECSuccess; |
238 } | 231 } |
239 | 232 |
240 } // namespace mozilla_security_manager | 233 } // namespace mozilla_security_manager |
OLD | NEW |