static void log_cert_ref(const char *msg, NSSCertificate *c) { PR_LOG(s_log, PR_LOG_DEBUG, ("%s: %s", msg, (c->nickname) ? c->nickname : c->email)); log_item_dump("\tserial", &c->serial); log_item_dump("\tsubject", &c->subject); }
static PRStatus remove_subject_entry ( nssTDCertificateCache *cache, NSSCertificate *cert, nssList **subjectList, NSSUTF8 **nickname, NSSArena **arena ) { PRStatus nssrv; cache_entry *ce; *subjectList = NULL; *arena = NULL; /* Get the subject list for the cert's subject */ ce = (cache_entry *)nssHash_Lookup(cache->subject, &cert->subject); if (ce) { /* Remove the cert from the subject hash */ nssList_Remove(ce->entry.list, cert); *subjectList = ce->entry.list; *nickname = ce->nickname; *arena = ce->arena; nssrv = PR_SUCCESS; #ifdef DEBUG_CACHE log_cert_ref("removed cert", cert); log_item_dump("from subject list", &cert->subject); #endif } else { nssrv = PR_FAILURE; } return nssrv; }
static PRStatus remove_email_entry( nssTDCertificateCache *cache, NSSCertificate *cert, nssList *subjectList) { PRStatus nssrv = PR_FAILURE; cache_entry *ce; /* Find the subject list in the email hash */ if (cert->email) { ce = (cache_entry *)nssHash_Lookup(cache->email, cert->email); if (ce) { nssList *subjects = ce->entry.list; /* Remove the subject list from the email hash */ if (subjects) { nssList_Remove(subjects, subjectList); #ifdef DEBUG_CACHE log_item_dump("removed subject list", &cert->subject); PR_LOG(s_log, PR_LOG_DEBUG, ("for email %s", cert->email)); #endif if (nssList_Count(subjects) == 0) { /* No more subject lists for email, delete list and * remove hash entry */ (void)nssList_Destroy(subjects); nssHash_Remove(cache->email, cert->email); /* there are no entries left for this address, free space * used for email entries */ nssArena_Destroy(ce->arena); #ifdef DEBUG_CACHE PR_LOG(s_log, PR_LOG_DEBUG, ("removed email %s", cert->email)); #endif } } nssrv = PR_SUCCESS; } } return nssrv; }