[PATCH 3/3] [Server]: fix access rights for console creation (#24792)

Eric Pouech eric.pouech at orange.fr
Sun Oct 24 15:07:46 CDT 2010




A+
---

 server/console.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)


diff --git a/server/console.c b/server/console.c
index c00e1e8..4c876a8 100644
--- a/server/console.c
+++ b/server/console.c
@@ -68,6 +68,7 @@ struct console_input
 static void console_input_dump( struct object *obj, int verbose );
 static void console_input_destroy( struct object *obj );
 static struct fd *console_input_get_fd( struct object *obj );
+static unsigned int console_map_access( struct object *obj, unsigned int access );
 
 static const struct object_ops console_input_ops =
 {
@@ -80,7 +81,7 @@ static const struct object_ops console_input_ops =
     no_satisfied,                     /* satisfied */
     no_signal,                        /* signal */
     console_input_get_fd,             /* get_fd */
-    default_fd_map_access,            /* map_access */
+    console_map_access,               /* map_access */
     default_get_sd,                   /* get_sd */
     default_set_sd,                   /* set_sd */
     no_lookup_name,                   /* lookup_name */
@@ -157,7 +158,7 @@ static const struct object_ops screen_buffer_ops =
     NULL,                             /* satisfied */
     no_signal,                        /* signal */
     screen_buffer_get_fd,             /* get_fd */
-    default_fd_map_access,            /* map_access */
+    console_map_access,               /* map_access */
     default_get_sd,                   /* get_sd */
     default_set_sd,                   /* set_sd */
     no_lookup_name,                   /* lookup_name */
@@ -204,6 +205,16 @@ static enum server_fd_type console_get_fd_type( struct fd *fd )
     return FD_TYPE_CHAR;
 }
 
+static unsigned int console_map_access( struct object *obj, unsigned int access )
+{
+    /* we need (read|write)_properties so that we can get/set the various object's attributes */
+    if (access & GENERIC_READ)    access |= FILE_GENERIC_READ | FILE_WRITE_PROPERTIES;
+    if (access & GENERIC_WRITE)   access |= FILE_GENERIC_WRITE | FILE_READ_PROPERTIES;
+    if (access & GENERIC_EXECUTE) access |= FILE_GENERIC_EXECUTE;
+    if (access & GENERIC_ALL)     access |= FILE_ALL_ACCESS;
+    return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL);
+}
+
 /* dumps the renderer events of a console */
 static void console_input_events_dump( struct object *obj, int verbose )
 {






More information about the wine-patches mailing list