ntdll-Junction_Points: Updates from Erich E. Hoover.

This commit is contained in:
Zebediah Figura
2021-02-03 19:44:26 -06:00
parent 2be4bfb8fe
commit cfe1b94e0f
34 changed files with 430 additions and 444 deletions

View File

@@ -1,4 +1,4 @@
From 7f1169fde63549646dcd24d60ea648db3a11765c Mon Sep 17 00:00:00 2001
From 0b74f0d359fb05b1b38f211269313b7e02690e86 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
@@ -13,10 +13,10 @@ Changes in v2:
2 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 825f8451904..948c257cea2 100644
index 020e69277e0..9466b01bc99 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -3702,17 +3702,13 @@ static void test_CreateDirectoryA(void)
@@ -3699,17 +3699,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 825f8451904..948c257cea2 100644
CloseHandle(hTemp);
/* Test inheritance of ACLs in NtCreateFile without security descriptor */
@@ -3781,17 +3777,13 @@ static void test_CreateDirectoryA(void)
@@ -3778,17 +3774,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,10 +65,10 @@ index 825f8451904..948c257cea2 100644
done:
diff --git a/server/fd.c b/server/fd.c
index 819f77d041e..c1401acc1aa 100644
index c0425694294..100881f21a6 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1892,6 +1892,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1908,6 +1908,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
int root_fd = -1;
int rw_mode;
char *path;
@@ -76,10 +76,10 @@ index 819f77d041e..c1401acc1aa 100644
int created = (flags & O_CREAT);
if (((options & FILE_DELETE_ON_CLOSE) && !(access & DELETE)) ||
@@ -1958,10 +1959,28 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
fd->unix_fd = open( name, rw_mode | O_SYMLINK | (flags & ~O_TRUNC), *mode );
@@ -1972,10 +1973,28 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
if ((access & FILE_UNIX_WRITE_ACCESS) || (flags & O_CREAT))
fd->unix_fd = open( name, O_RDONLY | (flags & ~(O_TRUNC | O_CREAT | O_EXCL)), *mode );
}
#endif
+ else if (errno == EACCES)
+ {
+ /* try to change permissions temporarily to open a file descriptor */
@@ -105,7 +105,7 @@ index 819f77d041e..c1401acc1aa 100644
goto error;
}
}
@@ -1978,6 +1997,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1992,6 +2011,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
closed_fd->unlink = 0;
closed_fd->unlink_name = fd->unlink_name;
closed_fd->unix_name = fd->unix_name;
@@ -114,5 +114,5 @@ index 819f77d041e..c1401acc1aa 100644
*mode = st.st_mode;
--
2.27.0
2.20.1