mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 23:37:33 +09:00
Replace NSS with Pale Moon's
This commit is contained in:
parent
ff1e5e48bf
commit
8c2e376f94
2870 changed files with 1762232 additions and 1374220 deletions
|
|
@ -41,13 +41,13 @@ log_item_dump(const char *msg, NSSItem *it)
|
|||
char buf[33];
|
||||
int i, j;
|
||||
for (i = 0; i < 10 && i < it->size; i++) {
|
||||
sprintf(&buf[2 * i], "%02X", ((PRUint8 *)it->data)[i]);
|
||||
snprintf(&buf[2 * i], sizeof(buf) - 2 * i, "%02X", ((PRUint8 *)it->data)[i]);
|
||||
}
|
||||
if (it->size > 10) {
|
||||
sprintf(&buf[2 * i], "..");
|
||||
snprintf(&buf[2 * i], sizeof(buf) - 2 * i, "..");
|
||||
i += 1;
|
||||
for (j = it->size - 1; i <= 16 && j > 10; i++, j--) {
|
||||
sprintf(&buf[2 * i], "%02X", ((PRUint8 *)it->data)[j]);
|
||||
snprintf(&buf[2 * i], sizeof(buf) - 2 * i, "%02X", ((PRUint8 *)it->data)[j]);
|
||||
}
|
||||
}
|
||||
PR_LOG(s_log, PR_LOG_DEBUG, ("%s: %s", msg, buf));
|
||||
|
|
@ -58,8 +58,7 @@ log_item_dump(const char *msg, NSSItem *it)
|
|||
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));
|
||||
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);
|
||||
}
|
||||
|
|
@ -74,7 +73,7 @@ log_cert_ref(const char *msg, NSSCertificate *c)
|
|||
|
||||
/* should it live in its own arena? */
|
||||
struct nssTDCertificateCacheStr {
|
||||
PZLock *lock;
|
||||
PZLock *lock; /* Must not be held when calling nssSlot_IsTokenPresent. See bug 1625791. */
|
||||
NSSArena *arena;
|
||||
nssHash *issuerAndSN;
|
||||
nssHash *subject;
|
||||
|
|
@ -92,6 +91,7 @@ struct cache_entry_str {
|
|||
PRTime lastHit;
|
||||
NSSArena *arena;
|
||||
NSSUTF8 *nickname;
|
||||
NSSASCII7 *email;
|
||||
};
|
||||
|
||||
typedef struct cache_entry_str cache_entry;
|
||||
|
|
@ -230,6 +230,7 @@ remove_subject_entry(
|
|||
NSSCertificate *cert,
|
||||
nssList **subjectList,
|
||||
NSSUTF8 **nickname,
|
||||
NSSASCII7 **email,
|
||||
NSSArena **arena)
|
||||
{
|
||||
PRStatus nssrv;
|
||||
|
|
@ -243,6 +244,7 @@ remove_subject_entry(
|
|||
nssList_Remove(ce->entry.list, cert);
|
||||
*subjectList = ce->entry.list;
|
||||
*nickname = ce->nickname;
|
||||
*email = ce->email;
|
||||
*arena = ce->arena;
|
||||
nssrv = PR_SUCCESS;
|
||||
#ifdef DEBUG_CACHE
|
||||
|
|
@ -277,35 +279,34 @@ remove_nickname_entry(
|
|||
static PRStatus
|
||||
remove_email_entry(
|
||||
nssTDCertificateCache *cache,
|
||||
NSSCertificate *cert,
|
||||
NSSASCII7 *email,
|
||||
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 (email) {
|
||||
ce = (cache_entry *)nssHash_Lookup(cache->email, 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));
|
||||
PR_LOG(s_log, PR_LOG_DEBUG,
|
||||
("removed subject list for email %s", 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);
|
||||
nssHash_Remove(cache->email, 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));
|
||||
PR_LOG(s_log, PR_LOG_DEBUG, ("removed email %s", email));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -324,6 +325,7 @@ nssTrustDomain_RemoveCertFromCacheLOCKED(
|
|||
cache_entry *ce;
|
||||
NSSArena *arena;
|
||||
NSSUTF8 *nickname = NULL;
|
||||
NSSASCII7 *email = NULL;
|
||||
|
||||
#ifdef DEBUG_CACHE
|
||||
log_cert_ref("attempt to remove cert", cert);
|
||||
|
|
@ -340,10 +342,10 @@ nssTrustDomain_RemoveCertFromCacheLOCKED(
|
|||
}
|
||||
(void)remove_issuer_and_serial_entry(td->cache, cert);
|
||||
(void)remove_subject_entry(td->cache, cert, &subjectList,
|
||||
&nickname, &arena);
|
||||
&nickname, &email, &arena);
|
||||
if (nssList_Count(subjectList) == 0) {
|
||||
(void)remove_nickname_entry(td->cache, nickname, subjectList);
|
||||
(void)remove_email_entry(td->cache, cert, subjectList);
|
||||
(void)remove_email_entry(td->cache, email, subjectList);
|
||||
(void)nssList_Destroy(subjectList);
|
||||
nssHash_Remove(td->cache->subject, &cert->subject);
|
||||
/* there are no entries left for this subject, free the space used
|
||||
|
|
@ -538,6 +540,9 @@ add_subject_entry(
|
|||
if (nickname) {
|
||||
ce->nickname = nssUTF8_Duplicate(nickname, arena);
|
||||
}
|
||||
if (cert->email) {
|
||||
ce->email = nssUTF8_Duplicate(cert->email, arena);
|
||||
}
|
||||
nssList_SetSortFunction(list, nssCertificate_SubjectListSort);
|
||||
/* Add the cert entry to this list of subjects */
|
||||
nssrv = nssList_AddUnique(list, cert);
|
||||
|
|
@ -711,8 +716,17 @@ add_cert_to_cache(
|
|||
PRUint32 added = 0;
|
||||
cache_entry *ce;
|
||||
NSSCertificate *rvCert = NULL;
|
||||
NSSASCII7 *email = NULL;
|
||||
NSSUTF8 *certNickname = nssCertificate_GetNickname(cert, NULL);
|
||||
|
||||
/* Set cc->trust and cc->nssCertificate before taking td->cache->lock.
|
||||
* Otherwise, the sorter in add_subject_entry may eventually call
|
||||
* nssSlot_IsTokenPresent, which must not occur while the cache lock
|
||||
* is held. See bugs 1625791 and 1651564 for details. */
|
||||
if (cert->type == NSSCertificateType_PKIX) {
|
||||
(void)STAN_GetCERTCertificate(cert);
|
||||
}
|
||||
|
||||
PZ_Lock(td->cache->lock);
|
||||
/* If it exists in the issuer/serial hash, it's already in all */
|
||||
ce = (cache_entry *)nssHash_Lookup(td->cache->issuerAndSN, cert);
|
||||
|
|
@ -810,13 +824,13 @@ loser:
|
|||
}
|
||||
if (added >= 2) {
|
||||
(void)remove_subject_entry(td->cache, cert, &subjectList,
|
||||
&certNickname, &arena);
|
||||
&certNickname, &email, &arena);
|
||||
}
|
||||
if (added == 3 || added == 5) {
|
||||
(void)remove_nickname_entry(td->cache, certNickname, subjectList);
|
||||
}
|
||||
if (added >= 4) {
|
||||
(void)remove_email_entry(td->cache, cert, subjectList);
|
||||
(void)remove_email_entry(td->cache, email, subjectList);
|
||||
}
|
||||
if (subjectList) {
|
||||
nssHash_Remove(td->cache->subject, &cert->subject);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue