Updated ntdll-Junction_Points patchset

This commit is contained in:
Alistair Leslie-Hughes 2019-05-13 08:14:41 +10:00
parent 3134cc0b2d
commit 92cc7818b2
2 changed files with 18 additions and 16 deletions

View File

@ -1,16 +1,16 @@
From 20171f2a705fdf94966e9661d360ac70bb92cb8e Mon Sep 17 00:00:00 2001
From 9a808d848f2a57140822c31047ce882c75d74b99 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sat, 30 Mar 2019 12:00:51 -0600
Subject: ntdll: Correctly report file symbolic links as files.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/file.c | 118 ++++++++++++++++++++++++++--------------
dlls/ntdll/file.c | 120 ++++++++++++++++++++++++++--------------
dlls/ntdll/tests/file.c | 8 +--
2 files changed, 82 insertions(+), 44 deletions(-)
2 files changed, 84 insertions(+), 44 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 04d34dd572..8336392ddb 100644
index 04d34dd572..57d7d334d5 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -124,6 +124,9 @@ mode_t FILE_umask = 0;
@ -23,7 +23,7 @@ index 04d34dd572..8336392ddb 100644
/* fetch the attributes of a file */
static inline ULONG get_file_attributes( const struct stat *st )
{
@@ -160,10 +163,13 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -160,10 +163,15 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
if (ret == -1) return ret;
if (S_ISLNK( st->st_mode ))
{
@ -33,6 +33,8 @@ index 04d34dd572..8336392ddb 100644
- if (S_ISDIR( st->st_mode )) *attr |= FILE_ATTRIBUTE_REPARSE_POINT;
+ BOOL is_dir;
+
+ /* return information about the destination (unless this is a dangling symlink) */
+ stat( path, st );
+ /* symbolic links (either junction points or NT symlinks) are "reparse points" */
+ *attr |= FILE_ATTRIBUTE_REPARSE_POINT;
+ /* whether a reparse point is a file or a directory is stored inside the link target */
@ -41,7 +43,7 @@ index 04d34dd572..8336392ddb 100644
}
*attr |= get_file_attributes( st );
return ret;
@@ -1826,48 +1832,33 @@ cleanup:
@@ -1826,48 +1834,33 @@ cleanup:
}
@ -105,7 +107,7 @@ index 04d34dd572..8336392ddb 100644
p++;
}
if (*p++ != '/')
@@ -1875,7 +1866,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1875,7 +1868,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
status = STATUS_NOT_IMPLEMENTED;
goto cleanup;
}
@ -114,7 +116,7 @@ index 04d34dd572..8336392ddb 100644
for (i = 0; i < sizeof(ULONG)*8; i++)
{
char c = *p++;
@@ -1890,21 +1881,68 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1890,21 +1883,68 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
status = STATUS_NOT_IMPLEMENTED;
goto cleanup;
}

View File

@ -1,7 +1,7 @@
From 5eb8e81e70075947729f70e59825d472db8faf2a Mon Sep 17 00:00:00 2001
From 7e42a251daf77f13b3299d5955879161128a4065 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 1 May 2019 12:06:20 -0600
Subject: ntdll: Always report symbolic links as containing zero bytes.
Subject: [PATCH] ntdll: Always report symbolic links as containing zero bytes.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
@ -10,20 +10,20 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 934577bfba..cf98b1cfdd 100644
index 5390c4b..7481864 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -153,6 +153,8 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
BOOL is_dir;
@@ -155,6 +155,8 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
/* return information about the destination (unless this is a dangling symlink) */
stat( path, st );
+ /* symbolic links always report size 0 */
+ st->st_size = 0;
/* symbolic links (either junction points or NT symlinks) are "reparse points" */
*attr |= FILE_ATTRIBUTE_REPARSE_POINT;
/* whether a reparse point is a file or a directory is stored inside the link target */
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 5f42ad5e0b..36c021acd7 100644
index 5f42ad5..36c021a 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -4897,6 +4897,7 @@ static void test_reparse_points(void)
@ -89,5 +89,5 @@ index 5f42ad5e0b..36c021acd7 100644
/* Create the directory symlink */
HeapFree(GetProcessHeap(), 0, buffer);
--
2.17.1
1.9.1