SECStatus rv;
nsslowcert_AddPermCert(NSSLOWCERTCertDBHandle *dbhandle,    NSSLOWCERTCertificate *cert, char *nickname, NSSLOWCERTCertTrust *trust){    char *oldnn;    certDBEntryCert *entry;    PRBool conflict;    SECStatus ret;    nsslowcert_LockDB(dbhandle);    rv = db_BeginTransaction(dbhandle->permCertDB);    if (rv != SECSuccess) {	nsslowcert_UnlockDB(dbhandle);	return SECFailure;    }        PORT_Assert(!cert->dbEntry);    /* don't add a conflicting nickname */    conflict = nsslowcert_CertNicknameConflict(nickname, &cert->derSubject,					dbhandle);    if ( conflict ) {	ret = SECFailure;	goto done;    }        /* save old nickname so that we can delete it */    oldnn = cert->nickname;    entry = AddCertToPermDB(dbhandle, cert, nickname, trust);        if ( entry == NULL ) {	ret = SECFailure;	goto done;    }        cert->nickname = (entry->nickname) ? PORT_ArenaStrdup(cert->arena,entry->nickname) : NULL;    cert->trust = &entry->trust;    cert->dbEntry = entry;        ret = SECSuccess;done:    db_FinishTransaction(dbhandle->permCertDB, ret != SECSuccess);    nsslowcert_UnlockDB(dbhandle);    return(ret);}