summaryrefslogtreecommitdiff
path: root/lib/certdb
diff options
context:
space:
mode:
authorMartin Thomson <martin.thomson@gmail.com>2015-08-17 11:22:29 -0700
committerMartin Thomson <martin.thomson@gmail.com>2015-08-17 11:22:29 -0700
commitedfddd7b86ae3cc6b1b2440216d4b83cdd9f321b (patch)
tree243150dab7af42c35c08dd056ee854bad24a1bdd /lib/certdb
parent03d2e2d3d9d618778194c3759dee4bc625310f55 (diff)
downloadnss-hg-edfddd7b86ae3cc6b1b2440216d4b83cdd9f321b.tar.gz
Bug 1182667 - Enable warnings as errors, r=rrelyea
Diffstat (limited to 'lib/certdb')
-rw-r--r--lib/certdb/certdb.c40
-rw-r--r--lib/certdb/crl.c21
-rw-r--r--lib/certdb/genname.c10
-rw-r--r--lib/certdb/secname.c8
4 files changed, 29 insertions, 50 deletions
diff --git a/lib/certdb/certdb.c b/lib/certdb/certdb.c
index 2581be227..f282bbb9f 100644
--- a/lib/certdb/certdb.c
+++ b/lib/certdb/certdb.c
@@ -2443,7 +2443,6 @@ CERT_ImportCerts(CERTCertDBHandle *certdb, SECCertUsage usage,
{
unsigned int i;
CERTCertificate **certs = NULL;
- SECStatus rv;
unsigned int fcerts = 0;
if ( ncerts ) {
@@ -2491,10 +2490,11 @@ CERT_ImportCerts(CERTCertDBHandle *certdb, SECCertUsage usage,
* know which cert it belongs to. But we still may try
* the individual canickname from the cert itself.
*/
- rv = CERT_AddTempCertToPerm(certs[i], canickname, NULL);
+ /* Bug 1192442 - propagate errors from these calls. */
+ (void)CERT_AddTempCertToPerm(certs[i], canickname, NULL);
} else {
- rv = CERT_AddTempCertToPerm(certs[i],
- nickname?nickname:canickname, NULL);
+ (void)CERT_AddTempCertToPerm(certs[i],
+ nickname?nickname:canickname, NULL);
}
PORT_Free(canickname);
@@ -2511,7 +2511,7 @@ CERT_ImportCerts(CERTCertDBHandle *certdb, SECCertUsage usage,
}
}
- return ((fcerts || !ncerts) ? SECSuccess : SECFailure);
+ return (fcerts || !ncerts) ? SECSuccess : SECFailure;
}
/*
@@ -2893,15 +2893,16 @@ CERT_LockCertRefCount(CERTCertificate *cert)
void
CERT_UnlockCertRefCount(CERTCertificate *cert)
{
- PRStatus prstat;
-
PORT_Assert(certRefCountLock != NULL);
- prstat = PZ_Unlock(certRefCountLock);
-
- PORT_Assert(prstat == PR_SUCCESS);
-
- return;
+#ifdef DEBUG
+ {
+ PRStatus prstat = PZ_Unlock(certRefCountLock);
+ PORT_Assert(prstat == PR_SUCCESS);
+ }
+#else
+ PZ_Unlock(certRefCountLock);
+#endif
}
static PZLock *certTrustLock = NULL;
@@ -2973,15 +2974,16 @@ cert_DestroyLocks(void)
void
CERT_UnlockCertTrust(const CERTCertificate *cert)
{
- PRStatus prstat;
-
PORT_Assert(certTrustLock != NULL);
- prstat = PZ_Unlock(certTrustLock);
-
- PORT_Assert(prstat == PR_SUCCESS);
-
- return;
+#ifdef DEBUG
+ {
+ PRStatus prstat = PZ_Unlock(certTrustLock);
+ PORT_Assert(prstat == PR_SUCCESS);
+ }
+#else
+ PZ_Unlock(certTrustLock);
+#endif
}
diff --git a/lib/certdb/crl.c b/lib/certdb/crl.c
index 9f9aa0b2a..05ded1368 100644
--- a/lib/certdb/crl.c
+++ b/lib/certdb/crl.c
@@ -627,7 +627,6 @@ crl_storeCRL (PK11SlotInfo *slot,char *url,
CERTSignedCrl *oldCrl = NULL, *crl = NULL;
PRBool deleteOldCrl = PR_FALSE;
CK_OBJECT_HANDLE crlHandle = CK_INVALID_HANDLE;
- SECStatus rv;
PORT_Assert(newCrl);
PORT_Assert(derCrl);
@@ -640,8 +639,8 @@ crl_storeCRL (PK11SlotInfo *slot,char *url,
/* we can't use the cache here because we must look in the same
token */
- rv = SEC_FindCrlByKeyOnSlot(slot, &newCrl->crl.derName, type,
- &oldCrl, CRL_DECODE_SKIP_ENTRIES);
+ (void)SEC_FindCrlByKeyOnSlot(slot, &newCrl->crl.derName, type,
+ &oldCrl, CRL_DECODE_SKIP_ENTRIES);
/* if there is an old crl on the token, make sure the one we are
installing is newer. If not, exit out, otherwise delete the
old crl.
@@ -2693,7 +2692,7 @@ cert_CheckCertRevocationStatus(CERTCertificate* cert, CERTCertificate* issuer,
}
if (SECFailure == rv)
{
- SECStatus rv2 = CERT_FindCRLEntryReasonExten(entry, &reason);
+ (void)CERT_FindCRLEntryReasonExten(entry, &reason);
PORT_SetError(SEC_ERROR_REVOKED_CERTIFICATE);
}
break;
@@ -3050,7 +3049,7 @@ SECStatus cert_CacheCRLByGeneralName(CERTCertDBHandle* dbhandle, SECItem* crl,
{
NamedCRLCacheEntry* oldEntry, * newEntry = NULL;
NamedCRLCache* ncc = NULL;
- SECStatus rv = SECSuccess, rv2;
+ SECStatus rv = SECSuccess;
PORT_Assert(namedCRLCache.lock);
PORT_Assert(namedCRLCache.entries);
@@ -3088,8 +3087,7 @@ SECStatus cert_CacheCRLByGeneralName(CERTCertDBHandle* dbhandle, SECItem* crl,
(void*) newEntry))
{
PORT_Assert(0);
- rv2 = NamedCRLCacheEntry_Destroy(newEntry);
- PORT_Assert(SECSuccess == rv2);
+ NamedCRLCacheEntry_Destroy(newEntry);
rv = SECFailure;
}
}
@@ -3112,8 +3110,7 @@ SECStatus cert_CacheCRLByGeneralName(CERTCertDBHandle* dbhandle, SECItem* crl,
}
else
{
- rv2 = NamedCRLCacheEntry_Destroy(oldEntry);
- PORT_Assert(SECSuccess == rv2);
+ PORT_CheckSuccess(NamedCRLCacheEntry_Destroy(oldEntry));
}
if (NULL == PL_HashTableAdd(namedCRLCache.entries,
(void*) newEntry->canonicalizedName,
@@ -3160,8 +3157,7 @@ SECStatus cert_CacheCRLByGeneralName(CERTCertDBHandle* dbhandle, SECItem* crl,
}
else
{
- rv2 = NamedCRLCacheEntry_Destroy(oldEntry);
- PORT_Assert(SECSuccess == rv2);
+ PORT_CheckSuccess(NamedCRLCacheEntry_Destroy(oldEntry));
}
if (NULL == PL_HashTableAdd(namedCRLCache.entries,
(void*) newEntry->canonicalizedName,
@@ -3173,8 +3169,7 @@ SECStatus cert_CacheCRLByGeneralName(CERTCertDBHandle* dbhandle, SECItem* crl,
}
}
}
- rv2 = cert_ReleaseNamedCRLCache(ncc);
- PORT_Assert(SECSuccess == rv2);
+ PORT_CheckSuccess(cert_ReleaseNamedCRLCache(ncc));
return rv;
}
diff --git a/lib/certdb/genname.c b/lib/certdb/genname.c
index 04c8a7712..6529a6a09 100644
--- a/lib/certdb/genname.c
+++ b/lib/certdb/genname.c
@@ -67,16 +67,6 @@ static const SEC_ASN1Template CERTOtherNameTemplate[] = {
sizeof(CERTGeneralName) }
};
-static const SEC_ASN1Template CERTOtherName2Template[] = {
- { SEC_ASN1_SEQUENCE | SEC_ASN1_CONTEXT_SPECIFIC | 0 ,
- 0, NULL, sizeof(CERTGeneralName) },
- { SEC_ASN1_OBJECT_ID,
- offsetof(CERTGeneralName, name.OthName) + offsetof(OtherName, oid) },
- { SEC_ASN1_ANY,
- offsetof(CERTGeneralName, name.OthName) + offsetof(OtherName, name) },
- { 0, }
-};
-
static const SEC_ASN1Template CERT_RFC822NameTemplate[] = {
{ SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_XTRN | 1 ,
offsetof(CERTGeneralName, name.other),
diff --git a/lib/certdb/secname.c b/lib/certdb/secname.c
index d070bbfc7..88a0cf75e 100644
--- a/lib/certdb/secname.c
+++ b/lib/certdb/secname.c
@@ -240,14 +240,6 @@ CERT_CopyAVA(PLArenaPool *arena, CERTAVA *from)
return 0;
}
-/************************************************************************/
-/* XXX This template needs to go away in favor of the new SEC_ASN1 version. */
-static const SEC_ASN1Template cert_RDNTemplate[] = {
- { SEC_ASN1_SET_OF,
- offsetof(CERTRDN,avas), cert_AVATemplate, sizeof(CERTRDN) }
-};
-
-
CERTRDN *
CERT_CreateRDN(PLArenaPool *arena, CERTAVA *ava0, ...)
{