Bug 879134: Remove obsolete CFM migration code from nsNSSComponent, r=cviecco, r=wtc

--HG--
extra : rebase_source : c2460045b48112e5e4445dd757839f636b7846d5
This commit is contained in:
Brian Smith 2013-06-02 23:44:34 -07:00
parent 63a442addc
commit 946c5b246a
2 changed files with 0 additions and 141 deletions

View File

@ -1467,115 +1467,6 @@ nsNSSComponent::InitializeCRLUpdateTimer()
return NS_OK;
}
#ifdef XP_MACOSX
void
nsNSSComponent::TryCFM2MachOMigration(nsIFile *cfmPath, nsIFile *machoPath)
{
// We will modify the parameters.
//
// If neither cert7.db, cert8.db, key3.db, are available,
// copy from filenames that were used in the old days
// test for key3.db first, since a new profile might only contain cert8.db,
// but not cert7.db - this optimizes number of tests
NS_NAMED_LITERAL_CSTRING(cstr_key3db, "key3.db");
NS_NAMED_LITERAL_CSTRING(cstr_cert7db, "cert7.db");
NS_NAMED_LITERAL_CSTRING(cstr_cert8db, "cert8.db");
NS_NAMED_LITERAL_CSTRING(cstr_keydatabase3, "Key Database3");
NS_NAMED_LITERAL_CSTRING(cstr_certificate7, "Certificates7");
NS_NAMED_LITERAL_CSTRING(cstr_certificate8, "Certificates8");
bool bExists;
nsresult rv;
nsCOMPtr<nsIFile> macho_key3db;
rv = machoPath->Clone(getter_AddRefs(macho_key3db));
if (NS_FAILED(rv)) {
return;
}
macho_key3db->AppendNative(cstr_key3db);
rv = macho_key3db->Exists(&bExists);
if (NS_FAILED(rv) || bExists) {
return;
}
nsCOMPtr<nsIFile> macho_cert7db;
rv = machoPath->Clone(getter_AddRefs(macho_cert7db));
if (NS_FAILED(rv)) {
return;
}
macho_cert7db->AppendNative(cstr_cert7db);
rv = macho_cert7db->Exists(&bExists);
if (NS_FAILED(rv) || bExists) {
return;
}
nsCOMPtr<nsIFile> macho_cert8db;
rv = machoPath->Clone(getter_AddRefs(macho_cert8db));
if (NS_FAILED(rv)) {
return;
}
macho_cert8db->AppendNative(cstr_cert8db);
rv = macho_cert7db->Exists(&bExists);
if (NS_FAILED(rv) || bExists) {
return;
}
// None of the new files exist. Try to copy any available old files.
nsCOMPtr<nsIFile> cfm_key3;
rv = cfmPath->Clone(getter_AddRefs(cfm_key3));
if (NS_FAILED(rv)) {
return;
}
cfm_key3->AppendNative(cstr_keydatabase3);
rv = cfm_key3->Exists(&bExists);
if (NS_FAILED(rv)) {
return;
}
if (bExists) {
cfm_key3->CopyToFollowingLinksNative(machoPath, cstr_key3db);
}
nsCOMPtr<nsIFile> cfm_cert7;
rv = cfmPath->Clone(getter_AddRefs(cfm_cert7));
if (NS_FAILED(rv)) {
return;
}
cfm_cert7->AppendNative(cstr_certificate7);
rv = cfm_cert7->Exists(&bExists);
if (NS_FAILED(rv)) {
return;
}
if (bExists) {
cfm_cert7->CopyToFollowingLinksNative(machoPath, cstr_cert7db);
}
nsCOMPtr<nsIFile> cfm_cert8;
rv = cfmPath->Clone(getter_AddRefs(cfm_cert8));
if (NS_FAILED(rv)) {
return;
}
cfm_cert8->AppendNative(cstr_certificate8);
rv = cfm_cert8->Exists(&bExists);
if (NS_FAILED(rv)) {
return;
}
if (bExists) {
cfm_cert8->CopyToFollowingLinksNative(machoPath, cstr_cert8db);
}
}
#endif
static void configureMD5(bool enabled)
{
if (enabled) { // set flags
@ -1644,28 +1535,6 @@ nsNSSComponent::InitializeNSS(bool showWarningBox)
}
else
{
// XP_MACOSX == MachO
#if defined(XP_MACOSX)
// On Mac CFM we place all NSS DBs in the Security
// Folder in the profile directory.
nsCOMPtr<nsIFile> cfmSecurityPath;
cfmSecurityPath = profilePath; // alias for easier code reading
cfmSecurityPath->AppendNative(NS_LITERAL_CSTRING("Security"));
#endif
#if defined(XP_MACOSX)
// On MachO, we need to access both directories,
// and therefore need separate nsIFile instances.
// Keep cfmSecurityPath instance, obtain new instance for MachO profilePath.
rv = cfmSecurityPath->GetParent(getter_AddRefs(profilePath));
if (NS_FAILED(rv)) {
nsPSMInitPanic::SetPanic();
return rv;
}
#endif
const char *dbdir_override = getenv("MOZPSM_NSSDBDIR_OVERRIDE");
if (dbdir_override && strlen(dbdir_override)) {
profileStr = dbdir_override;
@ -1689,12 +1558,6 @@ nsNSSComponent::InitializeNSS(bool showWarningBox)
hashTableCerts = PL_NewHashTable( 0, certHashtable_keyHash, certHashtable_keyCompare,
certHashtable_valueCompare, 0, 0 );
#if defined(XP_MACOSX)
// function may modify the parameters
// ignore return code from conversion, we continue anyway
TryCFM2MachOMigration(cfmSecurityPath, profilePath);
#endif
#ifndef NSS_NO_LIBPKIX
rv = mPrefBranch->GetBoolPref("security.use_libpkix_verification", &globalConstFlagUsePKIXVerification);
if (NS_FAILED(rv))

View File

@ -280,10 +280,6 @@ private:
nsresult InitializeNSS(bool showWarningBox);
void ShutdownNSS();
#ifdef XP_MACOSX
void TryCFM2MachOMigration(nsIFile *cfmPath, nsIFile *machoPath);
#endif
void InstallLoadableRoots();
void UnloadLoadableRoots();
void CleanupIdentityInfo();