Replace NSS with Pale Moon's

This commit is contained in:
wuggy 2026-06-29 21:29:25 +01:00
commit 8c2e376f94
2870 changed files with 1762232 additions and 1374220 deletions

View file

@ -129,15 +129,15 @@ GetSubjectFromUser(unsigned long serial)
}
cp = chop(buf);
if (*cp == '\0') {
sprintf(common_name_buf, "%s (%lu)", DEFAULT_COMMON_NAME,
serial);
snprintf(common_name_buf, sizeof(common_name_buf), "%s (%lu)", DEFAULT_COMMON_NAME,
serial);
cp = common_name_buf;
}
common_name = PORT_ZAlloc(strlen(cp) + 6);
if (!common_name) {
out_of_memory();
}
sprintf(common_name, "CN=%s, ", cp);
snprintf(common_name, strlen(cp) + 6, "CN=%s, ", cp);
subjectlen += strlen(common_name);
#ifdef VERBOSE_PROMPTS
@ -157,7 +157,7 @@ GetSubjectFromUser(unsigned long serial)
if (!org) {
out_of_memory();
}
sprintf(org, "O=%s, ", cp);
snprintf(org, strlen(cp) + 5, "O=%s, ", cp);
subjectlen += strlen(org);
}
@ -178,7 +178,7 @@ GetSubjectFromUser(unsigned long serial)
if (!orgunit) {
out_of_memory();
}
sprintf(orgunit, "OU=%s, ", cp);
snprintf(orgunit, strlen(cp) + 6, "OU=%s, ", cp);
subjectlen += strlen(orgunit);
}
@ -198,7 +198,7 @@ GetSubjectFromUser(unsigned long serial)
if (!state) {
out_of_memory();
}
sprintf(state, "ST=%s, ", cp);
snprintf(state, strlen(cp) + 6, "ST=%s, ", cp);
subjectlen += strlen(state);
}
@ -221,7 +221,7 @@ GetSubjectFromUser(unsigned long serial)
if (!country) {
out_of_memory();
}
sprintf(country, "C=%s, ", cp);
snprintf(country, strlen(cp) + 5, "C=%s, ", cp);
subjectlen += strlen(country);
}
@ -241,7 +241,7 @@ GetSubjectFromUser(unsigned long serial)
if (!uid) {
out_of_memory();
}
sprintf(uid, "UID=%s, ", cp);
snprintf(uid, strlen(cp) + 7, "UID=%s, ", cp);
subjectlen += strlen(uid);
}
@ -261,7 +261,7 @@ GetSubjectFromUser(unsigned long serial)
if (!email) {
out_of_memory();
}
sprintf(email, "E=%s,", cp);
snprintf(email, strlen(cp) + 5, "E=%s,", cp);
subjectlen += strlen(email);
}
@ -272,14 +272,14 @@ GetSubjectFromUser(unsigned long serial)
out_of_memory();
}
sprintf(subject, "%s%s%s%s%s%s%s",
common_name ? common_name : "",
org ? org : "",
orgunit ? orgunit : "",
state ? state : "",
country ? country : "",
uid ? uid : "",
email ? email : "");
snprintf(subject, subjectlen, "%s%s%s%s%s%s%s",
common_name ? common_name : "",
org ? org : "",
orgunit ? orgunit : "",
state ? state : "",
country ? country : "",
uid ? uid : "",
email ? email : "");
if ((strlen(subject) > 1) && (subject[strlen(subject) - 1] == ' ')) {
subject[strlen(subject) - 2] = '\0';
}
@ -662,7 +662,7 @@ output_ca_cert(CERTCertificate *cert, CERTCertDBHandle *db)
if (!filename)
out_of_memory();
sprintf(filename, "%s.raw", DEFAULT_X509_BASENAME);
snprintf(filename, strlen(DEFAULT_X509_BASENAME) + 8, "%s.raw", DEFAULT_X509_BASENAME);
if ((out = fopen(filename, "wb")) == NULL) {
PR_fprintf(errorFD, "%s: Can't open %s output file\n", PROGRAM_NAME,
filename);
@ -691,7 +691,7 @@ output_ca_cert(CERTCertificate *cert, CERTCertDBHandle *db)
/* and the cooked */
sprintf(filename, "%s.cacert", DEFAULT_X509_BASENAME);
snprintf(filename, strlen(DEFAULT_X509_BASENAME) + 8, "%s.cacert", DEFAULT_X509_BASENAME);
if ((out = fopen(filename, "wb")) == NULL) {
PR_fprintf(errorFD, "%s: Can't open %s output file\n", PROGRAM_NAME,
filename);

View file

@ -105,7 +105,7 @@ javascript_fn(char *relpath, char *basedir, char *reldir, char *filename, void *
if (PL_strcaserstr(reldir, ".arc") == reldir + strlen(reldir) - 4)
return 0;
sprintf(fullname, "%s/%s", basedir, relpath);
snprintf(fullname, sizeof(fullname), "%s/%s", basedir, relpath);
return extract_js(fullname);
}
@ -1338,13 +1338,15 @@ extract_js(char *filename)
if ((PL_strlen(archiveDir) < 4) ||
PL_strcasecmp((archiveDir + strlen(archiveDir) - 4),
".jar")) {
char *newArchiveDir = NULL;
PR_fprintf(errorFD,
"warning: ARCHIVE attribute should end in \".jar\" in tag"
" starting on %s:%d.\n",
filename, curitem->startLine);
warningCount++;
newArchiveDir = PR_smprintf("%s.arc", archiveDir);
PR_Free(archiveDir);
archiveDir = PR_smprintf("%s.arc", archiveDir);
archiveDir = newArchiveDir;
} else {
PL_strcpy(archiveDir + strlen(archiveDir) - 4, ".arc");
}
@ -1650,9 +1652,6 @@ loser:
if (entityListTail) {
PR_Free(entityListTail);
}
if (curitem) {
PR_Free(curitem);
}
if (basedir) {
PR_Free(basedir);
}

View file

@ -19,7 +19,6 @@ ListCerts(char *key, int list_certs)
{
int failed = 0;
SECStatus rv;
char *ugly_list;
CERTCertDBHandle *db;
CERTCertificate *cert;
@ -33,14 +32,6 @@ ListCerts(char *key, int list_certs)
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) {

View file

@ -6,7 +6,9 @@ CORE_DEPTH = ../..
MODULE = nss
EXPORTS =
ifdef ZLIB_INCLUDE_DIR
INCLUDES += -I$(ZLIB_INCLUDE_DIR)
endif
CSRCS = signtool.c \
certgen.c \

View file

@ -279,8 +279,8 @@ create_pk7(char *dir, char *keyName, int *keyType)
*keyType = jar_find_key_type(cert);
file_ext = (*keyType == dsaKey) ? "dsa" : "rsa";
sprintf(sf_file, "%s/META-INF/%s.sf", dir, base);
sprintf(pk7_file, "%s/META-INF/%s.%s", dir, base, file_ext);
snprintf(sf_file, sizeof(sf_file), "%s/META-INF/%s.sf", dir, base);
snprintf(pk7_file, sizeof(pk7_file), "%s/META-INF/%s.%s", dir, base, file_ext);
if ((in = fopen(sf_file, "rb")) == NULL) {
PR_fprintf(errorFD, "%s: Can't open %s for reading\n", PROGRAM_NAME,
@ -368,7 +368,7 @@ manifesto(char *dirname, char *install_script, PRBool recurse)
exit(ERRX);
}
sprintf(metadir, "%s/META-INF", dirname);
snprintf(metadir, sizeof(metadir), "%s/META-INF", dirname);
strcpy(sfname, metadir);
@ -494,7 +494,7 @@ manifesto_fn(char *relpath, char *basedir, char *reldir, char *filename, void *a
return 0;
}
sprintf(fullname, "%s/%s", basedir, relpath);
snprintf(fullname, sizeof(fullname), "%s/%s", basedir, relpath);
fprintf(mf, "\n");

View file

@ -137,9 +137,11 @@ rm_dash_r(char *path)
/* Recursively delete all entries in the directory */
while ((entry = PR_ReadDir(dir, PR_SKIP_BOTH)) != NULL) {
sprintf(filename, "%s/%s", path, entry->name);
if (rm_dash_r(filename))
snprintf(filename, sizeof(filename), "%s/%s", path, entry->name);
if (rm_dash_r(filename)) {
PR_CloseDir(dir);
return -1;
}
}
if (PR_CloseDir(dir) != PR_SUCCESS) {
@ -428,51 +430,9 @@ out_of_memory(void)
void
VerifyCertDir(char *dir, char *keyName)
{
char fn[FNSIZE];
/* don't try verifying if we don't have a local directory */
if (strncmp(dir, "multiaccess:", sizeof("multiaccess:") - 1) == 0) {
return;
}
/* this function is truly evil. Tools and applications should not have
* any knowledge of actual cert databases! */
return;
/* This code is really broken because it makes underlying assumptions about
* how the NSS profile directory is laid out, but these names can change
* from release to release. */
sprintf(fn, "%s/cert8.db", dir);
if (PR_Access(fn, PR_ACCESS_EXISTS)) {
PR_fprintf(errorFD, "%s: No certificate database in \"%s\"\n",
PROGRAM_NAME, dir);
PR_fprintf(errorFD, "%s: Check the -d arguments that you gave\n",
PROGRAM_NAME);
errorCount++;
exit(ERRX);
}
if (verbosity >= 0) {
PR_fprintf(outputFD, "using certificate directory: %s\n", dir);
}
if (keyName == NULL)
return;
/* if the user gave the -k key argument, verify that
a key database already exists */
sprintf(fn, "%s/key3.db", dir);
if (PR_Access(fn, PR_ACCESS_EXISTS)) {
PR_fprintf(errorFD, "%s: No private key database in \"%s\"\n",
PROGRAM_NAME,
dir);
PR_fprintf(errorFD, "%s: Check the -d arguments that you gave\n",
PROGRAM_NAME);
errorCount++;
exit(ERRX);
}
}
/*
@ -688,7 +648,7 @@ secErrorString(long code)
c = "untrusted issuer";
break;
default:
sprintf(errstring, "security error %ld", code);
snprintf(errstring, sizeof(errstring), "security error %ld", code);
c = errstring;
break;
}
@ -972,7 +932,7 @@ get_default_cert_dir(void)
home = PR_GetEnvSecure("HOME");
if (home && *home) {
sprintf(db, "%s/.netscape", home);
snprintf(db, sizeof(db), "%s/.netscape", home);
cd = db;
}
#endif
@ -985,7 +945,7 @@ get_default_cert_dir(void)
home = PR_GetEnvSecure("JAR_HOME");
if (home && *home) {
sprintf(db, "%s/cert7.db", home);
snprintf(db, sizeof(db), "%s/cert7.db", home);
if ((fp = fopen(db, "r")) != NULL) {
fclose(fp);
@ -998,7 +958,7 @@ get_default_cert_dir(void)
if (cd == NULL) {
home = "c:/Program Files/Netscape/Navigator";
sprintf(db, "%s/cert7.db", home);
snprintf(db, sizeof(db), "%s/cert7.db", home);
if ((fp = fopen(db, "r")) != NULL) {
fclose(fp);
@ -1012,7 +972,7 @@ get_default_cert_dir(void)
if (cd == NULL) {
home = ".";
sprintf(db, "%s/cert7.db", home);
snprintf(db, sizeof(db), "%s/cert7.db", home);
if ((fp = fopen(db, "r")) != NULL) {
fclose(fp);