server: Added infrastructure for access rights mapping.
This commit is contained in:
parent
b0aa29effa
commit
28beba31d6
|
@ -82,6 +82,7 @@ static const struct object_ops atom_table_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
atom_table_destroy /* destroy */
|
||||
|
|
|
@ -76,6 +76,7 @@ static const struct object_ops change_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
change_destroy /* destroy */
|
||||
|
|
|
@ -58,6 +58,7 @@ static const struct object_ops clipboard_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
|
|
|
@ -51,6 +51,7 @@ static const struct object_ops console_input_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
console_input_destroy /* destroy */
|
||||
|
@ -78,6 +79,7 @@ static const struct object_ops console_input_events_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
console_input_events_destroy /* destroy */
|
||||
|
@ -116,6 +118,7 @@ static const struct object_ops screen_buffer_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
screen_buffer_destroy /* destroy */
|
||||
|
|
|
@ -76,6 +76,7 @@ static const struct object_ops debug_event_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
debug_event_destroy /* destroy */
|
||||
|
@ -95,6 +96,7 @@ static const struct object_ops debug_ctx_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
debug_ctx_destroy /* destroy */
|
||||
|
|
|
@ -62,6 +62,7 @@ static const struct object_ops directory_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
directory_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
directory_destroy /* destroy */
|
||||
|
|
|
@ -57,6 +57,7 @@ static const struct object_ops event_ops =
|
|||
event_satisfied, /* satisfied */
|
||||
event_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
|
|
|
@ -165,6 +165,7 @@ static const struct object_ops fd_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
fd_destroy /* destroy */
|
||||
|
@ -197,6 +198,7 @@ static const struct object_ops device_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
device_destroy /* destroy */
|
||||
|
@ -228,6 +230,7 @@ static const struct object_ops inode_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
inode_destroy /* destroy */
|
||||
|
@ -261,6 +264,7 @@ static const struct object_ops file_lock_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
|
|
|
@ -79,6 +79,7 @@ static const struct object_ops file_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
file_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
file_destroy /* destroy */
|
||||
|
|
|
@ -110,6 +110,7 @@ static const struct object_ops handle_table_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
handle_table_destroy /* destroy */
|
||||
|
@ -223,8 +224,11 @@ 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 */
|
||||
obj_handle_t alloc_handle( struct process *process, void *obj, unsigned int access, unsigned int attr )
|
||||
obj_handle_t alloc_handle( struct process *process, void *ptr, unsigned int access, unsigned int attr )
|
||||
{
|
||||
struct object *obj = ptr;
|
||||
|
||||
access = obj->ops->map_access( obj, access );
|
||||
access &= ~RESERVED_ALL;
|
||||
if (attr & OBJ_INHERIT) access |= RESERVED_INHERIT;
|
||||
if (!process->handles)
|
||||
|
|
|
@ -83,6 +83,7 @@ static const struct object_ops hook_table_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
hook_table_destroy /* destroy */
|
||||
|
|
|
@ -84,6 +84,7 @@ static const struct object_ops mailslot_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
mailslot_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
mailslot_destroy /* destroy */
|
||||
|
@ -125,6 +126,7 @@ static const struct object_ops mail_writer_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
mail_writer_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
mail_writer_destroy /* destroy */
|
||||
|
@ -158,6 +160,7 @@ static const struct object_ops mailslot_device_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
mailslot_device_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
mailslot_device_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
mailslot_device_destroy /* destroy */
|
||||
|
|
|
@ -65,6 +65,7 @@ static const struct object_ops mapping_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
mapping_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
mapping_destroy /* destroy */
|
||||
|
|
|
@ -60,6 +60,7 @@ static const struct object_ops mutex_ops =
|
|||
mutex_satisfied, /* satisfied */
|
||||
mutex_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
mutex_destroy /* destroy */
|
||||
|
|
|
@ -119,6 +119,7 @@ static const struct object_ops named_pipe_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
named_pipe_destroy /* destroy */
|
||||
|
@ -141,6 +142,7 @@ static const struct object_ops pipe_server_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
pipe_server_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
pipe_server_destroy /* destroy */
|
||||
|
@ -173,6 +175,7 @@ static const struct object_ops pipe_client_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
pipe_client_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
pipe_client_destroy /* destroy */
|
||||
|
@ -204,6 +207,7 @@ static const struct object_ops named_pipe_device_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
named_pipe_device_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
named_pipe_device_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
named_pipe_device_destroy /* destroy */
|
||||
|
|
|
@ -312,6 +312,11 @@ struct fd *no_get_fd( struct object *obj )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int no_map_access( struct object *obj, unsigned int access )
|
||||
{
|
||||
return access;
|
||||
}
|
||||
|
||||
struct object *no_lookup_name( struct object *obj, struct unicode_str *name,
|
||||
unsigned int attr )
|
||||
{
|
||||
|
|
|
@ -72,6 +72,8 @@ struct object_ops
|
|||
int (*signal)(struct object *, unsigned int);
|
||||
/* return an fd object that can be used to read/write from the object */
|
||||
struct fd *(*get_fd)(struct object *);
|
||||
/* map access rights to the specific rights for this object */
|
||||
unsigned int (*map_access)(struct object *, unsigned int);
|
||||
/* lookup a name if an object has a namespace */
|
||||
struct object *(*lookup_name)(struct object *, struct unicode_str *,unsigned int);
|
||||
/* close a handle to this object */
|
||||
|
@ -118,6 +120,7 @@ extern int no_add_queue( struct object *obj, struct wait_queue_entry *entry );
|
|||
extern int no_satisfied( struct object *obj, struct thread *thread );
|
||||
extern int no_signal( struct object *obj, unsigned int access );
|
||||
extern struct fd *no_get_fd( struct object *obj );
|
||||
extern unsigned int no_map_access( struct object *obj, unsigned int access );
|
||||
extern struct object *no_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attributes );
|
||||
extern int no_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
|
||||
extern void no_destroy( struct object *obj );
|
||||
|
|
|
@ -72,6 +72,7 @@ static const struct object_ops process_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
process_destroy /* destroy */
|
||||
|
@ -121,6 +122,7 @@ static const struct object_ops startup_info_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
startup_info_destroy /* destroy */
|
||||
|
|
|
@ -153,6 +153,7 @@ static const struct object_ops msg_queue_ops =
|
|||
msg_queue_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
msg_queue_destroy /* destroy */
|
||||
|
@ -169,6 +170,7 @@ static const struct object_ops thread_input_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
thread_input_destroy /* destroy */
|
||||
|
|
|
@ -147,6 +147,7 @@ static const struct object_ops key_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
key_close_handle, /* close_handle */
|
||||
key_destroy /* destroy */
|
||||
|
|
|
@ -95,6 +95,7 @@ static const struct object_ops master_socket_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
master_socket_destroy /* destroy */
|
||||
|
|
|
@ -57,6 +57,7 @@ static const struct object_ops semaphore_ops =
|
|||
semaphore_satisfied, /* satisfied */
|
||||
semaphore_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
|
|
|
@ -102,6 +102,7 @@ static const struct object_ops serial_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
serial_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
serial_destroy /* destroy */
|
||||
|
|
|
@ -64,6 +64,7 @@ static const struct object_ops handler_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
handler_destroy /* destroy */
|
||||
|
|
|
@ -66,6 +66,7 @@ static const struct object_ops snapshot_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
snapshot_destroy /* destroy */
|
||||
|
|
|
@ -111,6 +111,7 @@ static const struct object_ops sock_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
sock_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
sock_destroy /* destroy */
|
||||
|
|
|
@ -60,6 +60,7 @@ static const struct object_ops symlink_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
symlink_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
symlink_destroy /* destroy */
|
||||
|
|
|
@ -97,6 +97,7 @@ static const struct object_ops thread_ops =
|
|||
no_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
destroy_thread /* destroy */
|
||||
|
|
|
@ -65,6 +65,7 @@ static const struct object_ops timer_ops =
|
|||
timer_satisfied, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
timer_destroy /* destroy */
|
||||
|
|
|
@ -118,6 +118,7 @@ static const struct object_ops token_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
no_close_handle, /* close_handle */
|
||||
token_destroy /* destroy */
|
||||
|
|
|
@ -60,6 +60,7 @@ static const struct object_ops winstation_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
winstation_close_handle, /* close_handle */
|
||||
winstation_destroy /* destroy */
|
||||
|
@ -76,6 +77,7 @@ static const struct object_ops desktop_ops =
|
|||
NULL, /* satisfied */
|
||||
no_signal, /* signal */
|
||||
no_get_fd, /* get_fd */
|
||||
no_map_access, /* map_access */
|
||||
no_lookup_name, /* lookup_name */
|
||||
desktop_close_handle, /* close_handle */
|
||||
desktop_destroy /* destroy */
|
||||
|
|
Loading…
Reference in New Issue