[v6 1/5] server: Named pipe query SD from pipe object

Jonathan Doron jond at wizery.com
Thu Sep 21 06:50:39 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 | 60 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 55 insertions(+), 5 deletions(-)

diff --git a/server/named_pipe.c b/server/named_pipe.c
index 80363cb..09688dd 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -165,6 +165,9 @@ static struct fd *pipe_server_get_fd( struct object *obj );
 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 *pipe_server_get_sd( struct object *obj );
+static int pipe_server_set_sd( struct object *obj, const struct security_descriptor *sd,
+                               unsigned int set_info );
 
 static const struct object_ops pipe_server_ops =
 {
@@ -178,8 +181,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 */
+    pipe_server_get_sd,           /* get_sd */
+    pipe_server_set_sd,           /* set_sd */
     no_lookup_name,               /* lookup_name */
     no_link_name,                 /* link_name */
     NULL,                         /* unlink_name */
@@ -205,6 +208,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 +227,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 +355,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;
@@ -921,6 +952,25 @@ static int pipe_end_peek( struct pipe_end *pipe_end )
     return 1;
 }
 
+static struct security_descriptor *pipe_server_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 pipe_server_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 int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
 {
     struct pipe_server *server = get_fd_user( fd );
@@ -1271,7 +1321,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