From 2bfe73c2b7ced86a3596563944fbf1fe240fa349 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Tue, 8 Jul 2014 14:30:46 -0600 Subject: [PATCH] Updated main extended attributes patch to include BSD support. --- debian/changelog | 3 +- ...e-security-attributes-with-extended-.patch | 30 ++++--- ...r-and-group-inside-stored-extended-f.patch | 26 +++--- ...file-security-attributes-with-extend.patch | 18 +++-- ...dd-support-for-ACLs-xattr-on-FreeBSD.patch | 80 ------------------- 5 files changed, 45 insertions(+), 112 deletions(-) delete mode 100644 patches/02-ACL_Extended_Attributes/0012-server-Add-support-for-ACLs-xattr-on-FreeBSD.patch diff --git a/debian/changelog b/debian/changelog index 5f42d586..196df6ca 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,9 +5,10 @@ wine-compholio (1.7.22) UNRELEASED; urgency=low * Updated RegSetKeySecurity patch to work with special root keys. * Add patch for wtsapi32.WTSEnumerateProcessesW function. * Fix incorrect scaling for DECIMAL values in VarDecAdd. + * Updated main extended attributes patch to include BSD support. * Return NULL-terminated list of arguments in CommandLineToArgvW. * Updated main extended attributes patch to include additional data checks. - -- Erich E. Hoover Tue, 08 Jul 2014 14:31:43 -0600 + -- Erich E. Hoover Tue, 08 Jul 2014 14:32:30 -0600 wine-compholio (1.7.21) unstable; urgency=low * Remove several patches (accepted upstream). diff --git a/patches/02-ACL_Extended_Attributes/0003-server-Store-file-security-attributes-with-extended-.patch b/patches/02-ACL_Extended_Attributes/0003-server-Store-file-security-attributes-with-extended-.patch index 6ab084d2..3088f6df 100644 --- a/patches/02-ACL_Extended_Attributes/0003-server-Store-file-security-attributes-with-extended-.patch +++ b/patches/02-ACL_Extended_Attributes/0003-server-Store-file-security-attributes-with-extended-.patch @@ -1,4 +1,4 @@ -From 4ae376bebffe60ef378e08528d50c1e5723be739 Mon Sep 17 00:00:00 2001 +From a424efd08ebe4a247b4a3b874137faadb7f59266 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Fri, 18 Apr 2014 15:34:47 -0600 Subject: server: Store file security attributes with extended file @@ -6,11 +6,11 @@ Subject: server: Store file security attributes with extended file --- configure.ac | 12 ++++++++++++ - server/file.c | 31 +++++++++++++++++++++++++++++++ - 2 files changed, 43 insertions(+) + server/file.c | 39 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 51 insertions(+) diff --git a/configure.ac b/configure.ac -index 46602d6..99fcb9b 100644 +index c913f9f..2d5d5ee 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 @@ -27,7 +27,7 @@ index 46602d6..99fcb9b 100644 +if test "x$with_xattr" != "xno" +then -+ AC_CHECK_HEADERS(attr/xattr.h,HAVE_XATTR=1) ++ AC_CHECK_HEADERS(attr/xattr.h sys/extattr.h,HAVE_XATTR=1) +fi +if test "x$with_xattr" == "xyes" +then @@ -40,7 +40,7 @@ index 46602d6..99fcb9b 100644 AC_SUBST(dlldir,"\${libdir}/wine") diff --git a/server/file.c b/server/file.c -index 1f008ea..ceb57be 100644 +index 1f008ea..951e25b 100644 --- a/server/file.c +++ b/server/file.c @@ -32,6 +32,7 @@ @@ -51,23 +51,27 @@ index 1f008ea..ceb57be 100644 #include #ifdef HAVE_UTIME_H #include -@@ -39,6 +40,9 @@ +@@ -39,6 +40,13 @@ #ifdef HAVE_POLL_H #include #endif +#ifdef HAVE_ATTR_XATTR_H +#include ++#endif ++#ifdef HAVE_SYS_EXTATTR_H ++#include ++#define XATTR_SIZE_MAX 65536 +#endif #include "ntstatus.h" #define WIN32_NO_STATUS -@@ -178,6 +182,30 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_ +@@ -178,6 +186,34 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_ return &file->obj; } +void set_xattr_sd( int fd, const struct security_descriptor *sd ) +{ -+#ifdef HAVE_ATTR_XATTR_H ++#if defined(HAVE_ATTR_XATTR_H) || defined(HAVE_SYS_EXTATTR_H) + char buffer[XATTR_SIZE_MAX]; + int present, len; + const ACL *dacl; @@ -85,14 +89,18 @@ index 1f008ea..ceb57be 100644 + buffer[0] = SECURITY_DESCRIPTOR_REVISION; + buffer[1] = 0; + memcpy( &buffer[2], sd, len - 2 ); ++#if defined(HAVE_ATTR_XATTR_H) + fsetxattr( fd, "user.wine.sd", buffer, len, 0 ); ++#else ++ extattr_set_fd( fd, EXTATTR_NAMESPACE_USER, "wine.sd", buffer, len ); ++#endif +#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 +267,7 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si +@@ -239,6 +275,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; @@ -100,7 +108,7 @@ index 1f008ea..ceb57be 100644 if (S_ISDIR(mode)) obj = create_dir_obj( fd, access, mode ); -@@ -580,6 +609,8 @@ int set_file_sd( struct object *obj, struct fd *fd, const struct security_descri +@@ -580,6 +617,8 @@ int set_file_sd( struct object *obj, struct fd *fd, const struct security_descri mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX); mode |= sd_to_mode( sd, owner ); diff --git a/patches/02-ACL_Extended_Attributes/0004-server-Store-user-and-group-inside-stored-extended-f.patch b/patches/02-ACL_Extended_Attributes/0004-server-Store-user-and-group-inside-stored-extended-f.patch index 8f773884..adf81152 100644 --- a/patches/02-ACL_Extended_Attributes/0004-server-Store-user-and-group-inside-stored-extended-f.patch +++ b/patches/02-ACL_Extended_Attributes/0004-server-Store-user-and-group-inside-stored-extended-f.patch @@ -1,4 +1,4 @@ -From ea0c98e71750a0a55273c8cfb4a9c8931d3cf510 Mon Sep 17 00:00:00 2001 +From 9b59ad02610a11d39ee8338404fd26021e0458c6 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Fri, 18 Apr 2014 15:35:24 -0600 Subject: server: Store user and group inside stored extended file attribute @@ -9,17 +9,17 @@ Subject: server: Store user and group inside stored extended file attribute 1 file changed, 70 insertions(+), 9 deletions(-) diff --git a/server/file.c b/server/file.c -index ceb57be..b9106a8 100644 +index 951e25b..6981fca 100644 --- a/server/file.c +++ b/server/file.c -@@ -182,11 +182,12 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_ +@@ -186,11 +186,12 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_ return &file->obj; } -void set_xattr_sd( int fd, const struct security_descriptor *sd ) +void set_xattr_sd( int fd, const struct security_descriptor *sd, const SID *user, const SID *group ) { - #ifdef HAVE_ATTR_XATTR_H + #if defined(HAVE_ATTR_XATTR_H) || defined(HAVE_SYS_EXTATTR_H) - char buffer[XATTR_SIZE_MAX]; - int present, len; + char buffer[XATTR_SIZE_MAX], *dst_ptr = &buffer[2], *src_ptr = (char *)sd; @@ -28,7 +28,7 @@ index ceb57be..b9106a8 100644 const ACL *dacl; /* there's no point in storing the security descriptor if there's no DACL */ -@@ -194,14 +195,52 @@ void set_xattr_sd( int fd, const struct security_descriptor *sd ) +@@ -198,14 +199,52 @@ void set_xattr_sd( int fd, const struct security_descriptor *sd ) dacl = sd_get_dacl( sd, &present ); if (!present || !dacl) return; @@ -80,10 +80,10 @@ index ceb57be..b9106a8 100644 + memcpy( dst_ptr, src_ptr, sd->dacl_len ); + src_ptr += sd->dacl_len; + dst_ptr += sd->dacl_len; + #if defined(HAVE_ATTR_XATTR_H) fsetxattr( fd, "user.wine.sd", buffer, len, 0 ); - #endif - } -@@ -211,6 +250,7 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si + #else +@@ -219,6 +258,7 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si unsigned int options, unsigned int attrs, const struct security_descriptor *sd ) { @@ -91,7 +91,7 @@ index ceb57be..b9106a8 100644 struct object *obj = NULL; struct fd *fd; int flags; -@@ -241,9 +281,12 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si +@@ -249,9 +289,12 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si if (sd) { @@ -105,7 +105,7 @@ index ceb57be..b9106a8 100644 mode = sd_to_mode( sd, owner ); } else if (options & FILE_DIRECTORY_FILE) -@@ -267,7 +310,7 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si +@@ -275,7 +318,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; @@ -114,7 +114,7 @@ index ceb57be..b9106a8 100644 if (S_ISDIR(mode)) obj = create_dir_obj( fd, access, mode ); -@@ -577,7 +620,7 @@ int set_file_sd( struct object *obj, struct fd *fd, const struct security_descri +@@ -585,7 +628,7 @@ int set_file_sd( struct object *obj, struct fd *fd, const struct security_descri unsigned int set_info ) { int unix_fd = get_unix_fd( fd ); @@ -123,7 +123,7 @@ index ceb57be..b9106a8 100644 struct stat st; mode_t mode; -@@ -601,6 +644,24 @@ int set_file_sd( struct object *obj, struct fd *fd, const struct security_descri +@@ -609,6 +652,24 @@ int set_file_sd( struct object *obj, struct fd *fd, const struct security_descri else owner = token_get_user( current->process->token ); @@ -148,7 +148,7 @@ index ceb57be..b9106a8 100644 /* group and sacl not supported */ if (set_info & DACL_SECURITY_INFORMATION) -@@ -609,7 +670,7 @@ int set_file_sd( struct object *obj, struct fd *fd, const struct security_descri +@@ -617,7 +678,7 @@ int set_file_sd( struct object *obj, struct fd *fd, const struct security_descri mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX); mode |= sd_to_mode( sd, owner ); diff --git a/patches/02-ACL_Extended_Attributes/0005-server-Retrieve-file-security-attributes-with-extend.patch b/patches/02-ACL_Extended_Attributes/0005-server-Retrieve-file-security-attributes-with-extend.patch index 3fec9407..f1b70713 100644 --- a/patches/02-ACL_Extended_Attributes/0005-server-Retrieve-file-security-attributes-with-extend.patch +++ b/patches/02-ACL_Extended_Attributes/0005-server-Retrieve-file-security-attributes-with-extend.patch @@ -1,4 +1,4 @@ -From 935a2c860d16ac42e4f6f97370aab51dbd8f4527 Mon Sep 17 00:00:00 2001 +From 0fea62714c3bdf5384f2f47c1985c21470710cfd Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Fri, 18 Apr 2014 14:01:35 -0600 Subject: server: Retrieve file security attributes with extended file @@ -7,8 +7,8 @@ Subject: server: Retrieve file security attributes with extended file --- dlls/advapi32/tests/security.c | 49 ++++++++++++++++++++-------------------- server/change.c | 2 +- - server/file.c | 34 +++++++++++++++++++++++++--- - 3 files changed, 56 insertions(+), 29 deletions(-) + server/file.c | 38 ++++++++++++++++++++++++++++--- + 3 files changed, 60 insertions(+), 29 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index f3ccc8e..4352ba6 100644 @@ -124,21 +124,25 @@ index c673c48..27dbe25 100644 return sd; } diff --git a/server/file.c b/server/file.c -index 6981fca..66fb7af 100644 +index 6981fca..26962df 100644 --- a/server/file.c +++ b/server/file.c -@@ -504,12 +504,39 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID +@@ -504,12 +504,43 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID return sd; } +struct security_descriptor *get_xattr_sd( int fd ) +{ -+#ifdef HAVE_ATTR_XATTR_H ++#if defined(HAVE_ATTR_XATTR_H) || defined(HAVE_SYS_EXTATTR_H) + struct security_descriptor *sd; + char buffer[XATTR_SIZE_MAX]; + int n; + ++#if defined(HAVE_ATTR_XATTR_H) + n = fgetxattr( fd, "user.wine.sd", buffer, sizeof(buffer) ); ++#else ++ n = extattr_get_fd( fd, EXTATTR_NAMESPACE_USER, "wine.sd", buffer, sizeof(buffer) ); ++#endif + if (n == -1 || n < 2 + sizeof(struct security_descriptor)) return NULL; + + /* validate that we can handle the descriptor */ @@ -167,7 +171,7 @@ index 6981fca..66fb7af 100644 if (unix_fd == -1 || fstat( unix_fd, &st ) == -1) return obj->sd; -@@ -519,9 +546,10 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode +@@ -519,9 +550,10 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode (st.st_uid == *uid)) return obj->sd; diff --git a/patches/02-ACL_Extended_Attributes/0012-server-Add-support-for-ACLs-xattr-on-FreeBSD.patch b/patches/02-ACL_Extended_Attributes/0012-server-Add-support-for-ACLs-xattr-on-FreeBSD.patch deleted file mode 100644 index e6038599..00000000 --- a/patches/02-ACL_Extended_Attributes/0012-server-Add-support-for-ACLs-xattr-on-FreeBSD.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 682e63875f4ae2f58da1677ff44cf1adea35e7d8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sun, 1 Jun 2014 22:06:35 +0200 -Subject: server: Add support for ACLs/xattr on FreeBSD - ---- - configure.ac | 2 +- - server/file.c | 16 ++++++++++++++-- - 2 files changed, 15 insertions(+), 3 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 0663893..c1ea0c9 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -668,7 +668,7 @@ AC_CHECK_HEADERS([libprocstat.h],,, - - if test "x$with_xattr" != "xno" - then -- AC_CHECK_HEADERS(attr/xattr.h,HAVE_XATTR=1) -+ AC_CHECK_HEADERS(attr/xattr.h sys/extattr.h,HAVE_XATTR=1) - fi - if test "x$with_xattr" == "xyes" - then -diff --git a/server/file.c b/server/file.c -index d5d5ad4..5a4d2f4 100644 ---- a/server/file.c -+++ b/server/file.c -@@ -43,6 +43,10 @@ - #ifdef HAVE_ATTR_XATTR_H - #include - #endif -+#ifdef HAVE_SYS_EXTATTR_H -+#include -+#define XATTR_SIZE_MAX 65536 -+#endif - - #include "ntstatus.h" - #define WIN32_NO_STATUS -@@ -184,7 +188,7 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_ - - void set_xattr_sd( int fd, const struct security_descriptor *sd, const SID *user, const SID *group ) - { --#ifdef HAVE_ATTR_XATTR_H -+#if defined(HAVE_ATTR_XATTR_H) || defined(HAVE_SYS_EXTATTR_H) - char buffer[XATTR_SIZE_MAX], *dst_ptr = &buffer[2], *src_ptr = (char *)sd; - int present, len, owner_len, group_len; - struct security_descriptor *dst_sd; -@@ -241,7 +245,11 @@ void set_xattr_sd( int fd, const struct security_descriptor *sd, const SID *user - memcpy( dst_ptr, src_ptr, sd->dacl_len ); - src_ptr += sd->dacl_len; - dst_ptr += sd->dacl_len; -+#if defined(HAVE_ATTR_XATTR_H) - fsetxattr( fd, "user.wine.sd", buffer, len, 0 ); -+#else -+ extattr_set_fd( fd, EXTATTR_NAMESPACE_USER, "wine.sd", buffer, len ); -+#endif - #endif - } - -@@ -732,12 +740,16 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID - - struct security_descriptor *get_xattr_sd( int fd ) - { --#ifdef HAVE_ATTR_XATTR_H -+#if defined(HAVE_ATTR_XATTR_H) || defined(HAVE_SYS_EXTATTR_H) - struct security_descriptor *sd; - char buffer[XATTR_SIZE_MAX]; - int n; - -+#if defined(HAVE_ATTR_XATTR_H) - n = fgetxattr( fd, "user.wine.sd", buffer, sizeof(buffer) ); -+#else -+ n = extattr_get_fd( fd, EXTATTR_NAMESPACE_USER, "wine.sd", buffer, sizeof(buffer) ); -+#endif - if (n == -1 || n < 2 + sizeof(struct security_descriptor)) return NULL; - - /* validate that we can handle the descriptor */ --- -1.7.9.5 -