Commit 14825a7a authored by Alexandre Julliard's avatar Alexandre Julliard

server: Pass full object attributes in the create_mailslot request.

parent b5245a15
...@@ -3627,6 +3627,8 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess, ...@@ -3627,6 +3627,8 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess,
{ {
LARGE_INTEGER timeout; LARGE_INTEGER timeout;
NTSTATUS ret; NTSTATUS ret;
data_size_t len;
struct object_attributes *objattr;
TRACE("%p %08x %p %p %08x %08x %08x %p\n", TRACE("%p %08x %p %p %08x %08x %08x %p\n",
pHandle, DesiredAccess, attr, IoStatusBlock, pHandle, DesiredAccess, attr, IoStatusBlock,
...@@ -3636,6 +3638,8 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess, ...@@ -3636,6 +3638,8 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess,
if (!attr) return STATUS_INVALID_PARAMETER; if (!attr) return STATUS_INVALID_PARAMETER;
if (!attr->ObjectName) return STATUS_OBJECT_PATH_SYNTAX_BAD; if (!attr->ObjectName) return STATUS_OBJECT_PATH_SYNTAX_BAD;
if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret;
/* /*
* For a NULL TimeOut pointer set the default timeout value * For a NULL TimeOut pointer set the default timeout value
*/ */
...@@ -3647,17 +3651,15 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess, ...@@ -3647,17 +3651,15 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess,
SERVER_START_REQ( create_mailslot ) SERVER_START_REQ( create_mailslot )
{ {
req->access = DesiredAccess; req->access = DesiredAccess;
req->attributes = attr->Attributes;
req->rootdir = wine_server_obj_handle( attr->RootDirectory );
req->max_msgsize = MaxMessageSize; req->max_msgsize = MaxMessageSize;
req->read_timeout = timeout.QuadPart; req->read_timeout = timeout.QuadPart;
wine_server_add_data( req, attr->ObjectName->Buffer, wine_server_add_data( req, objattr, len );
attr->ObjectName->Length );
ret = wine_server_call( req ); ret = wine_server_call( req );
if( ret == STATUS_SUCCESS ) if( ret == STATUS_SUCCESS )
*pHandle = wine_server_ptr_handle( reply->handle ); *pHandle = wine_server_ptr_handle( reply->handle );
} }
SERVER_END_REQ; SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
return ret; return ret;
} }
...@@ -4673,12 +4673,10 @@ struct create_mailslot_request ...@@ -4673,12 +4673,10 @@ struct create_mailslot_request
{ {
struct request_header __header; struct request_header __header;
unsigned int access; unsigned int access;
unsigned int attributes;
obj_handle_t rootdir;
timeout_t read_timeout; timeout_t read_timeout;
unsigned int max_msgsize; unsigned int max_msgsize;
/* VARARG(name,unicode_str); */ /* VARARG(objattr,object_attributes); */
char __pad_36[4]; char __pad_28[4];
}; };
struct create_mailslot_reply struct create_mailslot_reply
{ {
...@@ -6169,6 +6167,6 @@ union generic_reply ...@@ -6169,6 +6167,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply; struct terminate_job_reply terminate_job_reply;
}; };
#define SERVER_PROTOCOL_VERSION 495 #define SERVER_PROTOCOL_VERSION 496
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -395,7 +395,8 @@ void create_mailslot_device( struct directory *root, const struct unicode_str *n ...@@ -395,7 +395,8 @@ void create_mailslot_device( struct directory *root, const struct unicode_str *n
static struct mailslot *create_mailslot( struct directory *root, static struct mailslot *create_mailslot( struct directory *root,
const struct unicode_str *name, unsigned int attr, const struct unicode_str *name, unsigned int attr,
int max_msgsize, timeout_t read_timeout ) int max_msgsize, timeout_t read_timeout,
const struct security_descriptor *sd )
{ {
struct object *obj; struct object *obj;
struct unicode_str new_name; struct unicode_str new_name;
...@@ -442,6 +443,8 @@ static struct mailslot *create_mailslot( struct directory *root, ...@@ -442,6 +443,8 @@ static struct mailslot *create_mailslot( struct directory *root,
mailslot->max_msgsize = max_msgsize; mailslot->max_msgsize = max_msgsize;
mailslot->read_timeout = read_timeout; mailslot->read_timeout = read_timeout;
list_init( &mailslot->writers ); list_init( &mailslot->writers );
if (sd) default_set_sd( &mailslot->obj, sd, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION );
if (!socketpair( PF_UNIX, SOCK_DGRAM, 0, fds )) if (!socketpair( PF_UNIX, SOCK_DGRAM, 0, fds ))
{ {
...@@ -508,16 +511,16 @@ DECL_HANDLER(create_mailslot) ...@@ -508,16 +511,16 @@ DECL_HANDLER(create_mailslot)
struct mailslot *mailslot; struct mailslot *mailslot;
struct unicode_str name; struct unicode_str name;
struct directory *root = NULL; struct directory *root = NULL;
const struct security_descriptor *sd;
const struct object_attributes *objattr = get_req_object_attributes( &sd, &name );
reply->handle = 0; if (!objattr) return;
get_req_unicode_str( &name ); if (objattr->rootdir && !(root = get_directory_obj( current->process, objattr->rootdir, 0 ))) return;
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
return;
if ((mailslot = create_mailslot( root, &name, req->attributes, req->max_msgsize, if ((mailslot = create_mailslot( root, &name, objattr->attributes, req->max_msgsize,
req->read_timeout ))) req->read_timeout, sd )))
{ {
reply->handle = alloc_handle( current->process, mailslot, req->access, req->attributes ); reply->handle = alloc_handle( current->process, mailslot, req->access, objattr->attributes );
release_object( mailslot ); release_object( mailslot );
} }
......
...@@ -3277,11 +3277,9 @@ struct handle_info ...@@ -3277,11 +3277,9 @@ struct handle_info
/* Create a mailslot */ /* Create a mailslot */
@REQ(create_mailslot) @REQ(create_mailslot)
unsigned int access; /* wanted access rights */ unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */
obj_handle_t rootdir; /* root directory */
timeout_t read_timeout; timeout_t read_timeout;
unsigned int max_msgsize; unsigned int max_msgsize;
VARARG(name,unicode_str); /* mailslot name */ VARARG(objattr,object_attributes); /* object attributes */
@REPLY @REPLY
obj_handle_t handle; /* handle to the mailslot */ obj_handle_t handle; /* handle to the mailslot */
@END @END
......
...@@ -2082,11 +2082,9 @@ C_ASSERT( sizeof(struct get_system_handles_request) == 16 ); ...@@ -2082,11 +2082,9 @@ C_ASSERT( sizeof(struct get_system_handles_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_system_handles_reply, count) == 8 ); C_ASSERT( FIELD_OFFSET(struct get_system_handles_reply, count) == 8 );
C_ASSERT( sizeof(struct get_system_handles_reply) == 16 ); C_ASSERT( sizeof(struct get_system_handles_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct create_mailslot_request, access) == 12 ); C_ASSERT( FIELD_OFFSET(struct create_mailslot_request, access) == 12 );
C_ASSERT( FIELD_OFFSET(struct create_mailslot_request, attributes) == 16 ); C_ASSERT( FIELD_OFFSET(struct create_mailslot_request, read_timeout) == 16 );
C_ASSERT( FIELD_OFFSET(struct create_mailslot_request, rootdir) == 20 ); C_ASSERT( FIELD_OFFSET(struct create_mailslot_request, max_msgsize) == 24 );
C_ASSERT( FIELD_OFFSET(struct create_mailslot_request, read_timeout) == 24 ); C_ASSERT( sizeof(struct create_mailslot_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct create_mailslot_request, max_msgsize) == 32 );
C_ASSERT( sizeof(struct create_mailslot_request) == 40 );
C_ASSERT( FIELD_OFFSET(struct create_mailslot_reply, handle) == 8 ); C_ASSERT( FIELD_OFFSET(struct create_mailslot_reply, handle) == 8 );
C_ASSERT( sizeof(struct create_mailslot_reply) == 16 ); C_ASSERT( sizeof(struct create_mailslot_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_mailslot_info_request, handle) == 12 ); C_ASSERT( FIELD_OFFSET(struct set_mailslot_info_request, handle) == 12 );
......
...@@ -3866,11 +3866,9 @@ static void dump_get_system_handles_reply( const struct get_system_handles_reply ...@@ -3866,11 +3866,9 @@ static void dump_get_system_handles_reply( const struct get_system_handles_reply
static void dump_create_mailslot_request( const struct create_mailslot_request *req ) static void dump_create_mailslot_request( const struct create_mailslot_request *req )
{ {
fprintf( stderr, " access=%08x", req->access ); fprintf( stderr, " access=%08x", req->access );
fprintf( stderr, ", attributes=%08x", req->attributes );
fprintf( stderr, ", rootdir=%04x", req->rootdir );
dump_timeout( ", read_timeout=", &req->read_timeout ); dump_timeout( ", read_timeout=", &req->read_timeout );
fprintf( stderr, ", max_msgsize=%08x", req->max_msgsize ); fprintf( stderr, ", max_msgsize=%08x", req->max_msgsize );
dump_varargs_unicode_str( ", name=", cur_size ); dump_varargs_object_attributes( ", objattr=", cur_size );
} }
static void dump_create_mailslot_reply( const struct create_mailslot_reply *req ) static void dump_create_mailslot_reply( const struct create_mailslot_reply *req )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment