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

This commit is contained in:
Rob Shearman 2007-11-05 14:23:36 +00:00 committed by Alexandre Julliard
parent a1b02c2cec
commit 92db6d2c2f
7 changed files with 19 additions and 6 deletions

View File

@ -278,7 +278,6 @@ static void test_event_security(void)
InitializeAcl(&acl, sizeof(acl), ACL_REVISION);
SetSecurityDescriptorDacl(&sd, TRUE, &acl, FALSE);
handle = CreateEventA(&sa, FALSE, FALSE, __FILE__ ": Test Event");
todo_wine
ok(handle != NULL, "CreateEventW with blank sd failed with error %d\n", GetLastError());
CloseHandle(handle);
}

View File

@ -187,7 +187,10 @@ DECL_HANDLER(create_event)
if ((event = create_event( root, &name, req->attributes, req->manual_reset, req->initial_state, sd )))
{
reply->handle = alloc_handle( current->process, event, req->access, req->attributes );
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
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 );
}

View File

@ -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 */
/* 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;

View File

@ -36,6 +36,8 @@ struct unicode_str;
/* that the thing pointed to starts with a struct object... */
extern obj_handle_t alloc_handle( struct process *process, void *obj,
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 struct object *get_handle_obj( struct process *process, obj_handle_t handle,
unsigned int access, const struct object_ops *ops );

View File

@ -415,7 +415,10 @@ DECL_HANDLER(create_mapping)
if ((obj = create_mapping( root, &name, req->attributes, req->size, req->protect, req->file_handle, sd )))
{
reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
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 );
}

View File

@ -212,7 +212,10 @@ DECL_HANDLER(create_mutex)
if ((mutex = create_mutex( root, &name, req->attributes, req->owned, sd )))
{
reply->handle = alloc_handle( current->process, mutex, req->access, req->attributes );
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
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 );
}

View File

@ -187,7 +187,10 @@ DECL_HANDLER(create_semaphore)
if ((sem = create_semaphore( root, &name, req->attributes, req->initial, req->max, sd )))
{
reply->handle = alloc_handle( current->process, sem, req->access, req->attributes );
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
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 );
}