return certs in sorted order.
authorrelyea%netscape.com
Tue, 23 Jul 2002 00:34:20 +0000
changeset 3339 1deab87ed4719ee760c6750e1b7a8e31e20befad
parent 3338 329d8d6e7ba9f1b25d48dd34c2675587c19459c4
child 3344 4903ad2c9aa8b57b7f51c2dcb452e977f41109ca
push idunknown
push userunknown
push dateunknown
return certs in sorted order.
security/nss/lib/pk11wrap/pk11cert.c
--- a/security/nss/lib/pk11wrap/pk11cert.c
+++ b/security/nss/lib/pk11wrap/pk11cert.c
@@ -1432,21 +1432,23 @@ PK11_FindCertsFromNickname(char *nicknam
 	                                                    NULL, 0, NULL);
 	nssPKIObjectCollection_Destroy(collection);
     }
     if (slot) {
 	PK11_FreeSlot(slot);
     }
     if (nickCopy) PORT_Free(nickCopy);
     if (foundCerts) {
+	PRTime now = PR_Now();
 	certList = CERT_NewCertList();
 	for (i=0, c = *foundCerts; c; c = foundCerts[++i]) {
 	    CERTCertificate *certCert = STAN_GetCERTCertificate(c);
 	    if (certCert) {
-		CERT_AddCertToListTail(certList, certCert);
+		CERT_AddCertToListSorted(certList, certCert,
+			CERT_SortCBValidity, &now);
 	    }
 	}
 	if (CERT_LIST_HEAD(certList) == NULL) {
 	    CERT_DestroyCertList(certList);
 	    certList = NULL;
 	}
 	nss_ZFreeIf(foundCerts);
     }