Bug 224692 - Downloaded files don't inherit NTFS properties... on nsILocalFile.moveTo use the NTFS permissions inherited from the new folder, instead of keeping permissions from the old location, r=bsmedberg

This commit is contained in:
Aaron Nowack 2008-08-14 11:48:06 -04:00
Родитель f3dacbc769
Коммит e7ab991afb
1 изменённых файлов: 14 добавлений и 0 удалений

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

@ -62,6 +62,7 @@
#include <direct.h>
#include <windows.h>
#include <aclapi.h>
#include "shellapi.h"
#include "shlguid.h"
@ -1448,6 +1449,19 @@ nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent,
if (!copyOK) // CopyFile and MoveFileEx return zero at failure.
rv = ConvertWinError(GetLastError());
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);
}
}
return rv;
}