Skip to content

Commit

Permalink
fix bugs in cert import with smart card cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ian.mcgreer%sun.com committed Apr 22, 2002
1 parent a9190ae commit f312596
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions security/nss/lib/certdb/stanpcertdb.c
Expand Up @@ -174,6 +174,7 @@ __CERT_AddTempCertToPerm(CERTCertificate *cert, char *nickname,
return SECFailure;
}
nssPKIObject_AddInstance(&c->object, permInstance);
nssTrustDomain_AddCertsToCache(STAN_GetDefaultTrustDomain(), &c, 1);
/* reset the CERTCertificate fields */
cert->nssCertificate = NULL;
cert = STAN_GetCERTCertificate(c); /* will return same pointer */
Expand Down
6 changes: 2 additions & 4 deletions security/nss/lib/dev/devtoken.c
Expand Up @@ -1029,8 +1029,7 @@ nssToken_ImportTrust
/* import the trust object onto the token */
object = import_object(tok, sessionOpt, trust_tmpl, tsize);
if (object && tok->cache) {
nssTokenObjectCache_ImportObject(tok->cache, object,
CKO_CERTIFICATE,
nssTokenObjectCache_ImportObject(tok->cache, object, tobjc,
trust_tmpl, tsize);
}
return object;
Expand Down Expand Up @@ -1167,8 +1166,7 @@ nssToken_ImportCRL
/* import the crl object onto the token */
object = import_object(token, sessionOpt, crl_tmpl, crlsize);
if (object && token->cache) {
nssTokenObjectCache_ImportObject(token->cache, object,
CKO_CERTIFICATE,
nssTokenObjectCache_ImportObject(token->cache, object, crlobjc,
crl_tmpl, crlsize);
}
return object;
Expand Down
1 change: 1 addition & 0 deletions security/nss/lib/dev/devutil.c
Expand Up @@ -1238,6 +1238,7 @@ make_object_and_attr
goto loser;
}
for (i=0; i<otlen; i++) {
oa->attributes[i].type = ot[i].type;
oa->attributes[i].pValue = nss_ZAlloc(arena, ot[i].ulValueLen);
if (!oa->attributes[i].pValue) {
goto loser;
Expand Down
1 change: 1 addition & 0 deletions security/nss/lib/pk11wrap/pk11cert.c
Expand Up @@ -1736,6 +1736,7 @@ PK11_ImportCert(PK11SlotInfo *slot, CERTCertificate *cert,
* CERTCertificate, and finish
*/
nssPKIObject_AddInstance(&c->object, certobj);
nssTrustDomain_AddCertsToCache(STAN_GetDefaultTrustDomain(), &c, 1);
(void)STAN_ForceCERTCertificateUpdate(c);
SECITEM_FreeItem(keyID,PR_TRUE);
return SECSuccess;
Expand Down
3 changes: 3 additions & 0 deletions security/nss/lib/pki/pki3hack.c
Expand Up @@ -506,6 +506,9 @@ static PRBool is_user_cert(NSSCertificate *c, CERTCertificate *cc)
PRBool isUser = PR_FALSE;
nssCryptokiObject **ip;
nssCryptokiObject **instances = nssPKIObject_GetInstances(&c->object);
if (!instances) {
return PR_FALSE;
}
for (ip = instances; *ip; ip++) {
nssCryptokiObject *instance = *ip;
if (PK11_IsUserCert(instance->token->pk11slot, cc, instance->handle)) {
Expand Down
2 changes: 1 addition & 1 deletion security/nss/lib/pki/tdcache.c
Expand Up @@ -823,7 +823,7 @@ add_cert_to_cache
}
#endif
}
nssCertificate_AddRef(cert);
rvCert = nssCertificate_AddRef(cert);
PZ_Unlock(td->cache->lock);
return rvCert;
loser:
Expand Down

0 comments on commit f312596

Please sign in to comment.