mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Further separate the file ACL patches.
This commit is contained in:
parent
a7a1f83013
commit
30f3d023d5
@ -1,6 +1,6 @@
|
||||
From 8714b20a24dcfed7853a9483fd8ef04dd3292fd0 Mon Sep 17 00:00:00 2001
|
||||
From ee79e1be71635431d0d05841c7f9cea720411ba6 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 6 Feb 2014 18:21:11 -0700
|
||||
Date: Thu, 13 Feb 2014 15:45:41 -0700
|
||||
Subject: server: Unify the storage of security attributes for files and
|
||||
directories.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
From ca4cf8fe5ed71c5ddcd5a41ae35f95e9d0f0767e Mon Sep 17 00:00:00 2001
|
||||
From bfad7f20bef7f8ef39e6354d0b47c0c349eac967 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 6 Feb 2014 18:32:21 -0700
|
||||
Date: Thu, 13 Feb 2014 15:45:48 -0700
|
||||
Subject: server: Unify the retrieval of security attributes for files and
|
||||
directories.
|
||||
|
||||
|
@ -0,0 +1,144 @@
|
||||
From 3e44f846dd1ff9487ba6085e11f74f10027a6f2c Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 13 Feb 2014 15:54:02 -0700
|
||||
Subject: server: Store file security attributes with extended file
|
||||
attributes.
|
||||
|
||||
---
|
||||
configure.ac | 6 ++++++
|
||||
server/file.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 73 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 32730f3..bdcc5f8 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -73,6 +73,7 @@ AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthrea
|
||||
AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)]))
|
||||
AC_ARG_WITH(tiff, AS_HELP_STRING([--without-tiff],[do not use TIFF]))
|
||||
AC_ARG_WITH(v4l, AS_HELP_STRING([--without-v4l],[do not use v4l1 (v4l support)]))
|
||||
+AC_ARG_WITH(xattr, AS_HELP_STRING([--without-xattr],[do not use xattr (security attributes support)]))
|
||||
AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
|
||||
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
|
||||
AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]),
|
||||
@@ -661,6 +662,11 @@ AC_CHECK_HEADERS([libprocstat.h],,,
|
||||
#include <sys/socket.h>
|
||||
#endif])
|
||||
|
||||
+if test "x$with_xattr" != "xno"
|
||||
+then
|
||||
+ AC_CHECK_HEADERS(attr/xattr.h)
|
||||
+fi
|
||||
+
|
||||
dnl **** Check for working dll ****
|
||||
|
||||
AC_SUBST(dlldir,"\${libdir}/wine")
|
||||
diff --git a/server/file.c b/server/file.c
|
||||
index 8baa712..c375c72 100644
|
||||
--- a/server/file.c
|
||||
+++ b/server/file.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
+#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_UTIME_H
|
||||
#include <utime.h>
|
||||
@@ -39,6 +40,9 @@
|
||||
#ifdef HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
+#ifdef HAVE_ATTR_XATTR_H
|
||||
+#include <attr/xattr.h>
|
||||
+#endif
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
@@ -178,6 +182,66 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_
|
||||
return &file->obj;
|
||||
}
|
||||
|
||||
+void set_xattr_acls( int fd, const struct security_descriptor *sd )
|
||||
+{
|
||||
+#ifdef HAVE_ATTR_XATTR_H
|
||||
+ char buffer[XATTR_SIZE_MAX], *p = buffer;
|
||||
+ const ACE_HEADER *ace;
|
||||
+ int present, i, j, n;
|
||||
+ const ACL *dacl;
|
||||
+
|
||||
+ if (!sd) return;
|
||||
+ dacl = sd_get_dacl( sd, &present );
|
||||
+ if (!present || !dacl) return;
|
||||
+ ace = (const ACE_HEADER *)(dacl + 1);
|
||||
+
|
||||
+ for (i = 0; i < dacl->AceCount; i++, ace = ace_next( ace ))
|
||||
+ {
|
||||
+ BYTE type = ace->AceType, flags;
|
||||
+ const ACCESS_ALLOWED_ACE *aaa;
|
||||
+ const ACCESS_DENIED_ACE *ada;
|
||||
+ char sidtxt[100], *s;
|
||||
+ const SID *sid;
|
||||
+ DWORD mask;
|
||||
+
|
||||
+ if (type & INHERIT_ONLY_ACE) continue;
|
||||
+
|
||||
+ switch (type)
|
||||
+ {
|
||||
+ case ACCESS_DENIED_ACE_TYPE:
|
||||
+ ada = (const ACCESS_DENIED_ACE *)ace;
|
||||
+ flags = ada->Header.AceFlags;
|
||||
+ mask = ada->Mask;
|
||||
+ sid = (const SID *)&ada->SidStart;
|
||||
+ break;
|
||||
+ case ACCESS_ALLOWED_ACE_TYPE:
|
||||
+ aaa = (const ACCESS_ALLOWED_ACE *)ace;
|
||||
+ flags = aaa->Header.AceFlags;
|
||||
+ mask = aaa->Mask;
|
||||
+ sid = (const SID *)&aaa->SidStart;
|
||||
+ break;
|
||||
+ default:
|
||||
+ continue;
|
||||
+ }
|
||||
+ n = sprintf( sidtxt, "S-%u-%d", sid->Revision,
|
||||
+ MAKELONG(
|
||||
+ MAKEWORD( sid->IdentifierAuthority.Value[5],
|
||||
+ sid->IdentifierAuthority.Value[4] ),
|
||||
+ MAKEWORD( sid->IdentifierAuthority.Value[3],
|
||||
+ sid->IdentifierAuthority.Value[2] )
|
||||
+ ) );
|
||||
+ s = sidtxt + n;
|
||||
+ for( j=0; j<sid->SubAuthorityCount; j++ )
|
||||
+ s += sprintf( s, "-%u", sid->SubAuthority[j] );
|
||||
+
|
||||
+ p += snprintf( p, XATTR_SIZE_MAX-(p-buffer), "%s%x,%x,%x,%s",
|
||||
+ (p != buffer ? ";" : ""), type, flags, mask, sidtxt );
|
||||
+ }
|
||||
+
|
||||
+ fsetxattr( fd, "user.wine.acl", buffer, p-buffer, 0 );
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
static struct object *create_file( struct fd *root, const char *nameptr, data_size_t len,
|
||||
unsigned int access, unsigned int sharing, int create,
|
||||
unsigned int options, unsigned int attrs,
|
||||
@@ -239,6 +303,7 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si
|
||||
/* FIXME: should set error to STATUS_OBJECT_NAME_COLLISION if file existed before */
|
||||
fd = open_fd( root, name, flags | O_NONBLOCK | O_LARGEFILE, &mode, access, sharing, options );
|
||||
if (!fd) goto done;
|
||||
+ set_xattr_acls( get_unix_fd( fd ), sd );
|
||||
|
||||
if (S_ISDIR(mode))
|
||||
obj = create_dir_obj( fd, access, mode );
|
||||
@@ -580,6 +645,8 @@ int file_set_acls( struct object *obj, struct fd *fd, const struct security_desc
|
||||
mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX);
|
||||
mode |= sd_to_mode( sd, owner );
|
||||
|
||||
+ set_xattr_acls( unix_fd, sd );
|
||||
+
|
||||
if (((st.st_mode ^ mode) & (S_IRWXU|S_IRWXG|S_IRWXO)) && fchmod( unix_fd, mode ) == -1)
|
||||
{
|
||||
file_set_error();
|
||||
--
|
||||
1.7.9.5
|
||||
|
@ -1,44 +1,19 @@
|
||||
From 9eeab4088f54ab8f00fa36e3d3046e756a732a1e Mon Sep 17 00:00:00 2001
|
||||
From 66583f9f848becaa12d84270a2ebe7a79ac34724 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 6 Feb 2014 23:13:11 -0700
|
||||
Subject: server: Store and return security attributes with extended file
|
||||
Date: Thu, 13 Feb 2014 16:04:57 -0700
|
||||
Subject: server: Retrieve file security attributes with extended file
|
||||
attributes.
|
||||
|
||||
---
|
||||
configure.ac | 6 +
|
||||
dlls/advapi32/tests/security.c | 25 ++--
|
||||
server/file.c | 245 +++++++++++++++++++++++++++++++++++++++-
|
||||
3 files changed, 260 insertions(+), 16 deletions(-)
|
||||
dlls/advapi32/tests/security.c | 49 +++++++------
|
||||
server/file.c | 156 +++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 177 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index de807d2..ddf0000 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -73,6 +73,7 @@ AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthrea
|
||||
AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)]))
|
||||
AC_ARG_WITH(tiff, AS_HELP_STRING([--without-tiff],[do not use TIFF]))
|
||||
AC_ARG_WITH(v4l, AS_HELP_STRING([--without-v4l],[do not use v4l1 (v4l support)]))
|
||||
+AC_ARG_WITH(xattr, AS_HELP_STRING([--without-xattr],[do not use xattr (security attributes support)]))
|
||||
AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
|
||||
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
|
||||
AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]),
|
||||
@@ -660,6 +661,11 @@ AC_CHECK_HEADERS([libprocstat.h],,,
|
||||
#include <sys/socket.h>
|
||||
#endif])
|
||||
|
||||
+if test "x$with_xattr" != "xno"
|
||||
+then
|
||||
+ AC_CHECK_HEADERS(attr/xattr.h)
|
||||
+fi
|
||||
+
|
||||
dnl **** Check for working dll ****
|
||||
|
||||
AC_SUBST(dlldir,"\${libdir}/wine")
|
||||
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
|
||||
index f3cc85d..ceea60e 100644
|
||||
index e2e9cd5..f107abc 100644
|
||||
--- a/dlls/advapi32/tests/security.c
|
||||
+++ b/dlls/advapi32/tests/security.c
|
||||
@@ -3105,10 +3105,10 @@ static void test_CreateDirectoryA(void)
|
||||
@@ -3105,24 +3105,24 @@ static void test_CreateDirectoryA(void)
|
||||
bret = pGetAce(pDacl, 0, (VOID **)&ace);
|
||||
ok(bret, "Failed to get Current User ACE.\n");
|
||||
bret = EqualSid(&ace->SidStart, user_sid);
|
||||
@ -46,14 +21,17 @@ index f3cc85d..ceea60e 100644
|
||||
- todo_wine ok(((ACE_HEADER *)ace)->AceFlags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE),
|
||||
- "Current User ACE has unexpected flags (0x%x != 0x03)\n",
|
||||
- ((ACE_HEADER *)ace)->AceFlags);
|
||||
- ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
- ace->Mask);
|
||||
+ ok(bret, "Current User ACE != Current User SID.\n");
|
||||
+ ok(((ACE_HEADER *)ace)->AceFlags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE),
|
||||
+ "Current User ACE has unexpected flags (0x%x != 0x03)\n",
|
||||
+ ((ACE_HEADER *)ace)->AceFlags);
|
||||
ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
ace->Mask);
|
||||
+ todo_wine ok(ace->Mask == 0x1f01ff,
|
||||
+ "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
}
|
||||
@@ -3117,10 +3117,10 @@ static void test_CreateDirectoryA(void)
|
||||
if (acl_size.AceCount > 1)
|
||||
{
|
||||
bret = pGetAce(pDacl, 1, (VOID **)&ace);
|
||||
ok(bret, "Failed to get Administators Group ACE.\n");
|
||||
bret = EqualSid(&ace->SidStart, admin_sid);
|
||||
@ -61,14 +39,18 @@ index f3cc85d..ceea60e 100644
|
||||
- todo_wine ok(((ACE_HEADER *)ace)->AceFlags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE),
|
||||
- "Administators Group ACE has unexpected flags (0x%x != 0x03)\n",
|
||||
- ((ACE_HEADER *)ace)->AceFlags);
|
||||
- ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
- ace->Mask);
|
||||
+ ok(bret, "Administators Group ACE != Administators Group SID.\n");
|
||||
+ ok(((ACE_HEADER *)ace)->AceFlags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE),
|
||||
+ "Administators Group ACE has unexpected flags (0x%x != 0x03)\n",
|
||||
+ ((ACE_HEADER *)ace)->AceFlags);
|
||||
ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
ace->Mask);
|
||||
+ todo_wine ok(ace->Mask == 0x1f01ff,
|
||||
+ "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
}
|
||||
@@ -3294,7 +3294,7 @@ static void test_GetNamedSecurityInfoA(void)
|
||||
|
||||
done:
|
||||
@@ -3294,23 +3294,22 @@ static void test_GetNamedSecurityInfoA(void)
|
||||
bret = pGetAce(pDacl, 0, (VOID **)&ace);
|
||||
ok(bret, "Failed to get Current User ACE.\n");
|
||||
bret = EqualSid(&ace->SidStart, user_sid);
|
||||
@ -76,8 +58,13 @@ index f3cc85d..ceea60e 100644
|
||||
+ ok(bret, "Current User ACE != Current User SID.\n");
|
||||
ok(((ACE_HEADER *)ace)->AceFlags == 0,
|
||||
"Current User ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags);
|
||||
ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
@@ -3305,8 +3305,7 @@ static void test_GetNamedSecurityInfoA(void)
|
||||
- ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
- ace->Mask);
|
||||
+ todo_wine ok(ace->Mask == 0x1f01ff,
|
||||
+ "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
}
|
||||
if (acl_size.AceCount > 1)
|
||||
{
|
||||
bret = pGetAce(pDacl, 1, (VOID **)&ace);
|
||||
ok(bret, "Failed to get Administators Group ACE.\n");
|
||||
bret = EqualSid(&ace->SidStart, admin_sid);
|
||||
@ -86,8 +73,14 @@ index f3cc85d..ceea60e 100644
|
||||
+ ok(bret || broken(!bret) /* win2k */, "Administators Group ACE != Administators Group SID.\n");
|
||||
ok(((ACE_HEADER *)ace)->AceFlags == 0,
|
||||
"Administators Group ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags);
|
||||
ok(ace->Mask == 0x1f01ff || broken(ace->Mask == GENERIC_ALL) /* win2k */,
|
||||
@@ -3960,7 +3959,7 @@ static void test_GetSecurityInfo(void)
|
||||
- ok(ace->Mask == 0x1f01ff || broken(ace->Mask == GENERIC_ALL) /* win2k */,
|
||||
- "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
+ todo_wine ok(ace->Mask == 0x1f01ff || broken(ace->Mask == GENERIC_ALL) /* win2k */,
|
||||
+ "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
}
|
||||
LocalFree(pSD);
|
||||
HeapFree(GetProcessHeap(), 0, user);
|
||||
@@ -3960,22 +3959,22 @@ static void test_GetSecurityInfo(void)
|
||||
bret = pGetAce(pDacl, 0, (VOID **)&ace);
|
||||
ok(bret, "Failed to get Current User ACE.\n");
|
||||
bret = EqualSid(&ace->SidStart, user_sid);
|
||||
@ -95,8 +88,13 @@ index f3cc85d..ceea60e 100644
|
||||
+ ok(bret, "Current User ACE != Current User SID.\n");
|
||||
ok(((ACE_HEADER *)ace)->AceFlags == 0,
|
||||
"Current User ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags);
|
||||
ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
@@ -3971,7 +3970,7 @@ static void test_GetSecurityInfo(void)
|
||||
- ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
- ace->Mask);
|
||||
+ todo_wine ok(ace->Mask == 0x1f01ff,
|
||||
+ "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
}
|
||||
if (acl_size.AceCount > 1)
|
||||
{
|
||||
bret = pGetAce(pDacl, 1, (VOID **)&ace);
|
||||
ok(bret, "Failed to get Administators Group ACE.\n");
|
||||
bret = EqualSid(&ace->SidStart, admin_sid);
|
||||
@ -104,105 +102,18 @@ index f3cc85d..ceea60e 100644
|
||||
+ ok(bret, "Administators Group ACE != Administators Group SID.\n");
|
||||
ok(((ACE_HEADER *)ace)->AceFlags == 0,
|
||||
"Administators Group ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags);
|
||||
ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
- ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
- ace->Mask);
|
||||
+ todo_wine ok(ace->Mask == 0x1f01ff,
|
||||
+ "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
}
|
||||
CloseHandle(obj);
|
||||
}
|
||||
diff --git a/server/file.c b/server/file.c
|
||||
index 8baa712..0df2245 100644
|
||||
index c375c72..b9135b9 100644
|
||||
--- a/server/file.c
|
||||
+++ b/server/file.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
+#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_UTIME_H
|
||||
#include <utime.h>
|
||||
@@ -39,6 +40,9 @@
|
||||
#ifdef HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
+#ifdef HAVE_ATTR_XATTR_H
|
||||
+#include <attr/xattr.h>
|
||||
+#endif
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
@@ -178,6 +182,66 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_
|
||||
return &file->obj;
|
||||
}
|
||||
|
||||
+void set_xattr_acls( int fd, const struct security_descriptor *sd )
|
||||
+{
|
||||
+#ifdef HAVE_ATTR_XATTR_H
|
||||
+ char buffer[XATTR_SIZE_MAX], *p = buffer;
|
||||
+ const ACE_HEADER *ace;
|
||||
+ int present, i, j, n;
|
||||
+ const ACL *dacl;
|
||||
+
|
||||
+ if (!sd) return;
|
||||
+ dacl = sd_get_dacl( sd, &present );
|
||||
+ if (!present || !dacl) return;
|
||||
+ ace = (const ACE_HEADER *)(dacl + 1);
|
||||
+
|
||||
+ for (i = 0; i < dacl->AceCount; i++, ace = ace_next( ace ))
|
||||
+ {
|
||||
+ BYTE type = ace->AceType, flags;
|
||||
+ const ACCESS_ALLOWED_ACE *aaa;
|
||||
+ const ACCESS_DENIED_ACE *ada;
|
||||
+ char sidtxt[100], *s;
|
||||
+ const SID *sid;
|
||||
+ DWORD mask;
|
||||
+
|
||||
+ if (type & INHERIT_ONLY_ACE) continue;
|
||||
+
|
||||
+ switch (type)
|
||||
+ {
|
||||
+ case ACCESS_DENIED_ACE_TYPE:
|
||||
+ ada = (const ACCESS_DENIED_ACE *)ace;
|
||||
+ flags = ada->Header.AceFlags;
|
||||
+ mask = ada->Mask;
|
||||
+ sid = (const SID *)&ada->SidStart;
|
||||
+ break;
|
||||
+ case ACCESS_ALLOWED_ACE_TYPE:
|
||||
+ aaa = (const ACCESS_ALLOWED_ACE *)ace;
|
||||
+ flags = aaa->Header.AceFlags;
|
||||
+ mask = aaa->Mask;
|
||||
+ sid = (const SID *)&aaa->SidStart;
|
||||
+ break;
|
||||
+ default:
|
||||
+ continue;
|
||||
+ }
|
||||
+ n = sprintf( sidtxt, "S-%u-%d", sid->Revision,
|
||||
+ MAKELONG(
|
||||
+ MAKEWORD( sid->IdentifierAuthority.Value[5],
|
||||
+ sid->IdentifierAuthority.Value[4] ),
|
||||
+ MAKEWORD( sid->IdentifierAuthority.Value[3],
|
||||
+ sid->IdentifierAuthority.Value[2] )
|
||||
+ ) );
|
||||
+ s = sidtxt + n;
|
||||
+ for( j=0; j<sid->SubAuthorityCount; j++ )
|
||||
+ s += sprintf( s, "-%u", sid->SubAuthority[j] );
|
||||
+
|
||||
+ p += snprintf( p, XATTR_SIZE_MAX-(p-buffer), "%s%x,%x,%x,%s",
|
||||
+ (p != buffer ? ";" : ""), type, flags, mask, sidtxt );
|
||||
+ }
|
||||
+
|
||||
+ fsetxattr( fd, "user.wine.acl", buffer, p-buffer, 0 );
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
static struct object *create_file( struct fd *root, const char *nameptr, data_size_t len,
|
||||
unsigned int access, unsigned int sharing, int create,
|
||||
unsigned int options, unsigned int attrs,
|
||||
@@ -239,6 +303,7 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si
|
||||
/* FIXME: should set error to STATUS_OBJECT_NAME_COLLISION if file existed before */
|
||||
fd = open_fd( root, name, flags | O_NONBLOCK | O_LARGEFILE, &mode, access, sharing, options );
|
||||
if (!fd) goto done;
|
||||
+ set_xattr_acls( get_unix_fd( fd ), sd );
|
||||
|
||||
if (S_ISDIR(mode))
|
||||
obj = create_dir_obj( fd, access, mode );
|
||||
@@ -424,11 +489,181 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID
|
||||
@@ -489,11 +489,160 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID
|
||||
return sd;
|
||||
}
|
||||
|
||||
@ -353,27 +264,6 @@ index 8baa712..0df2245 100644
|
||||
+ return NULL;
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+/* Convert generic rights into standard access rights */
|
||||
+void convert_generic_sd( struct security_descriptor *sd )
|
||||
+{
|
||||
+ const ACL *dacl;
|
||||
+ int present;
|
||||
+
|
||||
+ dacl = sd_get_dacl( sd, &present );
|
||||
+ if (present && dacl)
|
||||
+ {
|
||||
+ const ACE_HEADER *ace = (const ACE_HEADER *)(dacl + 1);
|
||||
+ ULONG i;
|
||||
+
|
||||
+ for (i = 0; i < dacl->AceCount; i++, ace = ace_next( ace ))
|
||||
+ {
|
||||
+ DWORD *mask = (DWORD *)(ace + 1);
|
||||
+
|
||||
+ *mask = generic_file_map_access( *mask );
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
struct security_descriptor *file_get_acls( struct object *obj, struct fd *fd, mode_t *mode,
|
||||
uid_t *uid )
|
||||
@ -384,7 +274,7 @@ index 8baa712..0df2245 100644
|
||||
struct stat st;
|
||||
|
||||
if (unix_fd == -1 || fstat( unix_fd, &st ) == -1)
|
||||
@@ -439,9 +674,11 @@ struct security_descriptor *file_get_acls( struct object *obj, struct fd *fd, mo
|
||||
@@ -504,9 +653,10 @@ struct security_descriptor *file_get_acls( struct object *obj, struct fd *fd, mo
|
||||
(st.st_uid == *uid))
|
||||
return obj->sd;
|
||||
|
||||
@ -394,20 +284,10 @@ index 8baa712..0df2245 100644
|
||||
+ user = security_unix_uid_to_sid( st.st_uid );
|
||||
+ group = token_get_primary_group( current->process->token );
|
||||
+ sd = get_xattr_acls( unix_fd, user, group );
|
||||
+ if (sd) convert_generic_sd( sd );
|
||||
+ if (!sd) sd = mode_to_sd( st.st_mode, user, group);
|
||||
if (!sd) return obj->sd;
|
||||
|
||||
*mode = st.st_mode;
|
||||
@@ -580,6 +817,8 @@ int file_set_acls( struct object *obj, struct fd *fd, const struct security_desc
|
||||
mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX);
|
||||
mode |= sd_to_mode( sd, owner );
|
||||
|
||||
+ set_xattr_acls( unix_fd, sd );
|
||||
+
|
||||
if (((st.st_mode ^ mode) & (S_IRWXU|S_IRWXG|S_IRWXO)) && fchmod( unix_fd, mode ) == -1)
|
||||
{
|
||||
file_set_error();
|
||||
--
|
||||
1.7.9.5
|
||||
|
@ -0,0 +1,124 @@
|
||||
From e1b3d93adab31966d145ea41a9246d8f498c09d6 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 13 Feb 2014 16:06:54 -0700
|
||||
Subject: server: Convert return of file security masks with generic access
|
||||
mappings.
|
||||
|
||||
---
|
||||
dlls/advapi32/tests/security.c | 24 ++++++++++++------------
|
||||
server/file.c | 22 ++++++++++++++++++++++
|
||||
2 files changed, 34 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
|
||||
index f107abc..b71bad3 100644
|
||||
--- a/dlls/advapi32/tests/security.c
|
||||
+++ b/dlls/advapi32/tests/security.c
|
||||
@@ -3109,8 +3109,8 @@ static void test_CreateDirectoryA(void)
|
||||
ok(((ACE_HEADER *)ace)->AceFlags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE),
|
||||
"Current User ACE has unexpected flags (0x%x != 0x03)\n",
|
||||
((ACE_HEADER *)ace)->AceFlags);
|
||||
- todo_wine ok(ace->Mask == 0x1f01ff,
|
||||
- "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
+ ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
+ ace->Mask);
|
||||
}
|
||||
if (acl_size.AceCount > 1)
|
||||
{
|
||||
@@ -3121,8 +3121,8 @@ static void test_CreateDirectoryA(void)
|
||||
ok(((ACE_HEADER *)ace)->AceFlags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE),
|
||||
"Administators Group ACE has unexpected flags (0x%x != 0x03)\n",
|
||||
((ACE_HEADER *)ace)->AceFlags);
|
||||
- todo_wine ok(ace->Mask == 0x1f01ff,
|
||||
- "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
+ ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
+ ace->Mask);
|
||||
}
|
||||
|
||||
done:
|
||||
@@ -3297,8 +3297,8 @@ static void test_GetNamedSecurityInfoA(void)
|
||||
ok(bret, "Current User ACE != Current User SID.\n");
|
||||
ok(((ACE_HEADER *)ace)->AceFlags == 0,
|
||||
"Current User ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags);
|
||||
- todo_wine ok(ace->Mask == 0x1f01ff,
|
||||
- "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
+ ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
+ ace->Mask);
|
||||
}
|
||||
if (acl_size.AceCount > 1)
|
||||
{
|
||||
@@ -3308,8 +3308,8 @@ static void test_GetNamedSecurityInfoA(void)
|
||||
ok(bret || broken(!bret) /* win2k */, "Administators Group ACE != Administators Group SID.\n");
|
||||
ok(((ACE_HEADER *)ace)->AceFlags == 0,
|
||||
"Administators Group ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags);
|
||||
- todo_wine ok(ace->Mask == 0x1f01ff || broken(ace->Mask == GENERIC_ALL) /* win2k */,
|
||||
- "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
+ ok(ace->Mask == 0x1f01ff || broken(ace->Mask == GENERIC_ALL) /* win2k */,
|
||||
+ "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
}
|
||||
LocalFree(pSD);
|
||||
HeapFree(GetProcessHeap(), 0, user);
|
||||
@@ -3962,8 +3962,8 @@ static void test_GetSecurityInfo(void)
|
||||
ok(bret, "Current User ACE != Current User SID.\n");
|
||||
ok(((ACE_HEADER *)ace)->AceFlags == 0,
|
||||
"Current User ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags);
|
||||
- todo_wine ok(ace->Mask == 0x1f01ff,
|
||||
- "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
+ ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
+ ace->Mask);
|
||||
}
|
||||
if (acl_size.AceCount > 1)
|
||||
{
|
||||
@@ -3973,8 +3973,8 @@ static void test_GetSecurityInfo(void)
|
||||
ok(bret, "Administators Group ACE != Administators Group SID.\n");
|
||||
ok(((ACE_HEADER *)ace)->AceFlags == 0,
|
||||
"Administators Group ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags);
|
||||
- todo_wine ok(ace->Mask == 0x1f01ff,
|
||||
- "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
|
||||
+ ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
|
||||
+ ace->Mask);
|
||||
}
|
||||
CloseHandle(obj);
|
||||
}
|
||||
diff --git a/server/file.c b/server/file.c
|
||||
index b9135b9..0df2245 100644
|
||||
--- a/server/file.c
|
||||
+++ b/server/file.c
|
||||
@@ -637,6 +637,27 @@ struct security_descriptor *get_xattr_acls( int fd, const SID *user, const SID *
|
||||
#endif
|
||||
}
|
||||
|
||||
+/* Convert generic rights into standard access rights */
|
||||
+void convert_generic_sd( struct security_descriptor *sd )
|
||||
+{
|
||||
+ const ACL *dacl;
|
||||
+ int present;
|
||||
+
|
||||
+ dacl = sd_get_dacl( sd, &present );
|
||||
+ if (present && dacl)
|
||||
+ {
|
||||
+ const ACE_HEADER *ace = (const ACE_HEADER *)(dacl + 1);
|
||||
+ ULONG i;
|
||||
+
|
||||
+ for (i = 0; i < dacl->AceCount; i++, ace = ace_next( ace ))
|
||||
+ {
|
||||
+ DWORD *mask = (DWORD *)(ace + 1);
|
||||
+
|
||||
+ *mask = generic_file_map_access( *mask );
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
struct security_descriptor *file_get_acls( struct object *obj, struct fd *fd, mode_t *mode,
|
||||
uid_t *uid )
|
||||
{
|
||||
@@ -656,6 +677,7 @@ struct security_descriptor *file_get_acls( struct object *obj, struct fd *fd, mo
|
||||
user = security_unix_uid_to_sid( st.st_uid );
|
||||
group = token_get_primary_group( current->process->token );
|
||||
sd = get_xattr_acls( unix_fd, user, group );
|
||||
+ if (sd) convert_generic_sd( sd );
|
||||
if (!sd) sd = mode_to_sd( st.st_mode, user, group);
|
||||
if (!sd) return obj->sd;
|
||||
|
||||
--
|
||||
1.7.9.5
|
||||
|
@ -1,6 +1,6 @@
|
||||
From d1b4f66da4a58f3efadcf20957ed90b30211a1cb Mon Sep 17 00:00:00 2001
|
||||
From 81bfee65674a81a826b32629e218e457b5ef6b4b Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Fri, 7 Feb 2014 16:02:26 -0700
|
||||
Date: Thu, 13 Feb 2014 16:07:15 -0700
|
||||
Subject: server: Inherit security attributes from parent directories on
|
||||
creation.
|
||||
|
||||
@ -12,7 +12,7 @@ Subject: server: Inherit security attributes from parent directories on
|
||||
4 files changed, 184 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
|
||||
index ceea60e..1bf3185 100644
|
||||
index b71bad3..cad8ca9 100644
|
||||
--- a/dlls/advapi32/tests/security.c
|
||||
+++ b/dlls/advapi32/tests/security.c
|
||||
@@ -3030,10 +3030,11 @@ static void test_CreateDirectoryA(void)
|
@ -1,6 +1,6 @@
|
||||
From d944c7710c60e2cc1599bd6da75a41f876d647af Mon Sep 17 00:00:00 2001
|
||||
From 66f9f86efeef5c9113d724da5addeed8ae308a05 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Fri, 7 Feb 2014 16:03:46 -0700
|
||||
Date: Thu, 13 Feb 2014 16:07:20 -0700
|
||||
Subject: server: Inherit security attributes from parent directories on
|
||||
SetSecurityInfo.
|
||||
|
||||
@ -13,7 +13,7 @@ Subject: server: Inherit security attributes from parent directories on
|
||||
5 files changed, 203 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
|
||||
index 1bf3185..302f6b9 100644
|
||||
index cad8ca9..b795234 100644
|
||||
--- a/dlls/advapi32/tests/security.c
|
||||
+++ b/dlls/advapi32/tests/security.c
|
||||
@@ -3350,6 +3350,74 @@ static void test_GetNamedSecurityInfoA(void)
|
@ -1,6 +1,6 @@
|
||||
From 14a4e501f57bd10cb55b317ff6f4d45b06c0f0cd Mon Sep 17 00:00:00 2001
|
||||
From 938e979d889737ed2dcd4197aff9734891f06449 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Fri, 7 Feb 2014 16:04:05 -0700
|
||||
Date: Thu, 13 Feb 2014 16:07:26 -0700
|
||||
Subject: shell32: Set the default security attributes for user shell folders.
|
||||
|
||||
---
|
Loading…
Reference in New Issue
Block a user