Commit 92db6d2c authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

server: Don't do access checks on the security descriptors of newly created objects.

parent a1b02c2c
...@@ -278,7 +278,6 @@ static void test_event_security(void) ...@@ -278,7 +278,6 @@ static void test_event_security(void)
InitializeAcl(&acl, sizeof(acl), ACL_REVISION); InitializeAcl(&acl, sizeof(acl), ACL_REVISION);
SetSecurityDescriptorDacl(&sd, TRUE, &acl, FALSE); SetSecurityDescriptorDacl(&sd, TRUE, &acl, FALSE);
handle = CreateEventA(&sa, FALSE, FALSE, __FILE__ ": Test Event"); handle = CreateEventA(&sa, FALSE, FALSE, __FILE__ ": Test Event");
todo_wine
ok(handle != NULL, "CreateEventW with blank sd failed with error %d\n", GetLastError()); ok(handle != NULL, "CreateEventW with blank sd failed with error %d\n", GetLastError());
CloseHandle(handle); CloseHandle(handle);
} }
......
...@@ -187,7 +187,10 @@ DECL_HANDLER(create_event) ...@@ -187,7 +187,10 @@ DECL_HANDLER(create_event)
if ((event = create_event( root, &name, req->attributes, req->manual_reset, req->initial_state, sd ))) if ((event = create_event( root, &name, req->attributes, req->manual_reset, req->initial_state, sd )))
{ {
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
reply->handle = alloc_handle( current->process, event, req->access, req->attributes ); reply->handle = alloc_handle( current->process, event, req->access, req->attributes );
else
reply->handle = alloc_handle_no_access_check( current->process, event, req->access, req->attributes );
release_object( event ); release_object( event );
} }
......
...@@ -226,7 +226,7 @@ static obj_handle_t alloc_entry( struct handle_table *table, void *obj, unsigned ...@@ -226,7 +226,7 @@ static obj_handle_t alloc_entry( struct handle_table *table, void *obj, unsigned
/* allocate a handle for an object, incrementing its refcount */ /* allocate a handle for an object, incrementing its refcount */
/* return the handle, or 0 on error */ /* return the handle, or 0 on error */
static obj_handle_t alloc_handle_no_access_check( struct process *process, void *ptr, unsigned int access, unsigned int attr ) obj_handle_t alloc_handle_no_access_check( struct process *process, void *ptr, unsigned int access, unsigned int attr )
{ {
struct object *obj = ptr; struct object *obj = ptr;
......
...@@ -36,6 +36,8 @@ struct unicode_str; ...@@ -36,6 +36,8 @@ struct unicode_str;
/* that the thing pointed to starts with a struct object... */ /* that the thing pointed to starts with a struct object... */
extern obj_handle_t alloc_handle( struct process *process, void *obj, extern obj_handle_t alloc_handle( struct process *process, void *obj,
unsigned int access, unsigned int attr ); unsigned int access, unsigned int attr );
extern obj_handle_t alloc_handle_no_access_check( struct process *process, void *ptr,
unsigned int access, unsigned int attr );
extern int close_handle( struct process *process, obj_handle_t handle ); extern int close_handle( struct process *process, obj_handle_t handle );
extern struct object *get_handle_obj( struct process *process, obj_handle_t handle, extern struct object *get_handle_obj( struct process *process, obj_handle_t handle,
unsigned int access, const struct object_ops *ops ); unsigned int access, const struct object_ops *ops );
......
...@@ -415,7 +415,10 @@ DECL_HANDLER(create_mapping) ...@@ -415,7 +415,10 @@ DECL_HANDLER(create_mapping)
if ((obj = create_mapping( root, &name, req->attributes, req->size, req->protect, req->file_handle, sd ))) if ((obj = create_mapping( root, &name, req->attributes, req->size, req->protect, req->file_handle, sd )))
{ {
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
reply->handle = alloc_handle( current->process, obj, req->access, req->attributes ); reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
else
reply->handle = alloc_handle_no_access_check( current->process, obj, req->access, req->attributes );
release_object( obj ); release_object( obj );
} }
......
...@@ -212,7 +212,10 @@ DECL_HANDLER(create_mutex) ...@@ -212,7 +212,10 @@ DECL_HANDLER(create_mutex)
if ((mutex = create_mutex( root, &name, req->attributes, req->owned, sd ))) if ((mutex = create_mutex( root, &name, req->attributes, req->owned, sd )))
{ {
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
reply->handle = alloc_handle( current->process, mutex, req->access, req->attributes ); reply->handle = alloc_handle( current->process, mutex, req->access, req->attributes );
else
reply->handle = alloc_handle_no_access_check( current->process, mutex, req->access, req->attributes );
release_object( mutex ); release_object( mutex );
} }
......
...@@ -187,7 +187,10 @@ DECL_HANDLER(create_semaphore) ...@@ -187,7 +187,10 @@ DECL_HANDLER(create_semaphore)
if ((sem = create_semaphore( root, &name, req->attributes, req->initial, req->max, sd ))) if ((sem = create_semaphore( root, &name, req->attributes, req->initial, req->max, sd )))
{ {
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
reply->handle = alloc_handle( current->process, sem, req->access, req->attributes ); reply->handle = alloc_handle( current->process, sem, req->access, req->attributes );
else
reply->handle = alloc_handle_no_access_check( current->process, sem, req->access, req->attributes );
release_object( sem ); release_object( sem );
} }
......
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