Rebase against 2d6b0b67d91b6433744ec859b10b8ee8eb4a37b3.

This commit is contained in:
Zebediah Figura
2021-02-10 19:09:42 -06:00
parent 6347bdd1fc
commit 41e15516bd
36 changed files with 318 additions and 1419 deletions

View File

@@ -1,7 +1,7 @@
From 660851a75e0f3cb8fb0c10441f9f87bed3bdd586 Mon Sep 17 00:00:00 2001
From 43a042096de57734560d7745bce70c45722c44fa Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:02:11 -0700
Subject: server: Add support for deleting junction points with
Subject: [PATCH] server: Add support for deleting junction points with
RemoveDirectory.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
@@ -11,10 +11,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 61 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 49e2771f587..68747b312b4 100644
index 7ad25ffd239..5a2ac2114b0 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5191,7 +5191,7 @@ static void test_reparse_points(void)
@@ -5190,7 +5190,7 @@ static void test_reparse_points(void)
REPARSE_GUID_DATA_BUFFER guid_buffer;
static const WCHAR dotW[] = {'.',0};
REPARSE_DATA_BUFFER *buffer = NULL;
@@ -23,7 +23,7 @@ index 49e2771f587..68747b312b4 100644
INT buffer_len, string_len;
IO_STATUS_BLOCK iosb;
UNICODE_STRING nameW;
@@ -5280,6 +5280,38 @@ static void test_reparse_points(void)
@@ -5279,6 +5279,38 @@ static void test_reparse_points(void)
"Junction point folder's access time does not match.\n");
CloseHandle(handle);
@@ -63,7 +63,7 @@ index 49e2771f587..68747b312b4 100644
/* Cleanup */
pRtlFreeUnicodeString(&nameW);
diff --git a/server/fd.c b/server/fd.c
index edb59b0d540..622b3c246aa 100644
index 2dcdd04a892..b67814c7a4f 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -169,7 +169,8 @@ struct closed_fd
@@ -82,9 +82,9 @@ index edb59b0d540..622b3c246aa 100644
unsigned int sharing; /* file sharing mode */
+ char *unlink_name; /* file name to unlink on close */
char *unix_name; /* unix file name */
int unix_fd; /* unix file descriptor */
unsigned int no_fd_status;/* status to return when unix_fd is -1 */
@@ -1119,6 +1121,7 @@ static void inode_close_pending( struct inode *inode, int keep_unlinks )
WCHAR *nt_name; /* NT file name */
data_size_t nt_namelen; /* length of NT file name */
@@ -1121,6 +1123,7 @@ static void inode_close_pending( struct inode *inode, int keep_unlinks )
if (!keep_unlinks || !fd->unlink) /* get rid of it unless there's an unlink pending on that file */
{
list_remove( ptr );
@@ -92,7 +92,7 @@ index edb59b0d540..622b3c246aa 100644
free( fd->unix_name );
free( fd );
}
@@ -1153,12 +1156,13 @@ static void inode_destroy( struct object *obj )
@@ -1155,12 +1158,13 @@ static void inode_destroy( struct object *obj )
{
/* make sure it is still the same file */
struct stat st;
@@ -109,7 +109,7 @@ index edb59b0d540..622b3c246aa 100644
free( fd->unix_name );
free( fd );
}
@@ -1578,6 +1582,7 @@ static void fd_destroy( struct object *obj )
@@ -1581,6 +1585,7 @@ static void fd_destroy( struct object *obj )
else /* no inode, close it right away */
{
if (fd->unix_fd != -1) close( fd->unix_fd );
@@ -117,24 +117,24 @@ index edb59b0d540..622b3c246aa 100644
free( fd->unix_name );
}
}
@@ -1687,6 +1692,7 @@ static struct fd *alloc_fd_object(void)
@@ -1690,6 +1695,7 @@ static struct fd *alloc_fd_object(void)
fd->options = 0;
fd->sharing = 0;
fd->unix_fd = -1;
+ fd->unlink_name = NULL;
fd->unix_name = NULL;
fd->cacheable = 0;
fd->signaled = 1;
@@ -1722,6 +1728,7 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use
fd->nt_name = NULL;
fd->nt_namelen = 0;
@@ -1727,6 +1733,7 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use
fd->access = 0;
fd->options = options;
fd->sharing = 0;
+ fd->unlink_name = NULL;
fd->unix_name = NULL;
fd->unix_fd = -1;
fd->cacheable = 0;
@@ -1756,6 +1763,12 @@ struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sha
strcpy( fd->unix_name, orig->unix_name );
fd->nt_name = NULL;
fd->nt_namelen = 0;
@@ -1768,6 +1775,12 @@ struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sha
fd->nt_namelen = orig->nt_namelen;
}
+ if (orig->unlink_name)
@@ -146,7 +146,7 @@ index edb59b0d540..622b3c246aa 100644
if (orig->inode)
{
struct closed_fd *closed = mem_alloc( sizeof(*closed) );
@@ -1768,6 +1781,7 @@ struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sha
@@ -1780,6 +1793,7 @@ struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sha
}
closed->unix_fd = fd->unix_fd;
closed->unlink = 0;
@@ -154,7 +154,7 @@ index edb59b0d540..622b3c246aa 100644
closed->unix_name = fd->unix_name;
fd->closed = closed;
fd->inode = (struct inode *)grab_object( orig->inode );
@@ -1909,18 +1923,19 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1964,18 +1978,19 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
fd->unix_name = NULL;
if ((path = dup_fd_name( root, name )))
{
@@ -177,7 +177,7 @@ index edb59b0d540..622b3c246aa 100644
{
unsigned int err;
struct inode *inode = get_inode( st.st_dev, st.st_ino, fd->unix_fd );
@@ -1938,6 +1953,9 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1993,6 +2008,9 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
list_add_head( &inode->open, &fd->inode_entry );
closed_fd = NULL;
@@ -187,10 +187,10 @@ index edb59b0d540..622b3c246aa 100644
/* check directory options */
if ((options & FILE_DIRECTORY_FILE) && !S_ISDIR(st.st_mode))
{
@@ -2563,10 +2581,11 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr,
fchmod( fd->unix_fd, st.st_mode );
}
@@ -2610,10 +2628,11 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
free( fd->nt_name );
fd->nt_name = dup_nt_name( root, nt_name, &fd->nt_namelen );
+ free( fd->unlink_name );
free( fd->unix_name );
+ fd->closed->unlink_name = fd->unlink_name = name;
@@ -202,5 +202,5 @@ index edb59b0d540..622b3c246aa 100644
return;
--
2.17.1
2.20.1

View File

@@ -1,7 +1,7 @@
From 39739eab0295b80aa081bda4899d7920a5690e09 Mon Sep 17 00:00:00 2001
From c4916e098d2aefe4f078bc9c396015e15d6ed9d4 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sat, 30 Mar 2019 13:41:07 -0600
Subject: server: Properly handle file symlink deletion.
Subject: [PATCH] server: Properly handle file symlink deletion.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
@@ -10,10 +10,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 62 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 8d61257e1e5..b9d9c817eaa 100644
index e6c6807e0b2..0c7c5a1bf57 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5389,18 +5389,18 @@ static void test_reparse_points(void)
@@ -5386,18 +5386,18 @@ static void test_reparse_points(void)
/* Check deleting a file symlink as if it were a directory */
bret = RemoveDirectoryW(reparse_path);
@@ -39,11 +39,11 @@ index 8d61257e1e5..b9d9c817eaa 100644
/* Create a blank slate for directory symlink tests */
bret = CreateDirectoryW(reparse_path, NULL);
diff --git a/server/fd.c b/server/fd.c
index d15e727d19f..0d8eece7bcb 100644
index fe662ce6bb5..8613769c1bf 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1849,6 +1849,55 @@ char *dup_fd_name( struct fd *root, const char *name )
return ret;
@@ -1902,6 +1902,55 @@ void get_nt_name( struct fd *fd, struct unicode_str *name )
name->len = fd->nt_namelen;
}
+static void decode_symlink(char *name, int *is_dir)
@@ -96,9 +96,9 @@ index d15e727d19f..0d8eece7bcb 100644
+}
+
/* open() wrapper that returns a struct fd with no fd user set */
struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, unsigned int access,
unsigned int sharing, unsigned int options )
@@ -1948,6 +1997,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_name,
int flags, mode_t *mode, unsigned int access,
@@ -2003,6 +2052,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
{
unsigned int err;
struct inode *inode = get_inode( st.st_dev, st.st_ino, fd->unix_fd );
@@ -106,7 +106,7 @@ index d15e727d19f..0d8eece7bcb 100644
if (!inode)
{
@@ -1962,16 +2012,20 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -2017,16 +2067,20 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
list_add_head( &inode->open, &fd->inode_entry );
closed_fd = NULL;
@@ -130,5 +130,5 @@ index d15e727d19f..0d8eece7bcb 100644
set_error( STATUS_FILE_IS_A_DIRECTORY );
goto error;
--
2.17.1
2.20.1