diff --git a/mozilla/security/nss/lib/pki/pki3hack.c b/mozilla/security/nss/lib/pki/pki3hack.c index 60146dfdeca..40cd943e5c7 100644 --- a/mozilla/security/nss/lib/pki/pki3hack.c +++ b/mozilla/security/nss/lib/pki/pki3hack.c @@ -32,7 +32,7 @@ */ #ifdef DEBUG -static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.28 $ $Date: 2002-01-24 00:58:02 $ $Name: not supported by cvs2svn $"; +static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.29 $ $Date: 2002-01-31 17:08:32 $ $Name: not supported by cvs2svn $"; #endif /* DEBUG */ /* @@ -959,3 +959,26 @@ nssTrustDomain_AddTempCertToPerm #endif return PR_FAILURE; } + +static void cert_dump_iter(const void *k, void *v, void *a) +{ + NSSCertificate *c = (NSSCertificate *)k; + CERTCertificate *cert = STAN_GetCERTCertificate(c); + printf("[%2d] \"%s\"\n", c->object.refCount, cert->subjectName); +} + +void +nss_DumpCertificateCacheInfo() +{ + NSSTrustDomain *td; + NSSCryptoContext *cc; + td = STAN_GetDefaultTrustDomain(); + cc = STAN_GetDefaultCryptoContext(); + printf("\n\nCertificates in the cache:\n"); + nssTrustDomain_DumpCacheInfo(td, cert_dump_iter, NULL); + printf("\n\nCertificates in the temporary store:\n"); + if (cc->certStore) { + nssCertificateStore_DumpStoreInfo(cc->certStore, cert_dump_iter, NULL); + } +} + diff --git a/mozilla/security/nss/lib/pki/pkim.h b/mozilla/security/nss/lib/pki/pkim.h index 9e8f8b16c83..e08767ceb09 100644 --- a/mozilla/security/nss/lib/pki/pkim.h +++ b/mozilla/security/nss/lib/pki/pkim.h @@ -35,7 +35,7 @@ #define PKIM_H #ifdef DEBUG -static const char PKIM_CVS_ID[] = "@(#) $RCSfile: pkim.h,v $ $Revision: 1.13 $ $Date: 2002-01-03 20:09:24 $ $Name: not supported by cvs2svn $"; +static const char PKIM_CVS_ID[] = "@(#) $RCSfile: pkim.h,v $ $Revision: 1.14 $ $Date: 2002-01-31 17:08:32 $ $Name: not supported by cvs2svn $"; #endif /* DEBUG */ #ifndef BASE_H @@ -321,6 +321,14 @@ NSSTime_GetPRTime NSSTime *time ); +NSS_EXTERN void +nssTrustDomain_DumpCacheInfo +( + NSSTrustDomain *td, + void (* cert_dump_iter)(const void *, void *, void *), + void *arg +); + PR_END_EXTERN_C #endif /* PKIM_H */ diff --git a/mozilla/security/nss/lib/pki/pkistore.c b/mozilla/security/nss/lib/pki/pkistore.c index 10933af85f0..bd9cbff8161 100644 --- a/mozilla/security/nss/lib/pki/pkistore.c +++ b/mozilla/security/nss/lib/pki/pkistore.c @@ -32,7 +32,7 @@ */ #ifdef DEBUG -static const char CVS_ID[] = "@(#) $RCSfile: pkistore.c,v $ $Revision: 1.4 $ $Date: 2002-01-10 14:34:36 $ $Name: not supported by cvs2svn $"; +static const char CVS_ID[] = "@(#) $RCSfile: pkistore.c,v $ $Revision: 1.5 $ $Date: 2002-01-31 17:08:32 $ $Name: not supported by cvs2svn $"; #endif /* DEBUG */ #ifndef PKIM_H @@ -681,3 +681,16 @@ nssHash_CreateCertificate PL_CompareValues); } +NSS_IMPLEMENT void +nssCertificateStore_DumpStoreInfo +( + nssCertificateStore *store, + void (* cert_dump_iter)(const void *, void *, void *), + void *arg +) +{ + PZ_Lock(store->lock); + nssHash_Iterate(store->issuer_and_serial, cert_dump_iter, arg); + PZ_Unlock(store->lock); +} + diff --git a/mozilla/security/nss/lib/pki/pkistore.h b/mozilla/security/nss/lib/pki/pkistore.h index 49aa104759a..d3764ad8f2c 100644 --- a/mozilla/security/nss/lib/pki/pkistore.h +++ b/mozilla/security/nss/lib/pki/pkistore.h @@ -35,7 +35,7 @@ #define PKISTORE_H #ifdef DEBUG -static const char PKISTORE_CVS_ID[] = "@(#) $RCSfile: pkistore.h,v $ $Revision: 1.1 $ $Date: 2001-12-14 17:32:21 $ $Name: not supported by cvs2svn $"; +static const char PKISTORE_CVS_ID[] = "@(#) $RCSfile: pkistore.h,v $ $Revision: 1.2 $ $Date: 2002-01-31 17:08:32 $ $Name: not supported by cvs2svn $"; #endif /* DEBUG */ #ifndef NSSPKIT_H @@ -165,6 +165,14 @@ nssCertificateStore_FindSMIMEProfileForCertificate NSSCertificate *cert ); +NSS_EXTERN void +nssCertificateStore_DumpStoreInfo +( + nssCertificateStore *store, + void (* cert_dump_iter)(const void *, void *, void *), + void *arg +); + PR_END_EXTERN_C #endif /* PKISTORE_H */ diff --git a/mozilla/security/nss/lib/pki/tdcache.c b/mozilla/security/nss/lib/pki/tdcache.c index 7b611e72023..ab9fe73ec57 100644 --- a/mozilla/security/nss/lib/pki/tdcache.c +++ b/mozilla/security/nss/lib/pki/tdcache.c @@ -32,7 +32,7 @@ */ #ifdef DEBUG -static const char CVS_ID[] = "@(#) $RCSfile: tdcache.c,v $ $Revision: 1.22 $ $Date: 2002-01-11 00:41:26 $ $Name: not supported by cvs2svn $"; +static const char CVS_ID[] = "@(#) $RCSfile: tdcache.c,v $ $Revision: 1.23 $ $Date: 2002-01-31 17:08:32 $ $Name: not supported by cvs2svn $"; #endif /* DEBUG */ #ifndef PKIM_H @@ -1026,3 +1026,15 @@ nssTrustDomain_GetCertsFromCache return rvArray; } +NSS_IMPLEMENT void +nssTrustDomain_DumpCacheInfo +( + NSSTrustDomain *td, + void (* cert_dump_iter)(const void *, void *, void *), + void *arg +) +{ + PZ_Lock(td->cache->lock); + nssHash_Iterate(td->cache->issuerAndSN, cert_dump_iter, arg); + PZ_Unlock(td->cache->lock); +}