Added patch to report correct ObjectName for NamedPipe wineserver objects (fixes Wine Staging Bug #363).

This commit is contained in:
Sebastian Lackner 2015-08-17 01:25:22 +02:00
parent 79253e6534
commit 84aaa8ff12
7 changed files with 278 additions and 1 deletions

View File

@ -39,7 +39,7 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [10]:**
**Bug fixes and features included in the next upcoming release [11]:**
* Add IDragSourceHelper stub interface ([Wine Bug #24699](https://bugs.winehq.org/show_bug.cgi?id=24699))
* Catch invalid memory accesses in imagehlp.CheckSumMappedFile
@ -51,6 +51,7 @@ Included bug fixes and improvements
* Improve startup performance by delaying font initialization
* Only set SFGAO_HASSUBFOLDER when there are really subfolders ([Wine Bug #24851](https://bugs.winehq.org/show_bug.cgi?id=24851))
* Properly implement imagehlp.ImageLoad and ImageUnload
* Report correct ObjectName for NamedPipe wineserver objects
**Bug fixes and features in Wine Staging 1.7.49 [235]:**

2
debian/changelog vendored
View File

@ -12,6 +12,8 @@ wine-staging (1.7.50) UNRELEASED; urgency=low
* Added patch to set SFGAO_HASSUBFOLDER only when there are really subfolders.
* Added patch to fix multiple uninitialized memory issues in wineserver.
* Added patch to implement shell32 NewMenu class with new folder item.
* Added patch to report correct ObjectName for NamedPipe wineserver objects
(fixes Wine Staging Bug #363).
* Removed patch to move security cookie initialization from memory management
to loader.
-- Sebastian Lackner <sebastian@fds-team.de> Tue, 11 Aug 2015 06:12:14 +0200

View File

@ -215,6 +215,7 @@ patch_enable_all ()
enable_server_Misc_ACL="$1"
enable_server_OpenProcess="$1"
enable_server_PeekMessage="$1"
enable_server_Pipe_ObjectName="$1"
enable_server_Realtime_Priority="$1"
enable_server_Registry_Timestamp="$1"
enable_server_RootDirectory_File="$1"
@ -736,6 +737,9 @@ patch_enable ()
server-PeekMessage)
enable_server_PeekMessage="$2"
;;
server-Pipe_ObjectName)
enable_server_Pipe_ObjectName="$2"
;;
server-Realtime_Priority)
enable_server_Realtime_Priority="$2"
;;
@ -1713,6 +1717,13 @@ if test "$enable_server_Shared_Memory" -eq 1; then
enable_server_PeekMessage=1
fi
if test "$enable_server_Pipe_ObjectName" -eq 1; then
if test "$enable_kernel32_Named_Pipe" -gt 1; then
abort "Patchset kernel32-Named_Pipe disabled, but server-Pipe_ObjectName depends on that."
fi
enable_kernel32_Named_Pipe=1
fi
if test "$enable_server_ACL_Compat" -eq 1; then
if test "$enable_server_Inherited_ACLs" -gt 1; then
abort "Patchset server-Inherited_ACLs disabled, but server-ACL_Compat depends on that."
@ -4532,6 +4543,25 @@ if test "$enable_server_PeekMessage" -eq 1; then
) >> "$patchlist"
fi
# Patchset server-Pipe_ObjectName
# |
# | This patchset has the following dependencies:
# | * kernel32-Named_Pipe
# |
# | Modified files:
# | * server/named_pipe.c, server/object.c, server/object.h
# |
if test "$enable_server_Pipe_ObjectName" -eq 1; then
patch_apply server-Pipe_ObjectName/0001-server-Move-parent-reference-from-object_name-to-obj.patch
patch_apply server-Pipe_ObjectName/0002-server-Link-named-pipes-to-their-device.patch
patch_apply server-Pipe_ObjectName/0003-server-Store-a-reference-to-the-parent-object-for-pi.patch
(
echo '+ { "Sebastian Lackner", "server: Move parent reference from object_name to object.", 1 },';
echo '+ { "Sebastian Lackner", "server: Link named pipes to their device.", 1 },';
echo '+ { "Sebastian Lackner", "server: Store a reference to the parent object for pipe servers.", 1 },';
) >> "$patchlist"
fi
# Patchset server-Realtime_Priority
# |
# | Modified files:

View File

@ -0,0 +1,114 @@
From e266c05975d524f09886decb854ec78942e9b2fb Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 17 Aug 2015 00:13:27 +0200
Subject: server: Move parent reference from object_name to object.
---
server/object.c | 20 ++++++++++----------
server/object.h | 1 +
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/server/object.c b/server/object.c
index d04fdb9..bfb4689 100644
--- a/server/object.c
+++ b/server/object.c
@@ -44,7 +44,6 @@ struct object_name
{
struct list entry; /* entry in the hash list */
struct object *obj; /* object owning this name */
- struct object *parent; /* parent object */
data_size_t len; /* name length in bytes */
WCHAR name[1];
};
@@ -136,18 +135,15 @@ static struct object_name *alloc_name( const struct unicode_str *name )
if ((ptr = mem_alloc( sizeof(*ptr) + name->len - sizeof(ptr->name) )))
{
ptr->len = name->len;
- ptr->parent = NULL;
memcpy( ptr->name, name->str, name->len );
}
return ptr;
}
/* free the name of an object */
-static void free_name( struct object *obj )
+static void free_name( struct object_name *ptr )
{
- struct object_name *ptr = obj->name;
list_remove( &ptr->entry );
- if (ptr->parent) release_object( ptr->parent );
free( ptr );
}
@@ -183,7 +179,7 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len )
{
struct object_name *name = ptr->name;
len += name->len + sizeof(WCHAR);
- ptr = name->parent;
+ ptr = ptr->parent;
}
if (!len) return NULL;
if (!(ret = malloc( len ))) return NULL;
@@ -195,7 +191,7 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len )
memcpy( ret + len - name->len, name->name, name->len );
len -= name->len + sizeof(WCHAR);
memcpy( ret + len, &backslash, sizeof(WCHAR) );
- obj = name->parent;
+ obj = obj->parent;
}
return (WCHAR *)ret;
}
@@ -208,6 +204,7 @@ void *alloc_object( const struct object_ops *ops )
{
obj->refcount = 1;
obj->handle_count = 0;
+ obj->parent = NULL;
obj->ops = ops;
obj->name = NULL;
obj->sd = NULL;
@@ -230,7 +227,7 @@ void *create_object( struct namespace *namespace, const struct object_ops *ops,
if ((obj = alloc_object( ops )))
{
set_object_name( namespace, obj, name_ptr );
- if (parent) name_ptr->parent = grab_object( parent );
+ if (parent) obj->parent = grab_object( parent );
}
else
free( name_ptr );
@@ -278,8 +275,10 @@ void dump_object_name( struct object *obj )
/* unlink a named object from its namespace, without freeing the object itself */
void unlink_named_object( struct object *obj )
{
- if (obj->name) free_name( obj );
+ if (obj->name) free_name( obj->name );
+ if (obj->parent) release_object( obj->parent );
obj->name = NULL;
+ obj->parent = NULL;
}
/* mark an object as being stored statically, i.e. only released at shutdown */
@@ -311,7 +310,8 @@ void release_object( void *ptr )
/* if the refcount is 0, nobody can be in the wait queue */
assert( list_empty( &obj->wait_queue ));
obj->ops->destroy( obj );
- if (obj->name) free_name( obj );
+ if (obj->name) free_name( obj->name );
+ if (obj->parent) release_object( obj->parent );
free( obj->sd );
#ifdef DEBUG_OBJECTS
list_remove( &obj->obj_list );
diff --git a/server/object.h b/server/object.h
index 0974d87..9d14c9c 100644
--- a/server/object.h
+++ b/server/object.h
@@ -96,6 +96,7 @@ struct object
{
unsigned int refcount; /* reference count */
unsigned int handle_count;/* handle count */
+ struct object *parent; /* parent object */
const struct object_ops *ops;
struct list wait_queue;
struct object_name *name;
--
2.5.0

View File

@ -0,0 +1,25 @@
From 8ff87be88de81b45327a9fc0eeacbc357544be20 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 17 Aug 2015 01:10:10 +0200
Subject: server: Link named pipes to their device.
---
server/named_pipe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 53bec02..0ce3e59 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -743,7 +743,7 @@ static struct named_pipe *create_named_pipe( struct directory *root, const struc
else
{
struct named_pipe_device *dev = (struct named_pipe_device *)obj;
- if ((pipe = create_object( dev->pipes, &named_pipe_ops, &new_name, NULL )))
+ if ((pipe = create_object( dev->pipes, &named_pipe_ops, &new_name, &dev->obj )))
clear_error();
}
--
2.5.0

View File

@ -0,0 +1,103 @@
From 84d1dc87366a3f72365b29f490da5bed67998386 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 17 Aug 2015 01:11:47 +0200
Subject: server: Store a reference to the parent object for pipe servers.
---
server/named_pipe.c | 9 +++++----
server/object.c | 21 ++++++++++++---------
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 0ce3e59..283eb2c 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -764,7 +764,7 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned
{
struct pipe_server *server;
- server = alloc_object( &pipe_server_ops );
+ server = create_object( NULL, &pipe_server_ops, NULL, &pipe->obj );
if (!server)
return NULL;
@@ -786,11 +786,12 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned
return server;
}
-static struct pipe_client *create_pipe_client( unsigned int flags, unsigned int pipe_flags )
+static struct pipe_client *create_pipe_client( struct named_pipe *pipe, unsigned int flags,
+ unsigned int pipe_flags )
{
struct pipe_client *client;
- client = alloc_object( &pipe_client_ops );
+ client = create_object( NULL, &pipe_client_ops, NULL, &pipe->obj );
if (!client)
return NULL;
@@ -876,7 +877,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc
return NULL;
}
- if ((client = create_pipe_client( options, pipe->flags )))
+ if ((client = create_pipe_client( pipe, options, pipe->flags )))
{
type = ((pipe->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) && is_messagemode_supported()) ?
SOCK_SEQPACKET : SOCK_STREAM;
diff --git a/server/object.c b/server/object.c
index bfb4689..5f16046 100644
--- a/server/object.c
+++ b/server/object.c
@@ -175,22 +175,25 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len )
data_size_t len = 0;
char *ret;
- while (ptr && ptr->name)
+ while (ptr)
{
struct object_name *name = ptr->name;
- len += name->len + sizeof(WCHAR);
+ if (name) len += name->len + sizeof(WCHAR);
ptr = ptr->parent;
}
if (!len) return NULL;
if (!(ret = malloc( len ))) return NULL;
*ret_len = len;
- while (obj && obj->name)
+ while (obj)
{
struct object_name *name = obj->name;
- memcpy( ret + len - name->len, name->name, name->len );
- len -= name->len + sizeof(WCHAR);
- memcpy( ret + len, &backslash, sizeof(WCHAR) );
+ if (name)
+ {
+ memcpy( ret + len - name->len, name->name, name->len );
+ len -= name->len + sizeof(WCHAR);
+ memcpy( ret + len, &backslash, sizeof(WCHAR) );
+ }
obj = obj->parent;
}
return (WCHAR *)ret;
@@ -220,13 +223,13 @@ void *alloc_object( const struct object_ops *ops )
void *create_object( struct namespace *namespace, const struct object_ops *ops,
const struct unicode_str *name, struct object *parent )
{
+ struct object_name *name_ptr = NULL;
struct object *obj;
- struct object_name *name_ptr;
- if (!(name_ptr = alloc_name( name ))) return NULL;
+ if (namespace && !(name_ptr = alloc_name( name ))) return NULL;
if ((obj = alloc_object( ops )))
{
- set_object_name( namespace, obj, name_ptr );
+ if (namespace) set_object_name( namespace, obj, name_ptr );
if (parent) obj->parent = grab_object( parent );
}
else
--
2.5.0

View File

@ -0,0 +1,2 @@
Fixes: Report correct ObjectName for NamedPipe wineserver objects
Depends: kernel32-Named_Pipe