mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
server-RootDirectory_File: Duplicated file has to be completely decoupled from original one.
This commit is contained in:
parent
4c9804d9f5
commit
6d2e3ce903
@ -4158,12 +4158,12 @@ fi
|
||||
# Patchset server-RootDirectory_File
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/tests/file.c, server/fd.c, server/file.c
|
||||
# | * dlls/ntdll/tests/file.c, server/fd.c, server/file.c, server/file.h
|
||||
# |
|
||||
if test "$enable_server_RootDirectory_File" -eq 1; then
|
||||
patch_apply server-RootDirectory_File/0001-server-Fix-handling-of-opening-a-file-with-RootDirec.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "server: Fix handling of opening a file with RootDirectory pointing to a file handle.", 2 },';
|
||||
echo '+ { "Sebastian Lackner", "server: Fix handling of opening a file with RootDirectory pointing to a file handle.", 3 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
@ -1,19 +1,20 @@
|
||||
From af265638496273ffd4369c8d6c3a2a7b2c1daa48 Mon Sep 17 00:00:00 2001
|
||||
From 00cbc5646ce0153babf9f3cebf07461ffaaabaee Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 29 May 2015 22:49:24 +0200
|
||||
Subject: server: Fix handling of opening a file with RootDirectory pointing to
|
||||
a file handle. (v2)
|
||||
a file handle. (v3)
|
||||
|
||||
Changes in v2:
|
||||
* Seek back to the beginning of file in duplicated file descriptor.
|
||||
---
|
||||
dlls/ntdll/tests/file.c | 39 ++++++++++++++++++++++++++++++++++++---
|
||||
server/fd.c | 32 ++++++++++++++++++++++++++------
|
||||
server/file.c | 24 +++++++++++++++++++++++-
|
||||
3 files changed, 85 insertions(+), 10 deletions(-)
|
||||
dlls/ntdll/tests/file.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
server/fd.c | 34 +++++++++++++++++++++++++++-------
|
||||
server/file.c | 23 ++++++++++++++++++++++-
|
||||
server/file.h | 1 +
|
||||
4 files changed, 96 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
|
||||
index 2df0edc..7999e3a 100644
|
||||
index 2df0edc..f6a6154 100644
|
||||
--- a/dlls/ntdll/tests/file.c
|
||||
+++ b/dlls/ntdll/tests/file.c
|
||||
@@ -297,7 +297,8 @@ static void create_file_test(void)
|
||||
@ -51,7 +52,7 @@ index 2df0edc..7999e3a 100644
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
@@ -443,13 +453,36 @@ static void open_file_test(void)
|
||||
@@ -443,13 +453,46 @@ static void open_file_test(void)
|
||||
ok( !status, "open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
|
||||
pRtlFreeUnicodeString( &nameW );
|
||||
|
||||
@ -80,19 +81,38 @@ index 2df0edc..7999e3a 100644
|
||||
- todo_wine ok( !status, "open %s failed %x\n", wine_dbgstr_w(tmpfile), status );
|
||||
+ ok( !status, "open %s failed %x\n", wine_dbgstr_w(tmpfile), status );
|
||||
+
|
||||
+ numbytes = SetFilePointer( file, 0, 0, FILE_CURRENT );
|
||||
+ ok( numbytes == sizeof(testdata) - 1, "SetFilePointer returned %u\n", numbytes );
|
||||
+ numbytes = SetFilePointer( root, 0, 0, FILE_CURRENT );
|
||||
+ ok( numbytes == 0, "SetFilePointer returned %u\n", numbytes );
|
||||
+
|
||||
+ numbytes = 0xdeadbeef;
|
||||
+ memset( data, 0, sizeof(data) );
|
||||
+ ret = ReadFile( root, data, sizeof(data), &numbytes, NULL );
|
||||
+ ok( ret, "ReadFile failed with error %u\n", GetLastError() );
|
||||
+ ok( numbytes == sizeof(testdata) - 1, "failed to read all data\n" );
|
||||
+ ok( !memcmp( data, testdata, sizeof(testdata) - 1 ), "testdata doesn't match\n" );
|
||||
+
|
||||
+ numbytes = SetFilePointer( file, 0, 0, FILE_CURRENT );
|
||||
+ ok( numbytes == sizeof(testdata) - 1, "SetFilePointer returned %u\n", numbytes );
|
||||
+ numbytes = SetFilePointer( root, 0, 0, FILE_CURRENT );
|
||||
+ ok( numbytes == sizeof(testdata) - 1, "SetFilePointer returned %u\n", numbytes );
|
||||
|
||||
CloseHandle( file );
|
||||
CloseHandle( root );
|
||||
diff --git a/server/fd.c b/server/fd.c
|
||||
index f0a52ad..2fee65d 100644
|
||||
index f0a52ad..2354b40 100644
|
||||
--- a/server/fd.c
|
||||
+++ b/server/fd.c
|
||||
@@ -1712,7 +1712,7 @@ void set_fd_user( struct fd *fd, const struct fd_ops *user_ops, struct object *u
|
||||
fd->user = user;
|
||||
}
|
||||
|
||||
-static char *dup_fd_name( struct fd *root, const char *name )
|
||||
+char *dup_fd_name( struct fd *root, const char *name )
|
||||
{
|
||||
char *ret;
|
||||
|
||||
@@ -2238,14 +2238,36 @@ DECL_HANDLER(flush)
|
||||
DECL_HANDLER(open_file_object)
|
||||
{
|
||||
@ -144,7 +164,7 @@ index f0a52ad..2fee65d 100644
|
||||
|
||||
/* get the Unix name from a file handle */
|
||||
diff --git a/server/file.c b/server/file.c
|
||||
index 792bbe0..1765d1b 100644
|
||||
index 792bbe0..a189465 100644
|
||||
--- a/server/file.c
|
||||
+++ b/server/file.c
|
||||
@@ -67,6 +67,8 @@ static void file_dump( struct object *obj, int verbose );
|
||||
@ -165,7 +185,7 @@ index 792bbe0..1765d1b 100644
|
||||
fd_close_handle, /* close_handle */
|
||||
file_destroy /* destroy */
|
||||
};
|
||||
@@ -597,6 +599,26 @@ static int file_set_sd( struct object *obj, const struct security_descriptor *sd
|
||||
@@ -597,6 +599,25 @@ static int file_set_sd( struct object *obj, const struct security_descriptor *sd
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -174,24 +194,35 @@ index 792bbe0..1765d1b 100644
|
||||
+{
|
||||
+ struct file *file = (struct file *)obj;
|
||||
+ struct object *new_file = NULL;
|
||||
+ struct fd *new_fd;
|
||||
+ char *unix_name;
|
||||
+
|
||||
+ assert( obj->ops == &file_ops );
|
||||
+
|
||||
+ access = generic_file_map_access( access );
|
||||
+ if ((new_fd = dup_fd_object( file->fd, access, sharing, options )))
|
||||
+ if ((unix_name = dup_fd_name( file->fd, "" )))
|
||||
+ {
|
||||
+ lseek( get_unix_fd(new_fd), SEEK_SET, 0 );
|
||||
+ new_file = create_file_obj( new_fd, access, file->mode );
|
||||
+ release_object( new_fd );
|
||||
+ new_file = create_file( NULL, unix_name, strlen(unix_name), access,
|
||||
+ sharing, FILE_OPEN, options, 0, NULL );
|
||||
+ free( unix_name );
|
||||
+ }
|
||||
+
|
||||
+ else set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
||||
+ return new_file;
|
||||
+}
|
||||
+
|
||||
static void file_destroy( struct object *obj )
|
||||
{
|
||||
struct file *file = (struct file *)obj;
|
||||
diff --git a/server/file.h b/server/file.h
|
||||
index b5e0ca7..b59de1c 100644
|
||||
--- a/server/file.h
|
||||
+++ b/server/file.h
|
||||
@@ -81,6 +81,7 @@ extern void unlock_fd( struct fd *fd, file_pos_t offset, file_pos_t count );
|
||||
extern void allow_fd_caching( struct fd *fd );
|
||||
extern void set_fd_signaled( struct fd *fd, int signaled );
|
||||
extern int is_fd_signaled( struct fd *fd );
|
||||
+extern char *dup_fd_name( struct fd *root, const char *name );
|
||||
|
||||
extern int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry );
|
||||
extern unsigned int default_fd_map_access( struct object *obj, unsigned int access );
|
||||
--
|
||||
2.4.2
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From de99b35d5f2a612504f45324b17aa7a3c992f2ce Mon Sep 17 00:00:00 2001
|
||||
From 2884ad4a99443701819564254dc21289d6f13aec Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Mon, 30 Mar 2015 12:50:21 +0200
|
||||
Subject: server: Temporarily store the full security descriptor for file
|
||||
@ -7,9 +7,9 @@ Subject: server: Temporarily store the full security descriptor for file
|
||||
---
|
||||
dlls/advapi32/tests/security.c | 15 +++----
|
||||
server/change.c | 8 +++-
|
||||
server/file.c | 90 ++++++++++++++++++++++++++++--------------
|
||||
server/file.c | 88 ++++++++++++++++++++++++++++--------------
|
||||
server/file.h | 3 +-
|
||||
4 files changed, 75 insertions(+), 41 deletions(-)
|
||||
4 files changed, 74 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
|
||||
index 40cf23c..57adc4e 100644
|
||||
@ -95,7 +95,7 @@ index b334fd1..2e98f5c 100644
|
||||
|
||||
return &dir->obj;
|
||||
diff --git a/server/file.c b/server/file.c
|
||||
index 9ce3a6e..9497b45 100644
|
||||
index 011c29f..175fbce 100644
|
||||
--- a/server/file.c
|
||||
+++ b/server/file.c
|
||||
@@ -172,7 +172,8 @@ struct file *create_file_for_fd_obj( struct fd *fd, unsigned int access, unsigne
|
||||
@ -227,16 +227,7 @@ index 9ce3a6e..9497b45 100644
|
||||
}
|
||||
|
||||
static struct object *file_open_file( struct object *obj, unsigned int access,
|
||||
@@ -617,7 +644,7 @@ static struct object *file_open_file( struct object *obj, unsigned int access,
|
||||
if ((new_fd = dup_fd_object( file->fd, access, sharing, options )))
|
||||
{
|
||||
lseek( get_unix_fd(new_fd), SEEK_SET, 0 );
|
||||
- new_file = create_file_obj( new_fd, access, file->mode );
|
||||
+ new_file = create_file_obj( new_fd, access, file->mode, NULL );
|
||||
release_object( new_fd );
|
||||
}
|
||||
|
||||
@@ -734,7 +761,10 @@ DECL_HANDLER(create_file)
|
||||
@@ -733,7 +760,10 @@ DECL_HANDLER(create_file)
|
||||
if ((file = create_file( root_fd, name, name_len, req->access, req->sharing,
|
||||
req->create, req->options, req->attrs, sd )))
|
||||
{
|
||||
@ -249,10 +240,10 @@ index 9ce3a6e..9497b45 100644
|
||||
}
|
||||
if (root_fd) release_object( root_fd );
|
||||
diff --git a/server/file.h b/server/file.h
|
||||
index e26be80..d002b0d 100644
|
||||
index b9e27e2..3274c5c 100644
|
||||
--- a/server/file.h
|
||||
+++ b/server/file.h
|
||||
@@ -153,7 +153,8 @@ extern struct device *create_unix_device( struct directory *root, const struct u
|
||||
@@ -154,7 +154,8 @@ extern struct device *create_unix_device( struct directory *root, const struct u
|
||||
|
||||
extern void do_change_notify( int unix_fd );
|
||||
extern void sigio_callback(void);
|
||||
|
Loading…
Reference in New Issue
Block a user