Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 /* | 4 /* |
| 5 * This file manages PKCS #11 instances of certificates. | 5 * This file manages PKCS #11 instances of certificates. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "secport.h" | 8 #include "secport.h" |
| 9 #include "seccomon.h" | 9 #include "seccomon.h" |
| 10 #include "secmod.h" | 10 #include "secmod.h" |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 974 nssCertificateStore_Unlock(cc->certStore, &lockTrace, &unlockTrace); | 974 nssCertificateStore_Unlock(cc->certStore, &lockTrace, &unlockTrace); |
| 975 c->object.cryptoContext = NULL; | 975 c->object.cryptoContext = NULL; |
| 976 cert->istemp = PR_FALSE; | 976 cert->istemp = PR_FALSE; |
| 977 cert->isperm = PR_TRUE; | 977 cert->isperm = PR_TRUE; |
| 978 } | 978 } |
| 979 | 979 |
| 980 /* add the new instance to the cert, force an update of the | 980 /* add the new instance to the cert, force an update of the |
| 981 * CERTCertificate, and finish | 981 * CERTCertificate, and finish |
| 982 */ | 982 */ |
| 983 nssPKIObject_AddInstance(&c->object, certobj); | 983 nssPKIObject_AddInstance(&c->object, certobj); |
| 984 /* nssTrustDomain_AddCertsToCache may release a reference to 'c' and | |
| 985 * replace 'c' by a different value. So we add a reference to 'c' to | |
| 986 * prevent 'c' from being destroyed. */ | |
| 987 nssCertificate_AddRef(c); | |
|
Ryan Sleevi
2014/06/05 00:22:30
I wonder if this is responsible for the crashes we
wtc
2014/06/05 03:00:10
Yes, this is the best lead I have. I found PK11_Im
| |
| 984 nssTrustDomain_AddCertsToCache(STAN_GetDefaultTrustDomain(), &c, 1); | 988 nssTrustDomain_AddCertsToCache(STAN_GetDefaultTrustDomain(), &c, 1); |
| 989 /* XXX should we pass the original value of 'c' to | |
| 990 * STAN_ForceCERTCertificateUpdate? */ | |
| 985 (void)STAN_ForceCERTCertificateUpdate(c); | 991 (void)STAN_ForceCERTCertificateUpdate(c); |
| 992 nssCertificate_Destroy(c); | |
| 986 SECITEM_FreeItem(keyID,PR_TRUE); | 993 SECITEM_FreeItem(keyID,PR_TRUE); |
| 987 return SECSuccess; | 994 return SECSuccess; |
| 988 loser: | 995 loser: |
| 989 CERT_MapStanError(); | 996 CERT_MapStanError(); |
| 990 SECITEM_FreeItem(keyID,PR_TRUE); | 997 SECITEM_FreeItem(keyID,PR_TRUE); |
| 991 if (PORT_GetError() != SEC_ERROR_TOKEN_NOT_LOGGED_IN) { | 998 if (PORT_GetError() != SEC_ERROR_TOKEN_NOT_LOGGED_IN) { |
| 992 PORT_SetError(SEC_ERROR_ADDING_CERT); | 999 PORT_SetError(SEC_ERROR_ADDING_CERT); |
| 993 } | 1000 } |
| 994 return SECFailure; | 1001 return SECFailure; |
| 995 } | 1002 } |
| (...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2675 } | 2682 } |
| 2676 if (!found) { | 2683 if (!found) { |
| 2677 PK11_FreeSlotList(slotList); | 2684 PK11_FreeSlotList(slotList); |
| 2678 PORT_SetError(SEC_ERROR_NO_TOKEN); | 2685 PORT_SetError(SEC_ERROR_NO_TOKEN); |
| 2679 slotList = NULL; | 2686 slotList = NULL; |
| 2680 } | 2687 } |
| 2681 | 2688 |
| 2682 nssCryptokiObjectArray_Destroy(instances); | 2689 nssCryptokiObjectArray_Destroy(instances); |
| 2683 return slotList; | 2690 return slotList; |
| 2684 } | 2691 } |
| OLD | NEW |