}  if (rv) { return -1;
ListCerts(char *key, int list_certs){	SECStatus rv;	char *ugly_list;	CERTCertDBHandle *db;	CERTCertificate *cert;	CERTVerifyLog errlog;	errlog.arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);	if( errlog.arena == NULL) {		out_of_memory();	}	errlog.head = NULL;	errlog.tail = NULL;	errlog.count = 0;	ugly_list = PORT_ZAlloc (16);	if (ugly_list == NULL) {		out_of_memory();	}	*ugly_list = 0;	db= CERT_GetDefaultCertDB();	if (list_certs == 2) {		PR_fprintf(outputFD, "\nS Certificates\n");		PR_fprintf(outputFD, "- ------------\n");	} else {		PR_fprintf(outputFD, "\nObject signing certificates\n");		PR_fprintf(outputFD, "---------------------------------------\n");	}	num_trav_certs = 0;	/* Traverse non-internal DBs */	rv = PK11_TraverseSlotCerts(cert_trav_callback, (void*)&list_certs,		NULL /*wincx*/);	/* Traverse Internal DB */	rv = SEC_TraversePermCerts(db, cert_trav_callback, (void*)&list_certs);	if (num_trav_certs == 0) {		PR_fprintf(outputFD,			"You don't appear to have any object signing certificates.\n");	}	if (list_certs == 2) {		PR_fprintf(outputFD, "- ------------\n");	} else {		PR_fprintf(outputFD, "---------------------------------------\n");	}	if (rv) {		return -1;	}	if (list_certs == 1) {		PR_fprintf(outputFD,			"For a list including CA's, use \"%s -L\"\n", PROGRAM_NAME);	}	if(list_certs == 2) {		PR_fprintf(outputFD,			"Certificates that can be used to sign objects have *'s to "		 "their left.\n");	}	if (key) {		/* Do an analysis of the given cert */		cert = PK11_FindCertFromNickname(key, NULL /*wincx*/);		if (cert) {			PR_fprintf(outputFD,				"\nThe certificate with nickname \"%s\" was found:\n",			 cert->nickname);			PR_fprintf(outputFD,				"\tsubject name: %s\n", cert->subjectName);			PR_fprintf(outputFD,				"\tissuer name: %s\n", cert->issuerName);			PR_fprintf(outputFD, "\n");			rv = CERT_CertTimesValid (cert);			if(rv != SECSuccess) {				PR_fprintf(outputFD, "**This certificate is expired**\n");			} else {				PR_fprintf(outputFD, "This certificate is not expired.\n");			}			rv = CERT_VerifyCert (db, cert, PR_TRUE,			certUsageObjectSigner, PR_Now(), NULL, &errlog);			if (rv != SECSuccess) {				if(errlog.count > 0) {					PR_fprintf(outputFD,						"**Certificate validation failed for the "					 "following reason(s):**\n");				} else {					PR_fprintf(outputFD, "**Certificate validation failed**");				}			} else {				PR_fprintf(outputFD, "This certificate is valid.\n");			}			displayVerifyLog(&errlog);		} else {			PR_fprintf(outputFD,				"The certificate with nickname \"%s\" was NOT FOUND\n",			 key);		}    }	if(errlog.arena != NULL) {		PORT_FreeArena(errlog.arena, PR_FALSE);	}	if (rv != SECSuccess) {		return -1;	}	return 0;}