[v5 1/4] server: Named pipe query SD from pipe object
Jonathan Doron
jond at wizery.com
Thu Sep 21 05:04:40 CDT 2017
The client pipe object and the server pipe object should use the
pipe object SD.
Signed-off-by: Jonathan Doron <jond at wizery.com>
---
server/named_pipe.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 52 insertions(+), 5 deletions(-)
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 80363cb..41e733d 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -166,6 +166,25 @@ static void pipe_server_destroy( struct object *obj);
static int pipe_server_flush( struct fd *fd, struct async *async );
static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
+static struct security_descriptor *server_pipe_get_sd( struct object *obj )
+{
+ struct pipe_server *server = (struct pipe_server *) obj;
+ if (!server->pipe)
+ return NULL;
+
+ return default_get_sd((struct object *)server->pipe);
+}
+
+static int server_pipe_set_sd( struct object *obj, const struct security_descriptor *sd,
+ unsigned int set_info )
+{
+ struct pipe_server *server = (struct pipe_server *) obj;
+ if (!server->pipe)
+ return 0;
+
+ return default_set_sd((struct object *)server->pipe, sd, set_info);
+}
+
static const struct object_ops pipe_server_ops =
{
sizeof(struct pipe_server), /* size */
@@ -178,8 +197,8 @@ static const struct object_ops pipe_server_ops =
no_signal, /* signal */
pipe_server_get_fd, /* get_fd */
default_fd_map_access, /* map_access */
- default_get_sd, /* get_sd */
- default_set_sd, /* set_sd */
+ server_pipe_get_sd, /* get_sd */
+ server_pipe_set_sd, /* set_sd */
no_lookup_name, /* lookup_name */
no_link_name, /* link_name */
NULL, /* unlink_name */
@@ -205,6 +224,9 @@ static const struct fd_ops pipe_server_fd_ops =
static void pipe_client_dump( struct object *obj, int verbose );
static int pipe_client_signaled( struct object *obj, struct wait_queue_entry *entry );
static struct fd *pipe_client_get_fd( struct object *obj );
+static struct security_descriptor *pipe_client_get_sd( struct object *obj );
+static int pipe_client_set_sd( struct object *obj, const struct security_descriptor *sd,
+ unsigned int set_info );
static void pipe_client_destroy( struct object *obj );
static int pipe_client_flush( struct fd *fd, struct async *async );
static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
@@ -221,8 +243,8 @@ static const struct object_ops pipe_client_ops =
no_signal, /* signal */
pipe_client_get_fd, /* get_fd */
default_fd_map_access, /* map_access */
- default_get_sd, /* get_sd */
- default_set_sd, /* set_sd */
+ pipe_client_get_sd, /* get_sd */
+ pipe_client_set_sd, /* set_sd */
no_lookup_name, /* lookup_name */
no_link_name, /* link_name */
NULL, /* unlink_name */
@@ -349,6 +371,31 @@ static struct fd *pipe_client_get_fd( struct object *obj )
return NULL;
}
+static struct security_descriptor *pipe_client_get_sd( struct object *obj )
+{
+ struct pipe_client *client = (struct pipe_client *) obj;
+ if (!client->server)
+ return NULL;
+
+ if (!client->server->pipe)
+ return NULL;
+
+ return default_get_sd((struct object *)client->server->pipe);
+}
+
+static int pipe_client_set_sd( struct object *obj, const struct security_descriptor *sd,
+ unsigned int set_info )
+{
+ struct pipe_client *client = (struct pipe_client *) obj;
+ if (!client->server)
+ return 0;
+
+ if (!client->server->pipe)
+ return 0;
+
+ return default_set_sd((struct object *)client->server->pipe, sd, set_info);
+}
+
static void set_server_state( struct pipe_server *server, enum pipe_state state )
{
server->state = state;
@@ -1271,7 +1318,7 @@ DECL_HANDLER(create_named_pipe)
if (!(root = get_directory_obj( current->process, objattr->rootdir ))) return;
}
- pipe = create_named_object( root, &named_pipe_ops, &name, objattr->attributes | OBJ_OPENIF, NULL );
+ pipe = create_named_object( root, &named_pipe_ops, &name, objattr->attributes | OBJ_OPENIF, sd );
if (root) release_object( root );
if (!pipe) return;
--
2.9.4
More information about the wine-patches
mailing list