bug 90518, implement methods for dumping the state of the cache and temp cert store in NSS 3.4

This commit is contained in:
ian.mcgreer%sun.com 2002-01-31 17:08:32 +00:00
Родитель 4f648fa8ac
Коммит 17924181a5
5 изменённых файлов: 69 добавлений и 5 удалений

Просмотреть файл

@ -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: $";
static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.29 $ $Date: 2002-01-31 17:08:32 $ $Name: $";
#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);
}
}

Просмотреть файл

@ -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: $";
static const char PKIM_CVS_ID[] = "@(#) $RCSfile: pkim.h,v $ $Revision: 1.14 $ $Date: 2002-01-31 17:08:32 $ $Name: $";
#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 */

Просмотреть файл

@ -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: $";
static const char CVS_ID[] = "@(#) $RCSfile: pkistore.c,v $ $Revision: 1.5 $ $Date: 2002-01-31 17:08:32 $ $Name: $";
#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);
}

Просмотреть файл

@ -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: $";
static const char PKISTORE_CVS_ID[] = "@(#) $RCSfile: pkistore.h,v $ $Revision: 1.2 $ $Date: 2002-01-31 17:08:32 $ $Name: $";
#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 */

Просмотреть файл

@ -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: $";
static const char CVS_ID[] = "@(#) $RCSfile: tdcache.c,v $ $Revision: 1.23 $ $Date: 2002-01-31 17:08:32 $ $Name: $";
#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);
}