ntdll-Junction_Points: Replace another symlink() with symlinkat().

Evidently accidentally omitted in 769ddd9f00.

Spotted by Aida Jonikienė.
This commit is contained in:
Zebediah Figura 2024-02-09 13:27:47 -06:00
parent ef52b15ad6
commit aa9b8391c0

View File

@ -1,7 +1,8 @@
From f3234130493d1d99545a46e262646c1486e9de86 Mon Sep 17 00:00:00 2001
From 88bdec9c242b2b7eaafa7d47a09679c3681ae4af Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Sat, 6 Feb 2021 16:16:17 -0700
Subject: ntdll: Add an intermediary prefix symlink in reparse point metadata.
Subject: [PATCH] ntdll: Add an intermediary prefix symlink in reparse point
metadata.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
@ -9,10 +10,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
1 file changed, 39 insertions(+)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 980251b8bbf..f298b1f7a6c 100644
index 5d7095086d9..870a727b48f 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3545,6 +3545,18 @@ static NTSTATUS get_reparse_target( UNICODE_STRING *nt_target, REPARSE_DATA_BUFF
@@ -3577,6 +3577,18 @@ static NTSTATUS get_reparse_target( UNICODE_STRING *nt_target, REPARSE_DATA_BUFF
}
@ -31,7 +32,7 @@ index 980251b8bbf..f298b1f7a6c 100644
/* add a symlink to the unix target at the last point of the reparse point metadata */
NTSTATUS create_reparse_target( int dirfd, const char *unix_src, int depth, const char *link_path,
REPARSE_DATA_BUFFER *buffer )
@@ -3639,6 +3651,8 @@ NTSTATUS create_reparse_target( int dirfd, const char *unix_src, int depth, cons
@@ -3671,6 +3683,8 @@ NTSTATUS create_reparse_target( int dirfd, const char *unix_src, int depth, cons
/* create the symlink to the target at the last metadata location */
if (status == STATUS_SUCCESS || status == STATUS_NO_SUCH_FILE)
{
@ -40,7 +41,7 @@ index 980251b8bbf..f298b1f7a6c 100644
int relative_offset;
target_path[0] = 0;
@@ -3648,8 +3662,21 @@ NTSTATUS create_reparse_target( int dirfd, const char *unix_src, int depth, cons
@@ -3680,8 +3694,21 @@ NTSTATUS create_reparse_target( int dirfd, const char *unix_src, int depth, cons
relative_offset = 0;
is_relative = FALSE;
}
@ -53,7 +54,7 @@ index 980251b8bbf..f298b1f7a6c 100644
+ strcpy( prefix_link, link_path );
+ prefix_link[strlen(prefix_link)-1] = 0;
+ strcat( prefix_link, prefix_string );
+ symlink( config_dir, prefix_link );
+ symlinkat( config_dir, dirfd, prefix_link );
+ }
for (;is_relative && depth > 0; depth--)
strcat( target_path, "../" );
@ -62,7 +63,7 @@ index 980251b8bbf..f298b1f7a6c 100644
strcat( target_path, &unix_target[relative_offset] );
TRACE( "adding reparse point target: %s\n", target_path );
symlinkat( target_path, dirfd, link_path );
@@ -3855,6 +3882,7 @@ cleanup:
@@ -3887,6 +3914,7 @@ cleanup:
NTSTATUS get_reparse_point_unix(const char *unix_name, REPARSE_DATA_BUFFER *buffer, ULONG *size)
{
char link_dir[PATH_MAX], link_path[PATH_MAX], *d;
@ -70,7 +71,7 @@ index 980251b8bbf..f298b1f7a6c 100644
int link_path_len, buffer_len, encoded_len;
REPARSE_DATA_BUFFER header;
ULONG out_size = *size;
@@ -3953,6 +3981,17 @@ NTSTATUS get_reparse_point_unix(const char *unix_name, REPARSE_DATA_BUFFER *buff
@@ -3985,6 +4013,17 @@ NTSTATUS get_reparse_point_unix(const char *unix_name, REPARSE_DATA_BUFFER *buff
link_dir_fd = fd;
}
@ -89,5 +90,5 @@ index 980251b8bbf..f298b1f7a6c 100644
*size = decode_base64url( encoded, strlen(encoded), (char*)buffer );
status = STATUS_SUCCESS;
--
2.17.1
2.43.0