Followup to bug 224692 to only reset inherited permissions r+sr=bsmedberg

This commit is contained in:
Neil Rashbrook 2009-04-01 17:10:29 +01:00
Родитель 174dc21055
Коммит 9373f0a628
1 изменённых файлов: 13 добавлений и 9 удалений

Просмотреть файл

@ -1458,16 +1458,20 @@ nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent,
rv = ConvertWinError(GetLastError());
#ifndef WINCE
if(move) //Set security permissions to inherit from parent.
else if (move) // Set security permissions to inherit from parent.
{
ACL empty_acl;
if (InitializeAcl(&empty_acl, (DWORD) sizeof(ACL), ACL_REVISION))
{
::SetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION |
UNPROTECTED_DACL_SECURITY_INFORMATION,
NULL, NULL, &empty_acl, NULL);
}
PACL pOldDACL = NULL;
PSECURITY_DESCRIPTOR pSD = NULL;
::GetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION,
NULL, NULL, &pOldDACL, NULL, &pSD);
if (pOldDACL)
::SetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION |
UNPROTECTED_DACL_SECURITY_INFORMATION,
NULL, NULL, pOldDACL, NULL);
if (pSD)
LocalFree((HLOCAL)pSD);
}
#endif
return rv;