Rebase against 29dd84443976005a8ec713dd1c75458e27346591.

This commit is contained in:
Alistair Leslie-Hughes
2022-06-29 11:14:16 +10:00
parent 6be691c005
commit c9652a68e1
5 changed files with 39 additions and 34 deletions

View File

@@ -1,4 +1,4 @@
From c79db3f36aa653ec986ba948e547202fd95ed151 Mon Sep 17 00:00:00 2001
From fcd07d80234de455880990e2b2c488e9795f9dc0 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
@@ -9,14 +9,14 @@ Changes in v2:
* Pay attention to requested access attributes - this fixes a couple more todo_wine's.
---
dlls/advapi32/tests/security.c | 32 ++++++++++++--------------------
server/fd.c | 20 ++++++++++++++++++++
2 files changed, 32 insertions(+), 20 deletions(-)
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 135a45f7727..2147d0f1700 100644
index ed91ccc39d3..c534d1453d9 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -3710,17 +3710,13 @@ static void test_CreateDirectoryA(void)
@@ -3713,17 +3713,13 @@ static void test_CreateDirectoryA(void)
error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
(PSID *)&owner, NULL, &pDacl, NULL, &pSD);
@@ -40,7 +40,7 @@ index 135a45f7727..2147d0f1700 100644
CloseHandle(hTemp);
/* Test inheritance of ACLs in NtCreateFile without security descriptor */
@@ -3789,17 +3785,13 @@ static void test_CreateDirectoryA(void)
@@ -3792,17 +3788,13 @@ static void test_CreateDirectoryA(void)
error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
(PSID *)&owner, NULL, &pDacl, NULL, &pSD);
@@ -65,7 +65,7 @@ index 135a45f7727..2147d0f1700 100644
done:
diff --git a/server/fd.c b/server/fd.c
index 31b64b30d43..2ff0b480f40 100644
index bf59359de03..323dd92e653 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2044,6 +2044,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
@@ -76,7 +76,7 @@ index 31b64b30d43..2ff0b480f40 100644
int created = (flags & O_CREAT);
if (((options & FILE_DELETE_ON_CLOSE) && !(access & DELETE)) ||
@@ -2116,10 +2117,28 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
@@ -2116,6 +2117,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 );
}
@@ -100,12 +100,16 @@ index 31b64b30d43..2ff0b480f40 100644
if (fd->unix_fd == -1)
{
file_set_error();
@@ -2124,6 +2142,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;
}
}
@@ -2130,6 +2149,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
@@ -2134,6 +2154,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
closed_fd->unlink = 0;
closed_fd->unlink_name = fd->unlink_name;
closed_fd->unix_name = fd->unix_name;
@@ -114,5 +118,5 @@ index 31b64b30d43..2ff0b480f40 100644
*mode = st.st_mode;
--
2.34.1
2.35.1

View File

@@ -1,18 +1,19 @@
From c7b125afcbf75d7a95c0fcb78c0dadf8f30fd61f Mon Sep 17 00:00:00 2001
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: ntdll/tests: Added tests for open behaviour on readonly files.
Subject: [PATCH] ntdll/tests: Added tests for open behaviour on readonly
files.
---
dlls/ntdll/tests/file.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++
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 2df0edc..d365303 100644
index 35fab8ca427..5d6f9b83152 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2073,6 +2073,83 @@ static void test_NtCreateFile(void)
DeleteFileW( path );
@@ -4259,6 +4259,83 @@ static void test_NtCreateFile(void)
RemoveDirectoryW( path );
}
+static void test_readonly(void)
@@ -95,7 +96,7 @@ index 2df0edc..d365303 100644
static void test_read_write(void)
{
static const char contents[14] = "1234567890abcd";
@@ -2823,6 +2900,7 @@ START_TEST(file)
@@ -5838,6 +5915,7 @@ START_TEST(file)
test_read_write();
test_NtCreateFile();
@@ -104,5 +105,5 @@ index 2df0edc..d365303 100644
open_file_test();
delete_file_test();
--
2.4.2
2.35.1