mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
server-File_Permissions: Remove patches for Cygwin unlink().
These were committed without any explanation, but they do seem to fix Cygwin
unlink(), and it's been observed that many patches in Wine-Staging, whether
labeled or not, were specifically for Cygwin.
The relevant functionality was fixed a different way upstream, namely:
91e442b060
This commit is contained in:
parent
6d50e5c435
commit
3d69e00892
@ -1,122 +0,0 @@
|
||||
From e23cd96f76a62e983730d43e5d9ed401fdc09721 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 3 Apr 2015 03:58:47 +0200
|
||||
Subject: [PATCH] server: Allow to open files without any permission bits. (try
|
||||
2)
|
||||
|
||||
Changes in v2:
|
||||
* As suggested by Piotr, fix the problem for both files and directories.
|
||||
* Pay attention to requested access attributes - this fixes a couple more todo_wine's.
|
||||
---
|
||||
dlls/advapi32/tests/security.c | 32 ++++++++++++--------------------
|
||||
server/fd.c | 21 +++++++++++++++++++++
|
||||
2 files changed, 33 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
|
||||
index 5e5000cfcb5..abb1b070f7d 100644
|
||||
--- a/dlls/advapi32/tests/security.c
|
||||
+++ b/dlls/advapi32/tests/security.c
|
||||
@@ -3782,17 +3782,13 @@ static void test_CreateDirectoryA(void)
|
||||
error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT,
|
||||
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
|
||||
(PSID *)&owner, NULL, &pDacl, NULL, &pSD);
|
||||
- todo_wine
|
||||
ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %ld\n", error);
|
||||
- if (error == ERROR_SUCCESS)
|
||||
- {
|
||||
- bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation);
|
||||
- ok(bret, "GetAclInformation failed\n");
|
||||
- todo_wine
|
||||
- ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%ld != 0).\n",
|
||||
- acl_size.AceCount);
|
||||
- LocalFree(pSD);
|
||||
- }
|
||||
+ bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation);
|
||||
+ ok(bret, "GetAclInformation failed\n");
|
||||
+ todo_wine
|
||||
+ ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%ld != 0).\n",
|
||||
+ acl_size.AceCount);
|
||||
+ LocalFree(pSD);
|
||||
CloseHandle(hTemp);
|
||||
|
||||
/* Test inheritance of ACLs in NtCreateFile without security descriptor */
|
||||
@@ -3861,17 +3857,13 @@ static void test_CreateDirectoryA(void)
|
||||
error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT,
|
||||
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
|
||||
(PSID *)&owner, NULL, &pDacl, NULL, &pSD);
|
||||
- todo_wine
|
||||
ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %ld\n", error);
|
||||
- if (error == ERROR_SUCCESS)
|
||||
- {
|
||||
- bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation);
|
||||
- ok(bret, "GetAclInformation failed\n");
|
||||
- todo_wine
|
||||
- ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%ld != 0).\n",
|
||||
- acl_size.AceCount);
|
||||
- LocalFree(pSD);
|
||||
- }
|
||||
+ bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation);
|
||||
+ ok(bret, "GetAclInformation failed\n");
|
||||
+ todo_wine
|
||||
+ ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%ld != 0).\n",
|
||||
+ acl_size.AceCount);
|
||||
+ LocalFree(pSD);
|
||||
CloseHandle(hTemp);
|
||||
|
||||
done:
|
||||
diff --git a/server/fd.c b/server/fd.c
|
||||
index 3edfca018d1..fe6318b2e0e 100644
|
||||
--- a/server/fd.c
|
||||
+++ b/server/fd.c
|
||||
@@ -2047,6 +2047,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
int root_fd = -1;
|
||||
int rw_mode;
|
||||
char *path;
|
||||
+ int do_chmod = 0;
|
||||
int created = (flags & O_CREAT);
|
||||
|
||||
if (((options & FILE_DELETE_ON_CLOSE) && !(access & DELETE)) ||
|
||||
@@ -2115,6 +2116,23 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
if ((access & FILE_UNIX_WRITE_ACCESS) || (flags & O_CREAT))
|
||||
fd->unix_fd = open( name, O_RDONLY | (flags & ~(O_TRUNC | O_CREAT | O_EXCL)), *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)) &&
|
||||
+ !stat( name, &st ) && st.st_uid == getuid() &&
|
||||
+ !chmod( name, st.st_mode | S_IRUSR ))
|
||||
+ {
|
||||
+ fd->unix_fd = open( name, O_RDONLY | (flags & ~(O_TRUNC | O_CREAT | O_EXCL)), *mode );
|
||||
+ *mode = st.st_mode;
|
||||
+ do_chmod = 1;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ set_error( STATUS_ACCESS_DENIED );
|
||||
+ goto error;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if (fd->unix_fd == -1)
|
||||
{
|
||||
@@ -2123,6 +2141,8 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
set_error( STATUS_OBJECT_NAME_INVALID );
|
||||
else
|
||||
file_set_error();
|
||||
+
|
||||
+ if (do_chmod) chmod( name, *mode );
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@@ -2138,6 +2158,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
closed_fd->unix_fd = fd->unix_fd;
|
||||
closed_fd->disp_flags = 0;
|
||||
closed_fd->unix_name = fd->unix_name;
|
||||
+ if (do_chmod) chmod( name, *mode );
|
||||
fstat( fd->unix_fd, &st );
|
||||
*mode = st.st_mode;
|
||||
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,31 +0,0 @@
|
||||
From 9443494239616a5a9f1e7d5711324c435d04e035 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 3 Apr 2015 03:58:53 +0200
|
||||
Subject: server: When creating new directories temporarily give
|
||||
read-permissions until they are opened.
|
||||
|
||||
---
|
||||
server/fd.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/server/fd.c b/server/fd.c
|
||||
index 3afb89a..9a4aac4 100644
|
||||
--- a/server/fd.c
|
||||
+++ b/server/fd.c
|
||||
@@ -1774,7 +1774,12 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
|
||||
/* create the directory if needed */
|
||||
if ((options & FILE_DIRECTORY_FILE) && (flags & O_CREAT))
|
||||
{
|
||||
- if (mkdir( name, *mode ) == -1)
|
||||
+ if (mkdir( name, *mode | S_IRUSR ) != -1)
|
||||
+ {
|
||||
+ /* remove S_IRUSR later, after we have opened the directory */
|
||||
+ do_chmod = !(*mode & S_IRUSR);
|
||||
+ }
|
||||
+ else
|
||||
{
|
||||
if (errno != EEXIST || (flags & O_EXCL))
|
||||
{
|
||||
--
|
||||
2.3.3
|
||||
|
@ -1,7 +1,7 @@
|
||||
From b942e1cb4b0d96f9ea183048fa2b1409c9655c68 Mon Sep 17 00:00:00 2001
|
||||
From f4aabbf2f835d78815017e2ea2cbeb9a22dc9d88 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 3 Apr 2015 03:58:59 +0200
|
||||
Subject: [PATCH] advapi32/tests: Add tests for ACL inheritance in
|
||||
Subject: [PATCH 1/2] advapi32/tests: Add tests for ACL inheritance in
|
||||
CreateDirectoryA.
|
||||
|
||||
---
|
||||
@ -9,11 +9,11 @@ Subject: [PATCH] advapi32/tests: Add tests for ACL inheritance in
|
||||
1 file changed, 70 insertions(+)
|
||||
|
||||
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
|
||||
index 8c7888f9e52..1726236f424 100644
|
||||
index e2823fea63a..8188a358052 100644
|
||||
--- a/dlls/advapi32/tests/security.c
|
||||
+++ b/dlls/advapi32/tests/security.c
|
||||
@@ -3866,6 +3866,76 @@ static void test_CreateDirectoryA(void)
|
||||
LocalFree(pSD);
|
||||
@@ -3874,6 +3874,76 @@ static void test_CreateDirectoryA(void)
|
||||
}
|
||||
CloseHandle(hTemp);
|
||||
|
||||
+ /* Test inheritance of ACLs in CreateDirectory without security descriptor */
|
||||
|
@ -1,109 +0,0 @@
|
||||
From 9de95b5af44aa9ac1cec60a27c70a546258a954d Mon Sep 17 00:00:00 2001
|
||||
From: Qian Hong <qhong@codeweavers.com>
|
||||
Date: Fri, 15 May 2015 15:28:17 +0800
|
||||
Subject: [PATCH] ntdll/tests: Added tests for open behaviour on readonly
|
||||
files.
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/file.c | 78 +++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 78 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
|
||||
index 35fab8ca427..5d6f9b83152 100644
|
||||
--- a/dlls/ntdll/tests/file.c
|
||||
+++ b/dlls/ntdll/tests/file.c
|
||||
@@ -4259,6 +4259,83 @@ static void test_NtCreateFile(void)
|
||||
RemoveDirectoryW( path );
|
||||
}
|
||||
|
||||
+static void test_readonly(void)
|
||||
+{
|
||||
+ static const WCHAR fooW[] = {'f','o','o',0};
|
||||
+ NTSTATUS status;
|
||||
+ HANDLE handle;
|
||||
+ WCHAR path[MAX_PATH];
|
||||
+ OBJECT_ATTRIBUTES attr;
|
||||
+ IO_STATUS_BLOCK io;
|
||||
+ UNICODE_STRING nameW;
|
||||
+
|
||||
+ GetTempPathW(MAX_PATH, path);
|
||||
+ GetTempFileNameW(path, fooW, 0, path);
|
||||
+ DeleteFileW(path);
|
||||
+ pRtlDosPathNameToNtPathName_U(path, &nameW, NULL, NULL);
|
||||
+
|
||||
+ attr.Length = sizeof(attr);
|
||||
+ attr.RootDirectory = NULL;
|
||||
+ attr.ObjectName = &nameW;
|
||||
+ attr.Attributes = OBJ_CASE_INSENSITIVE;
|
||||
+ attr.SecurityDescriptor = NULL;
|
||||
+ attr.SecurityQualityOfService = NULL;
|
||||
+
|
||||
+ status = pNtCreateFile(&handle, GENERIC_READ, &attr, &io, NULL, FILE_ATTRIBUTE_READONLY,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_CREATE, 0, NULL, 0);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#lx\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, GENERIC_WRITE, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_ACCESS_DENIED, "got %#lx\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, GENERIC_READ, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#lx\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, FILE_READ_ATTRIBUTES, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#lx\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ 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 %#lx\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, DELETE, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#lx\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, READ_CONTROL, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#lx\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, WRITE_DAC, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#lx\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, WRITE_OWNER, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#lx\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, SYNCHRONIZE, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#lx\n", status);
|
||||
+ CloseHandle( handle );
|
||||
+
|
||||
+ pRtlFreeUnicodeString(&nameW);
|
||||
+ SetFileAttributesW(path, FILE_ATTRIBUTE_ARCHIVE);
|
||||
+ DeleteFileW(path);
|
||||
+}
|
||||
+
|
||||
static void test_read_write(void)
|
||||
{
|
||||
static const char contents[14] = "1234567890abcd";
|
||||
@@ -5838,6 +5915,7 @@ START_TEST(file)
|
||||
|
||||
test_read_write();
|
||||
test_NtCreateFile();
|
||||
+ test_readonly();
|
||||
create_file_test();
|
||||
open_file_test();
|
||||
delete_file_test();
|
||||
--
|
||||
2.35.1
|
||||
|
@ -1,39 +0,0 @@
|
||||
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 %#lx\n", status);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#lx\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
|
||||
|
@ -1,2 +0,0 @@
|
||||
Fixes: Allow to open files/directories without any access rights in order to query attributes
|
||||
Depends: ntdll-Junction_Points
|
Loading…
Reference in New Issue
Block a user