Rebase against a8c1d5c108fc57e4d78e9db126f395c89083a83d.

This commit is contained in:
Zebediah Figura
2022-11-14 17:51:19 -06:00
parent a16b6b9c1e
commit 5088fc67ba
8 changed files with 84 additions and 200 deletions

View File

@@ -1,7 +1,7 @@
From a3eedb8eb82f841ae48633d1e3c0416a362ccd34 Mon Sep 17 00:00:00 2001
From beaeb1935534ce99aa19b8009184b07bd602a24c Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sat, 3 Sep 2022 11:23:31 -0600
Subject: ntdll: Follow reparse points during path resolution.
Subject: [PATCH] ntdll: Follow reparse points during path resolution.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
@@ -44,10 +44,10 @@ index 390768f557d..a0b84849490 100644
ok(bret, "Failed to remove temporary reparse point directory!\n");
bret = RemoveDirectoryW(target_path);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 9ae5e194c6d..ba844e90272 100644
index 9211c6964a6..e90670ffc71 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3516,6 +3516,35 @@ done:
@@ -3548,6 +3548,35 @@ done:
}
@@ -83,7 +83,7 @@ index 9ae5e194c6d..ba844e90272 100644
/*
* Retrieve the unix name corresponding to a file handle, remove that directory, and then symlink
* the requested directory to the location of the old directory.
@@ -3692,16 +3721,14 @@ cleanup:
@@ -3724,16 +3753,14 @@ cleanup:
/*
@@ -102,7 +102,7 @@ index 9ae5e194c6d..ba844e90272 100644
char *encoded = NULL;
int link_dir_fd = -1;
NTSTATUS status;
@@ -3709,9 +3736,6 @@ NTSTATUS get_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG *si
@@ -3741,9 +3768,6 @@ NTSTATUS get_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG *si
int depth;
char *p;
@@ -112,7 +112,7 @@ index 9ae5e194c6d..ba844e90272 100644
ret = readlink( unix_name, link_path, sizeof(link_path) );
if (ret < 0)
{
@@ -3811,12 +3835,76 @@ NTSTATUS get_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG *si
@@ -3843,12 +3867,76 @@ NTSTATUS get_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG *si
cleanup:
if (link_dir_fd != -1) close( link_dir_fd );
@@ -190,7 +190,7 @@ index 9ae5e194c6d..ba844e90272 100644
/*
* Retrieve the unix name corresponding to a file handle, remove that symlink, and then recreate
* a directory at the location of the old filename.
@@ -3910,15 +3998,25 @@ cleanup:
@@ -3942,15 +4030,25 @@ cleanup:
}
@@ -218,7 +218,7 @@ index 9ae5e194c6d..ba844e90272 100644
NTSTATUS status;
int ret;
struct stat st;
@@ -3975,6 +4073,8 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
@@ -4007,6 +4105,8 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
while (name_len)
{
const WCHAR *end, *next;
@@ -227,7 +227,7 @@ index 9ae5e194c6d..ba844e90272 100644
end = name;
while (end < name + name_len && *end != '\\') end++;
@@ -3994,8 +4094,31 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
@@ -4026,8 +4126,31 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
status = find_file_in_dir( unix_name, pos, name, end - name, is_unix );
@@ -260,7 +260,7 @@ index 9ae5e194c6d..ba844e90272 100644
{
if (status == STATUS_OBJECT_NAME_NOT_FOUND)
{
@@ -4034,12 +4157,12 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
@@ -4066,12 +4189,12 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
/******************************************************************************
* nt_to_unix_file_name_no_root
*/
@@ -275,7 +275,7 @@ index 9ae5e194c6d..ba844e90272 100644
NTSTATUS status = STATUS_SUCCESS;
const WCHAR *name;
struct stat st;
@@ -4129,7 +4252,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
@@ -4161,7 +4284,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
name += prefix_len;
name_len -= prefix_len;
@@ -284,17 +284,17 @@ index 9ae5e194c6d..ba844e90272 100644
if (status == STATUS_SUCCESS || status == STATUS_NO_SUCH_FILE)
{
TRACE( "%s -> %s\n", debugstr_us(nameW), debugstr_a(unix_name) );
@@ -4137,7 +4260,8 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
@@ -4169,7 +4292,8 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
}
else
{
- TRACE( "%s not found in %s\n", debugstr_w(name), unix_name );
- TRACE( "%s not found in %s\n", debugstr_w(name), debugstr_an(unix_name, pos) );
+ if (status != STATUS_REPARSE)
+ TRACE( "%s not found in %s\n", debugstr_w(name), unix_name );
+ TRACE( "%s not found in %s\n", debugstr_w(name), debugstr_an(unix_name, pos) );
free( unix_name );
}
return status;
@@ -4155,18 +4279,30 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
@@ -4187,18 +4311,30 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
*/
NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, UINT disposition )
{
@@ -329,7 +329,7 @@ index 9ae5e194c6d..ba844e90272 100644
if (name_len && name[0] == '\\') return STATUS_INVALID_PARAMETER;
@@ -4174,7 +4310,7 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U
@@ -4206,7 +4342,7 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U
if (!(unix_name = malloc( unix_len ))) return STATUS_NO_MEMORY;
unix_name[0] = '.';
@@ -338,7 +338,7 @@ index 9ae5e194c6d..ba844e90272 100644
{
if (type != FD_TYPE_DIR)
{
@@ -4186,7 +4322,8 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U
@@ -4218,7 +4354,8 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U
mutex_lock( &dir_mutex );
if ((old_cwd = open( ".", O_RDONLY )) != -1 && fchdir( root_fd ) != -1)
{
@@ -348,7 +348,7 @@ index 9ae5e194c6d..ba844e90272 100644
if (fchdir( old_cwd ) == -1) chdir( "/" );
}
else status = errno_to_status( errno );
@@ -4199,14 +4336,22 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U
@@ -4231,14 +4368,22 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U
if (status == STATUS_SUCCESS || status == STATUS_NO_SUCH_FILE)
{
@@ -373,5 +373,5 @@ index 9ae5e194c6d..ba844e90272 100644
}
--
2.17.1
2.35.1