diff options
author | nelson%bolyard.com <devnull@localhost> | 2008-05-30 21:05:49 +0000 |
---|---|---|
committer | nelson%bolyard.com <devnull@localhost> | 2008-05-30 21:05:49 +0000 |
commit | 8aabebd38436598c46a9e803d66d0c0adee35612 (patch) | |
tree | b357117788c8d9a207c41ce76fa85f05f035e307 | |
parent | c9759696479b406aaa639a8206a1362258a3f2d2 (diff) | |
download | nss-hg-8aabebd38436598c46a9e803d66d0c0adee35612.tar.gz |
Check in a working version of this code I've had sitting in my workarea
since August 2000. We don't build this in production builds.
-rw-r--r-- | security/nss/cmd/dbck/dbck.c | 4 | ||||
-rw-r--r-- | security/nss/cmd/dbck/dbrecover.c | 74 |
2 files changed, 43 insertions, 35 deletions
diff --git a/security/nss/cmd/dbck/dbck.c b/security/nss/cmd/dbck/dbck.c index a1bba5b0e..6000fcaed 100644 --- a/security/nss/cmd/dbck/dbck.c +++ b/security/nss/cmd/dbck/dbck.c @@ -694,6 +694,10 @@ print_subject_graph(dbDebugInfo *info, certDBSubjectEntryMap *subjMap, } if (!subjMap->pNickname && !subjMap->pSMime) { printnode(info, "******************* ", -1); + } + } + if (direction == GOBOTH) { + if (!subjMap->pNickname && !subjMap->pSMime) { info->dbErrors[NoNicknameOrSMimeForSubject]++; } if (subjMap->pNickname && subjMap->pSMime) { diff --git a/security/nss/cmd/dbck/dbrecover.c b/security/nss/cmd/dbck/dbrecover.c index db65d0e5c..7b700ede3 100644 --- a/security/nss/cmd/dbck/dbrecover.c +++ b/security/nss/cmd/dbck/dbrecover.c @@ -584,27 +584,30 @@ findNewestSubjectForEmail(NSSLOWCERTCertDBHandle *handle, int subjectNum, } NSSLOWCERTCertDBHandle * -DBCK_ReconstructDBFromCerts(NSSLOWCERTCertDBHandle *oldhandle, char *newdbname, - PRFileDesc *outfile, PRBool removeExpired, - PRBool requireProfile, PRBool singleEntry, +DBCK_ReconstructDBFromCerts(NSSLOWCERTCertDBHandle *oldhandle, + char *newdbname, + PRFileDesc *outfile, + PRBool removeExpired, + PRBool requireProfile, + PRBool singleEntry, PRBool promptUser) { - SECStatus rv; - dbRestoreInfo info; certDBEntryContentVersion *oldContentVersion; - certDBArray dbArray; - int i; + SECStatus rv; + int i; + dbRestoreInfo info; + certDBArray dbArray; PORT_Memset(&dbArray, 0, sizeof(dbArray)); PORT_Memset(&info, 0, sizeof(info)); info.verbose = (outfile) ? PR_TRUE : PR_FALSE; - info.out = (outfile) ? outfile : PR_STDOUT; - info.removeType[dbInvalidCert] = removeExpired; - info.removeType[dbNoSMimeProfile] = requireProfile; - info.removeType[dbOlderCert] = singleEntry; - info.promptUser[dbInvalidCert] = promptUser; + info.out = (outfile) ? outfile : PR_STDOUT; + info.removeType[dbInvalidCert] = removeExpired; + info.removeType[dbNoSMimeProfile] = requireProfile; + info.removeType[dbOlderCert] = singleEntry; + info.promptUser[dbInvalidCert] = promptUser; info.promptUser[dbNoSMimeProfile] = promptUser; - info.promptUser[dbOlderCert] = promptUser; + info.promptUser[dbOlderCert] = promptUser; /* Allocate a handle to fill with CERT_OpenCertDB below. */ info.handle = PORT_ZNew(NSSLOWCERTCertDBHandle); @@ -629,7 +632,9 @@ DBCK_ReconstructDBFromCerts(NSSLOWCERTCertDBHandle *oldhandle, char *newdbname, */ fillDBEntryArray(oldhandle, certDBEntryTypeCert, &dbArray.certs); for (elem = PR_LIST_HEAD(&dbArray->certs.link); - elem != &dbArray->certs.link; elem = PR_NEXT_LINK(elem)) { + elem != &dbArray->certs.link; + elem = PR_NEXT_LINK(elem)) { + node = LISTNODE_CAST(elem); addCertToDB((certDBEntryCert*)&node->entry, &info, oldhandle); /* entries get destroyed in addCertToDB */ @@ -652,10 +657,10 @@ DBCK_ReconstructDBFromCerts(NSSLOWCERTCertDBHandle *oldhandle, char *newdbname, /* Copy over the version record. */ /* XXX Already exists - and _must_ be correct... */ - /* +#if 0 versionEntry = ReadDBVersionEntry(oldhandle); rv = WriteDBVersionEntry(info.handle, versionEntry); - */ +#endif /* Copy over the content version record. */ /* XXX Can probably get useful info from old content version? @@ -676,27 +681,26 @@ DBCK_ReconstructDBFromCerts(NSSLOWCERTCertDBHandle *oldhandle, char *newdbname, #endif PR_fprintf(info.out, "Database had %d certificates.\n", info.nOldCerts); - PR_fprintf(info.out, "Reconstructed %d certificates.\n", info.nCerts); - PR_fprintf(info.out, "(ax) Rejected %d expired certificates.\n", - info.dbErrors[dbInvalidCert]); - PR_fprintf(info.out, "(as) Rejected %d S/MIME certificates missing a profile.\n", - info.dbErrors[dbNoSMimeProfile]); - PR_fprintf(info.out, "(ar) Rejected %d certificates for which a newer certificate was found.\n", - info.dbErrors[dbOlderCert]); - PR_fprintf(info.out, " Rejected %d corrupt certificates.\n", - info.dbErrors[dbBadCertificate]); - PR_fprintf(info.out, " Rejected %d certificates which did not write to the DB.\n", - info.dbErrors[dbCertNotWrittenToDB]); - - if (rv) - goto loser; - - return info.handle; + PR_fprintf(info.out, + "(ax) Rejected %d expired certificates.\n" + "(as) Rejected %d S/MIME certificates missing a profile.\n" + "(ar) Rejected %d certificates for which a newer certificate was found.\n" + " Rejected %d corrupt certificates.\n", + " Rejected %d certificates which did not write to the DB.\n", + info.dbErrors[dbInvalidCert], + info.dbErrors[dbNoSMimeProfile], + info.dbErrors[dbOlderCert], + info.dbErrors[dbBadCertificate], + info.dbErrors[dbCertNotWrittenToDB] ); + if (rv) { loser: - if (info.handle) - PORT_Free(info.handle); - return NULL; + if (info.handle) { + PORT_Free(info.handle); + info.handle = NULL; + } + } + return info.handle; } |