server: Do not forbid closing fd handles in other processes.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-03-22 23:04:30 -05:00 committed by Alexandre Julliard
parent d144890c88
commit 101082253f
10 changed files with 11 additions and 19 deletions

View File

@ -421,7 +421,6 @@ static int dir_close_handle( struct object *obj, struct process *process, obj_ha
{
struct dir *dir = (struct dir *)obj;
if (!fd_close_handle( obj, process, handle )) return 0;
if (obj->handle_count == 1) release_dir_cache_entry( dir ); /* closing last handle, release cache */
return 1; /* ok to close */
}

View File

@ -168,7 +168,7 @@ static const struct object_ops console_server_ops =
NULL, /* unlink_name */
console_server_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
fd_close_handle, /* close_handle */
no_close_handle, /* close_handle */
console_server_destroy /* destroy */
};

View File

@ -2118,12 +2118,6 @@ void set_fd_signaled( struct fd *fd, int signaled )
if (signaled) wake_up( fd->user, 0 );
}
/* handler for close_handle that refuses to close fd-associated handles in other processes */
int fd_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
{
return (!current || current->process == process);
}
/* check if events are pending and if yes return which one(s) */
int check_fd_events( struct fd *fd, int events )
{

View File

@ -109,7 +109,7 @@ static const struct object_ops file_ops =
NULL, /* unlink_name */
file_open_file, /* open_file */
file_get_kernel_obj_list, /* get_kernel_obj_list */
fd_close_handle, /* close_handle */
no_close_handle, /* close_handle */
file_destroy /* destroy */
};

View File

@ -93,7 +93,6 @@ extern int is_fd_overlapped( struct fd *fd );
extern int get_unix_fd( struct fd *fd );
extern int is_same_file_fd( struct fd *fd1, struct fd *fd2 );
extern int is_fd_removable( struct fd *fd );
extern int fd_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
extern int check_fd_events( struct fd *fd, int events );
extern void set_fd_events( struct fd *fd, int events );
extern obj_handle_t lock_fd( struct fd *fd, file_pos_t offset, file_pos_t count, int shared, int wait );

View File

@ -90,7 +90,7 @@ static const struct object_ops mailslot_ops =
default_unlink_name, /* unlink_name */
mailslot_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
fd_close_handle, /* close_handle */
no_close_handle, /* close_handle */
mailslot_destroy /* destroy */
};
@ -148,7 +148,7 @@ static const struct object_ops mail_writer_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
fd_close_handle, /* close_handle */
no_close_handle, /* close_handle */
mail_writer_destroy /* destroy */
};
@ -240,7 +240,7 @@ static const struct object_ops mailslot_device_file_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
fd_close_handle, /* close_handle */
no_close_handle, /* close_handle */
mailslot_device_file_destroy /* destroy */
};

View File

@ -189,7 +189,7 @@ static const struct object_ops mapping_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
fd_close_handle, /* close_handle */
no_close_handle, /* close_handle */
mapping_destroy /* destroy */
};

View File

@ -179,7 +179,7 @@ static const struct object_ops pipe_server_ops =
NULL, /* unlink_name */
pipe_server_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
fd_close_handle, /* close_handle */
no_close_handle, /* close_handle */
pipe_server_destroy /* destroy */
};
@ -222,7 +222,7 @@ static const struct object_ops pipe_client_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
fd_close_handle, /* close_handle */
no_close_handle, /* close_handle */
pipe_end_destroy /* destroy */
};
@ -299,7 +299,7 @@ static const struct object_ops named_pipe_device_file_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
fd_close_handle, /* close_handle */
no_close_handle, /* close_handle */
named_pipe_device_file_destroy /* destroy */
};

View File

@ -104,7 +104,7 @@ static const struct object_ops serial_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
fd_close_handle, /* close_handle */
no_close_handle, /* close_handle */
serial_destroy /* destroy */
};

View File

@ -889,7 +889,7 @@ static int sock_close_handle( struct object *obj, struct process *process, obj_h
async_terminate( req->async, STATUS_CANCELLED );
}
return fd_close_handle( obj, process, handle );
return 1;
}
static void sock_destroy( struct object *obj )