зеркало из https://github.com/mozilla/pjs.git
Fixing bug 56002. Randomization process is fixed to get right values on the mac and regitry updates are done to make sure salted entries are in there. r=sspitzer,sr=alecf
This commit is contained in:
Родитель
705e78a461
Коммит
825d3d0e3f
|
@ -893,6 +893,10 @@ NS_IMETHODIMP nsProfile::GetProfileDir(const PRUnichar *profileName, nsIFile **p
|
|||
rv = SetProfileDir(profileName, aProfileDir);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// update the registry
|
||||
gProfileDataAccess->mProfileDataChanged = PR_TRUE;
|
||||
gProfileDataAccess->UpdateRegistry(nsnull);
|
||||
|
||||
// Copy contents from defaults folder.
|
||||
rv = profDefaultsDir->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && exists)
|
||||
|
@ -1058,12 +1062,12 @@ nsProfile::AddLevelOfIndirection(nsIFile *aDir)
|
|||
// and salt rand with that.
|
||||
double fpTime;
|
||||
LL_L2D(fpTime, PR_Now());
|
||||
srand((uint)(fpTime * 1e-3 + 0.5));
|
||||
srand((uint)(fpTime * 1e-6 + 0.5)); // use 1e-6, granularity of PR_Now() on the mac is seconds
|
||||
|
||||
nsCAutoString saltStr;
|
||||
PRInt32 i;
|
||||
for (i=0;i<SALT_SIZE;i++) {
|
||||
saltStr.Append(table[(rand()%TABLE_SIZE)]);
|
||||
saltStr.Append(table[rand()%TABLE_SIZE]);
|
||||
}
|
||||
saltStr.Append(SALT_EXTENSION);
|
||||
#ifdef DEBUG_profile_verbose
|
||||
|
@ -2292,7 +2296,7 @@ nsresult nsProfile::PopulateIfEmptyDir(const PRUnichar *profileName, nsILocalFil
|
|||
rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_50_DIR, getter_AddRefs(profDefaultsDir));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Add the indirection
|
||||
// Add the indirection
|
||||
rv = AddLevelOfIndirection(aProfileDir);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -2302,6 +2306,11 @@ nsresult nsProfile::PopulateIfEmptyDir(const PRUnichar *profileName, nsILocalFil
|
|||
rv = SetProfileDir(profileName, aProfileDir);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// we need to update the registry to remember the indirection
|
||||
// otherwise, the next time we start we won't be pointing at the salt directory
|
||||
gProfileDataAccess->mProfileDataChanged = PR_TRUE;
|
||||
gProfileDataAccess->UpdateRegistry(nsnull);
|
||||
|
||||
// Copy contents from defaults folder.
|
||||
rv = profDefaultsDir->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && exists) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче