You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
server-ACL_Compat/server-Inherited_ACLs: Avoid creating unnecessary file object for checking the parent SDs.
This commit is contained in:
@@ -1,18 +1,44 @@
|
||||
From 817b6413c6cbf918356916c8b6b21b7f31d19dc7 Mon Sep 17 00:00:00 2001
|
||||
From 4fcae64a5bc980f7483eb3d7f26f02fda59ec481 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Fri, 18 Apr 2014 15:21:00 -0600
|
||||
Subject: server: Add compatibility code for handling the old method of storing
|
||||
ACLs.
|
||||
|
||||
---
|
||||
server/file.c | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 159 insertions(+), 3 deletions(-)
|
||||
server/file.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 164 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/server/file.c b/server/file.c
|
||||
index 23debaf..15a14e6 100644
|
||||
index 521eff2..6a6bf9b 100644
|
||||
--- a/server/file.c
|
||||
+++ b/server/file.c
|
||||
@@ -752,6 +752,160 @@ struct security_descriptor *get_xattr_sd( int fd )
|
||||
@@ -72,6 +72,7 @@ struct file
|
||||
|
||||
static unsigned int generic_file_map_access( unsigned int access );
|
||||
struct security_descriptor *get_xattr_sd( int fd );
|
||||
+struct security_descriptor *get_xattr_acls( int fd, const SID *user, const SID *group );
|
||||
|
||||
static void file_dump( struct object *obj, int verbose );
|
||||
static struct fd *file_get_fd( struct object *obj );
|
||||
@@ -336,6 +337,7 @@ static struct security_descriptor *file_get_parent_sd( struct fd *root, const ch
|
||||
mode_t parent_mode = 0555;
|
||||
char *p, *parent_name;
|
||||
struct fd *parent_fd;
|
||||
+ struct stat st;
|
||||
int unix_fd;
|
||||
|
||||
parent_name = strndup( child_name, child_len );
|
||||
@@ -367,6 +369,9 @@ static struct security_descriptor *file_get_parent_sd( struct fd *root, const ch
|
||||
if (unix_fd != -1)
|
||||
{
|
||||
parent_sd = get_xattr_sd( unix_fd );
|
||||
+ if (!parent_sd && fstat( unix_fd, &st ) != -1)
|
||||
+ parent_sd = get_xattr_acls( unix_fd, security_unix_uid_to_sid( st.st_uid ),
|
||||
+ token_get_primary_group( current->process->token ) );
|
||||
if (parent_sd)
|
||||
{
|
||||
sd = inherit_sd( parent_sd, is_dir );
|
||||
@@ -654,6 +659,160 @@ struct security_descriptor *get_xattr_sd( int fd )
|
||||
return sd;
|
||||
}
|
||||
|
||||
@@ -173,7 +199,7 @@ index 23debaf..15a14e6 100644
|
||||
/* Convert generic rights into standard access rights */
|
||||
void convert_generic_sd( struct security_descriptor *sd )
|
||||
{
|
||||
@@ -779,6 +933,7 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode
|
||||
@@ -681,6 +840,7 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode
|
||||
int unix_fd = get_unix_fd( fd );
|
||||
struct stat st;
|
||||
struct security_descriptor *sd;
|
||||
@@ -181,7 +207,7 @@ index 23debaf..15a14e6 100644
|
||||
|
||||
if (unix_fd == -1 || fstat( unix_fd, &st ) == -1)
|
||||
return obj->sd;
|
||||
@@ -788,11 +943,12 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode
|
||||
@@ -690,11 +850,12 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode
|
||||
(st.st_uid == *uid))
|
||||
return obj->sd;
|
||||
|
||||
|
Reference in New Issue
Block a user