Added patch to fix opening a readonly file with FILE_WRITE_ATTRIBUTES access (fixes Wine Staging Bug #298).

This commit is contained in:
Sebastian Lackner 2015-06-03 07:25:33 +02:00
parent 0abc5f4b7b
commit e88424ebc6
3 changed files with 43 additions and 0 deletions

2
debian/changelog vendored
View File

@ -8,6 +8,8 @@ wine-staging (1.7.45) UNRELEASED; urgency=low
* Added patches for FileRenameInformation support (fixes Wine Staging Bug
#296).
* Added additional tests for behaviour of opening readonly files.
* Added patch to fix opening a readonly file with FILE_WRITE_ATTRIBUTES access
(fixes Wine Staging Bug #298).
* Removed patch to fix NULL pointer dereference in get_frame_by_name
(identical patch accepted upstream).
-- Sebastian Lackner <sebastian@fds-team.de> Sun, 31 May 2015 14:46:37 +0200

View File

@ -2973,12 +2973,14 @@ if test "$enable_server_File_Permissions" -eq 1; then
patch_apply server-File_Permissions/0003-advapi32-tests-Add-tests-for-ACL-inheritance-in-Crea.patch
patch_apply server-File_Permissions/0004-advapi32-tests-Add-ACL-inheritance-tests-for-creatin.patch
patch_apply server-File_Permissions/0005-ntdll-tests-Added-tests-for-open-behaviour-on-readon.patch
patch_apply server-File_Permissions/0006-server-FILE_WRITE_ATTRIBUTES-should-succeed-for-read.patch
(
echo '+ { "Sebastian Lackner", "server: Allow to open files without any permission bits.", 2 },';
echo '+ { "Sebastian Lackner", "server: When creating new directories temporarily give read-permissions until they are opened.", 1 },';
echo '+ { "Sebastian Lackner", "advapi32/tests: Add tests for ACL inheritance in CreateDirectoryA.", 1 },';
echo '+ { "Sebastian Lackner", "advapi32/tests: Add ACL inheritance tests for creating subdirectories with NtCreateFile.", 1 },';
echo '+ { "Qian Hong", "ntdll/tests: Added tests for open behaviour on readonly files.", 1 },';
echo '+ { "Sebastian Lackner", "server: FILE_WRITE_ATTRIBUTES should succeed for readonly files.", 1 },';
) >> "$patchlist"
fi

View File

@ -0,0 +1,39 @@
From ecc446c4822d66b92e1d87e9eea1284ac2c8c35c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 3 Jun 2015 05:43:31 +0200
Subject: server: FILE_WRITE_ATTRIBUTES should succeed for readonly files.
---
dlls/ntdll/tests/file.c | 2 +-
server/fd.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index d365303..8ec367b 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2117,7 +2117,7 @@ static void test_readonly(void)
status = pNtOpenFile(&handle, FILE_WRITE_ATTRIBUTES, &attr, &io,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
- todo_wine ok(status == STATUS_SUCCESS, "got %#x\n", status);
+ ok(status == STATUS_SUCCESS, "got %#x\n", status);
CloseHandle(handle);
status = pNtOpenFile(&handle, DELETE, &attr, &io,
diff --git a/server/fd.c b/server/fd.c
index a432ec7..14e98ac 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1810,7 +1810,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
else if (errno == EACCES)
{
/* try to change permissions temporarily to open a file descriptor */
- if (!(access & (FILE_UNIX_WRITE_ACCESS | FILE_UNIX_READ_ACCESS | DELETE)) &&
+ if (!(access & ((FILE_UNIX_WRITE_ACCESS | FILE_UNIX_READ_ACCESS | DELETE) & ~FILE_WRITE_ATTRIBUTES)) &&
!stat( name, &st ) && st.st_uid == getuid() &&
!chmod( name, st.st_mode | S_IRUSR ))
{
--
2.4.2