Split DOS Attributes patches to include Mac OS X and FreeBSD support separately.

This commit is contained in:
Erich E. Hoover 2014-10-09 08:00:15 -06:00
parent 69db736c0c
commit ac0b4fe1ac
9 changed files with 282 additions and 117 deletions

View File

@ -578,7 +578,9 @@ ntdll-DOS_Attributes.ok:
$(call APPLY_FILE,ntdll-DOS_Attributes/0003-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch)
$(call APPLY_FILE,ntdll-DOS_Attributes/0004-ntdll-Implement-storing-DOS-attributes-in-NtSetInfor.patch)
$(call APPLY_FILE,ntdll-DOS_Attributes/0005-ntdll-Implement-storing-DOS-attributes-in-NtCreateFi.patch)
$(call APPLY_FILE,ntdll-DOS_Attributes/0006-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch)
$(call APPLY_FILE,ntdll-DOS_Attributes/0006-libport-Add-support-for-Mac-OS-X-style-extended-attr.patch)
$(call APPLY_FILE,ntdll-DOS_Attributes/0007-libport-Add-support-for-FreeBSD-style-extended-attri.patch)
$(call APPLY_FILE,ntdll-DOS_Attributes/0008-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch)
@( \
echo '+ { "ntdll-DOS_Attributes", "Erich E. Hoover", "Implement DOS hidden/system file attributes" },'; \
) > ntdll-DOS_Attributes.ok

View File

@ -1,33 +1,33 @@
From 87d1db941666d1136b0501d60a27dee82be482a7 Mon Sep 17 00:00:00 2001
From 6d3f985054009a9030276bc6fa7ff9cd6ee3bf29 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Tue, 19 Aug 2014 22:10:49 -0600
Subject: ntdll: Implement retrieving DOS attributes in
NtQueryInformationFile.
---
configure.ac | 25 ++++++++++++++++++++
dlls/ntdll/file.c | 30 +++++++++++++++++++++++-
include/wine/port.h | 11 +++++++++
configure.ac | 12 ++++++++++++
dlls/ntdll/file.c | 30 +++++++++++++++++++++++++++++-
include/wine/port.h | 8 ++++++++
libs/port/Makefile.in | 3 ++-
libs/port/xattr.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 128 insertions(+), 2 deletions(-)
libs/port/xattr.c | 39 +++++++++++++++++++++++++++++++++++++++
5 files changed, 90 insertions(+), 2 deletions(-)
create mode 100644 libs/port/xattr.c
diff --git a/configure.ac b/configure.ac
index f1f721d..f2c00e0 100644
index f1f721d..fe06575 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,2 +77,3 @@ 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]),
@@ -667,6 +668,30 @@ AC_CHECK_HEADERS([libprocstat.h],,,
@@ -667,6 +668,17 @@ AC_CHECK_HEADERS([libprocstat.h],,,
#include <sys/socket.h>
#endif])
+if test "x$with_xattr" != "xno"
+then
+ AC_CHECK_HEADERS(attr/xattr.h sys/xattr.h sys/extattr.h, HAVE_XATTR=1)
+ AC_CHECK_HEADERS(attr/xattr.h, [HAVE_XATTR=1])
+fi
+if test "x$with_xattr" == "xyes"
+then
@ -35,19 +35,6 @@ index f1f721d..f2c00e0 100644
+not found. Wine will be built without extended attribute support, which probably isn't what you \
+want. You will need to install ${notice_platform}development packages of libattr at the very least.])
+fi
+if test "x$HAVE_XATTR" != "x"
+then
+ AC_CACHE_CHECK([whether xattr functions take additional options],
+ wine_cv_xattr_additional_options,
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/xattr.h>]],
+ [[getxattr("", "", "", 0, 0, 0);]])],
+ [wine_cv_xattr_additional_options=yes],
+ [wine_cv_xattr_additional_options=no]))
+ if test "$wine_cv_xattr_additional_options" = "yes"
+ then
+ AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [Define if xattr takes additional arguments (Mac OS X)])
+ fi
+fi
+
dnl **** Check for working dll ****
@ -107,20 +94,17 @@ index 53cce85..83eaeba 100644
}
diff --git a/include/wine/port.h b/include/wine/port.h
index 3548a44..715a9e2 100644
index 3548a44..521246b 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -363,6 +363,17 @@ extern int mkstemps(char *template, int suffix_len);
@@ -363,6 +363,14 @@ extern int mkstemps(char *template, int suffix_len);
extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]);
#endif
+/* Extended attribute functions */
+
+#ifndef XATTR_USER_PREFIX
+#define XATTR_USER_PREFIX "user."
+#endif
+#ifndef XATTR_USER_PREFIX_LEN
+#define XATTR_USER_PREFIX_LEN (sizeof(XATTR_USER_PREFIX) - 1)
+# define XATTR_USER_PREFIX "user."
+#endif
+
+extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
@ -141,10 +125,10 @@ index 65f1714..67efbc7 100644
+ xattr.c
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
new file mode 100644
index 0000000..70fd047
index 0000000..2d37be9
--- /dev/null
+++ b/libs/port/xattr.c
@@ -0,0 +1,61 @@
@@ -0,0 +1,39 @@
+/*
+ * extended attributes functions
+ *
@ -168,39 +152,17 @@ index 0000000..70fd047
+#include "config.h"
+#include "wine/port.h"
+
+#ifdef HAVE_SYS_XATTR_H
+# include <sys/xattr.h>
+#endif
+#ifdef HAVE_ATTR_XATTR_H
+#if defined(HAVE_ATTR_XATTR_H)
+# include <attr/xattr.h>
+#endif
+#ifdef HAVE_SYS_EXTATTR_H
+# include <sys/extattr.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+
+static inline int xattr_valid_namespace( const char *name )
+{
+ if (strncmp( XATTR_USER_PREFIX, name, XATTR_USER_PREFIX_LEN ) != 0)
+ {
+ errno = EPERM;
+ return 0;
+ }
+ return 1;
+}
+
+int xattr_fget( int filedes, const char *name, void *value, size_t size )
+{
+ if (!xattr_valid_namespace( name )) return -1;
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return fgetxattr( filedes, name, value, size, 0, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
+#if defined(HAVE_ATTR_XATTR_H)
+ return fgetxattr( filedes, name, value, size );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ return extattr_get_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN],
+ value, size );
+#else
+ errno = ENOTSUP;
+ return -1;

View File

@ -1,4 +1,4 @@
From 6dbb49c2ada44eba6d4f77ebb7059e91b435fb73 Mon Sep 17 00:00:00 2001
From 5b894c0d08fec1e1a1fd902703213cf783de196f Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 16:04:34 -0600
Subject: ntdll: Implement retrieving DOS attributes in
@ -7,8 +7,8 @@ Subject: ntdll: Implement retrieving DOS attributes in
---
dlls/ntdll/file.c | 7 ++++++-
include/wine/port.h | 1 +
libs/port/xattr.c | 16 ++++++++++++++++
3 files changed, 23 insertions(+), 1 deletion(-)
libs/port/xattr.c | 10 ++++++++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 83eaeba..73a2789 100644
@ -36,10 +36,10 @@ index 83eaeba..73a2789 100644
}
diff --git a/include/wine/port.h b/include/wine/port.h
index 715a9e2..7d8ea1a 100644
index 521246b..7977eb9 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -373,6 +373,7 @@ extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]);
@@ -370,6 +370,7 @@ extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]);
#endif
extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
@ -48,24 +48,18 @@ index 715a9e2..7d8ea1a 100644
/* Interlocked functions */
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 70fd047..ab50758 100644
index 2d37be9..6ddaa9c 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -59,3 +59,19 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
@@ -37,3 +37,13 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
return -1;
#endif
}
+
+int xattr_get( const char *path, const char *name, void *value, size_t size )
+{
+ if (!xattr_valid_namespace( name )) return -1;
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return getxattr( path, name, value, size, 0, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
+#if defined(HAVE_ATTR_XATTR_H)
+ return getxattr( path, name, value, size );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ return extattr_get_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN],
+ value, size );
+#else
+ errno = ENOTSUP;
+ return -1;

View File

@ -1,4 +1,4 @@
From 931ab03f342fb65cece5c1fc83b8ef1fee22c1df Mon Sep 17 00:00:00 2001
From 52e1d7d25db39c1bd748c8994a33c6d0e5664997 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 00:08:52 -0600
Subject: ntdll: Implement storing DOS attributes in NtSetInformationFile.
@ -7,8 +7,8 @@ Subject: ntdll: Implement storing DOS attributes in NtSetInformationFile.
dlls/ntdll/file.c | 53 +++++++++++++++++++++++++++++------------------
dlls/ntdll/tests/file.c | 8 +++----
include/wine/port.h | 2 ++
libs/port/xattr.c | 31 +++++++++++++++++++++++++++
4 files changed, 70 insertions(+), 24 deletions(-)
libs/port/xattr.c | 20 ++++++++++++++++++
4 files changed, 59 insertions(+), 24 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 73a2789..4619058 100644
@ -129,10 +129,10 @@ index d70ed6b..7a8e5d4 100644
/* Check NORMAL last of all (to make sure we can clear attributes) */
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
diff --git a/include/wine/port.h b/include/wine/port.h
index 7d8ea1a..af052da 100644
index 7977eb9..cc572f3 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -373,6 +373,8 @@ extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]);
@@ -370,6 +370,8 @@ extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]);
#endif
extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
@ -142,22 +142,17 @@ index 7d8ea1a..af052da 100644
/* Interlocked functions */
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index ab50758..61c9f33 100644
index 6ddaa9c..3ce5ffc 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -60,6 +60,37 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
@@ -38,6 +38,26 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
#endif
}
+int xattr_fremove( int filedes, const char *name )
+{
+ if (!xattr_valid_namespace( name )) return -1;
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return fremovexattr( filedes, name, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
+#if defined(HAVE_ATTR_XATTR_H)
+ return fremovexattr( filedes, name );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ return extattr_delete_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN] );
+#else
+ errno = ENOTSUP;
+ return -1;
@ -166,14 +161,8 @@ index ab50758..61c9f33 100644
+
+int xattr_fset( int filedes, const char *name, void *value, size_t size )
+{
+ if (!xattr_valid_namespace( name )) return -1;
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return fsetxattr( filedes, name, value, size, 0, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
+#if defined(HAVE_ATTR_XATTR_H)
+ return fsetxattr( filedes, name, value, size, 0 );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ return extattr_set_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN],
+ value, size );
+#else
+ errno = ENOTSUP;
+ return -1;
@ -182,7 +171,7 @@ index ab50758..61c9f33 100644
+
int xattr_get( const char *path, const char *name, void *value, size_t size )
{
if (!xattr_valid_namespace( name )) return -1;
#if defined(HAVE_ATTR_XATTR_H)
--
1.7.9.5

View File

@ -1,4 +1,4 @@
From 86638b3b8cdc371ce6381d9ba1ad39e23d7de332 Mon Sep 17 00:00:00 2001
From 1a4daa5330fd749be070bcd9be85f57fae1b6a15 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 15:28:00 -0600
Subject: ntdll: Implement storing DOS attributes in NtCreateFile.
@ -7,8 +7,8 @@ Subject: ntdll: Implement storing DOS attributes in NtCreateFile.
dlls/ntdll/file.c | 79 ++++++++++++++++++++++++++----------------
dlls/ntdll/tests/directory.c | 22 +++++-------
include/wine/port.h | 2 ++
libs/port/xattr.c | 31 +++++++++++++++++
4 files changed, 91 insertions(+), 43 deletions(-)
libs/port/xattr.c | 20 +++++++++++
4 files changed, 80 insertions(+), 43 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 4619058..7582ff1 100644
@ -180,10 +180,10 @@ index f190ff4..68b5406 100644
}
testfiles[i].nfound++;
diff --git a/include/wine/port.h b/include/wine/port.h
index af052da..f989731 100644
index cc572f3..9e2b8165 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -376,6 +376,8 @@ extern int xattr_fget( int filedes, const char *name, void *value, size_t size )
@@ -373,6 +373,8 @@ extern int xattr_fget( int filedes, const char *name, void *value, size_t size )
extern int xattr_fremove( int filedes, const char *name );
extern int xattr_fset( int filedes, const char *name, void *value, size_t size );
extern int xattr_get( const char *path, const char *name, void *value, size_t size );
@ -193,23 +193,18 @@ index af052da..f989731 100644
/* Interlocked functions */
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 61c9f33..09491a4 100644
index 3ce5ffc..dc89a45 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -106,3 +106,34 @@ int xattr_get( const char *path, const char *name, void *value, size_t size )
@@ -67,3 +67,23 @@ int xattr_get( const char *path, const char *name, void *value, size_t size )
return -1;
#endif
}
+
+int xattr_remove( const char *path, const char *name )
+{
+ if (!xattr_valid_namespace( name )) return -1;
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return removexattr( path, name, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
+#if defined(HAVE_ATTR_XATTR_H)
+ return removexattr( path, name );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ return extattr_delete_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN] );
+#else
+ errno = ENOTSUP;
+ return -1;
@ -218,14 +213,8 @@ index 61c9f33..09491a4 100644
+
+int xattr_set( const char *path, const char *name, void *value, size_t size )
+{
+ if (!xattr_valid_namespace( name )) return -1;
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return setxattr( path, name, value, size, 0, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
+#if defined(HAVE_ATTR_XATTR_H)
+ return setxattr( path, name, value, size, 0 );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ return extattr_set_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN],
+ value, size );
+#else
+ errno = ENOTSUP;
+ return -1;

View File

@ -0,0 +1,106 @@
From 6dc0676e0cb53e392207fbbd4d0465399456804f Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Mon, 6 Oct 2014 14:21:11 -0600
Subject: libport: Add support for Mac OS X style extended attributes.
---
configure.ac | 3 +++
libs/port/xattr.c | 26 ++++++++++++++++++++------
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index fe06575..e6d8d94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -671,6 +671,9 @@ AC_CHECK_HEADERS([libprocstat.h],,,
if test "x$with_xattr" != "xno"
then
AC_CHECK_HEADERS(attr/xattr.h, [HAVE_XATTR=1])
+ AC_CHECK_HEADERS(sys/xattr.h, [HAVE_XATTR=1]
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/xattr.h>]], [[getxattr("", "", "", 0, 0, 0);]])],
+ [AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [Define if xattr functions take additional arguments (Mac OS X)])])])
fi
if test "x$with_xattr" == "xyes"
then
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index dc89a45..3badafc 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -23,6 +23,8 @@
#if defined(HAVE_ATTR_XATTR_H)
# include <attr/xattr.h>
+#elif defined(HAVE_SYS_XATTR_H)
+# include <sys/xattr.h>
#endif
#include <ctype.h>
@@ -30,7 +32,9 @@
int xattr_fget( int filedes, const char *name, void *value, size_t size )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return fgetxattr( filedes, name, value, size, 0, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return fgetxattr( filedes, name, value, size );
#else
errno = ENOTSUP;
@@ -40,7 +44,9 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
int xattr_fremove( int filedes, const char *name )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return fremovexattr( filedes, name, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return fremovexattr( filedes, name );
#else
errno = ENOTSUP;
@@ -50,7 +56,9 @@ int xattr_fremove( int filedes, const char *name )
int xattr_fset( int filedes, const char *name, void *value, size_t size )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return fsetxattr( filedes, name, value, size, 0, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return fsetxattr( filedes, name, value, size, 0 );
#else
errno = ENOTSUP;
@@ -60,7 +68,9 @@ int xattr_fset( int filedes, const char *name, void *value, size_t size )
int xattr_get( const char *path, const char *name, void *value, size_t size )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return getxattr( path, name, value, size, 0, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return getxattr( path, name, value, size );
#else
errno = ENOTSUP;
@@ -70,7 +80,9 @@ int xattr_get( const char *path, const char *name, void *value, size_t size )
int xattr_remove( const char *path, const char *name )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return removexattr( path, name, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return removexattr( path, name );
#else
errno = ENOTSUP;
@@ -80,7 +92,9 @@ int xattr_remove( const char *path, const char *name )
int xattr_set( const char *path, const char *name, void *value, size_t size )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return setxattr( path, name, value, size, 0, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return setxattr( path, name, value, size, 0 );
#else
errno = ENOTSUP;
--
1.7.9.5

View File

@ -0,0 +1,123 @@
From 1d57df0cf9dfaaa4ef8e28b4e3a35c9b3145acdb Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Mon, 6 Oct 2014 14:26:24 -0600
Subject: libport: Add support for FreeBSD style extended attributes.
---
configure.ac | 2 +-
libs/port/xattr.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index e6d8d94..08c2011 100644
--- a/configure.ac
+++ b/configure.ac
@@ -670,7 +670,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])
AC_CHECK_HEADERS(sys/xattr.h, [HAVE_XATTR=1]
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/xattr.h>]], [[getxattr("", "", "", 0, 0, 0);]])],
[AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [Define if xattr functions take additional arguments (Mac OS X)])])])
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 3badafc..d759aa4 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -25,17 +25,39 @@
# include <attr/xattr.h>
#elif defined(HAVE_SYS_XATTR_H)
# include <sys/xattr.h>
+#elif defined(HAVE_SYS_EXTATTR_H)
+# include <sys/extattr.h>
#endif
#include <ctype.h>
#include <errno.h>
+#ifndef XATTR_USER_PREFIX_LEN
+# define XATTR_USER_PREFIX_LEN (sizeof(XATTR_USER_PREFIX) - 1)
+#endif
+
+#ifdef HAVE_SYS_EXTATTR_H
+static inline int xattr_valid_namespace( const char *name )
+{
+ if (strncmp( XATTR_USER_PREFIX, name, XATTR_USER_PREFIX_LEN ) != 0)
+ {
+ errno = EPERM;
+ return 0;
+ }
+ return 1;
+}
+#endif
+
int xattr_fget( int filedes, const char *name, void *value, size_t size )
{
#if defined(XATTR_ADDITIONAL_OPTIONS)
return fgetxattr( filedes, name, value, size, 0, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return fgetxattr( filedes, name, value, size );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ if (!xattr_valid_namespace( name )) return -1;
+ return extattr_get_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN],
+ value, size );
#else
errno = ENOTSUP;
return -1;
@@ -48,6 +70,9 @@ int xattr_fremove( int filedes, const char *name )
return fremovexattr( filedes, name, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return fremovexattr( filedes, name );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ if (!xattr_valid_namespace( name )) return -1;
+ return extattr_delete_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN] );
#else
errno = ENOTSUP;
return -1;
@@ -60,6 +85,10 @@ int xattr_fset( int filedes, const char *name, void *value, size_t size )
return fsetxattr( filedes, name, value, size, 0, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return fsetxattr( filedes, name, value, size, 0 );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ if (!xattr_valid_namespace( name )) return -1;
+ return extattr_set_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN],
+ value, size );
#else
errno = ENOTSUP;
return -1;
@@ -72,6 +101,10 @@ int xattr_get( const char *path, const char *name, void *value, size_t size )
return getxattr( path, name, value, size, 0, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return getxattr( path, name, value, size );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ if (!xattr_valid_namespace( name )) return -1;
+ return extattr_get_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN],
+ value, size );
#else
errno = ENOTSUP;
return -1;
@@ -84,6 +117,9 @@ int xattr_remove( const char *path, const char *name )
return removexattr( path, name, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return removexattr( path, name );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ if (!xattr_valid_namespace( name )) return -1;
+ return extattr_delete_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN] );
#else
errno = ENOTSUP;
return -1;
@@ -96,6 +132,10 @@ int xattr_set( const char *path, const char *name, void *value, size_t size )
return setxattr( path, name, value, size, 0, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return setxattr( path, name, value, size, 0 );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ if (!xattr_valid_namespace( name )) return -1;
+ return extattr_set_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN],
+ value, size );
#else
errno = ENOTSUP;
return -1;
--
1.7.9.5

View File

@ -1,4 +1,4 @@
From 6d70e3b84dd0ae01bec2b4c2b27b4c5d046bd385 Mon Sep 17 00:00:00 2001
From ed60b546ccfbb8f7640b330aee7c080052ab53a8 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 11:26:48 -0600
Subject: ntdll: Perform the Unix-style hidden file check within the unified

View File

@ -1,4 +1,4 @@
From 0184c0316ba0e8ebbce82d8058f4979bfd2b8c97 Mon Sep 17 00:00:00 2001
From 687e5f2a153a1fbbac2631bea088b0237f2d4a20 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Fri, 18 Apr 2014 15:34:47 -0600
Subject: server: Store file security attributes with extended file
@ -10,15 +10,15 @@ Subject: server: Store file security attributes with extended file
2 files changed, 37 insertions(+)
diff --git a/include/wine/port.h b/include/wine/port.h
index f989731..433f1b9 100644
index 9e2b8165..71be265 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -371,6 +371,9 @@ extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]);
#ifndef XATTR_USER_PREFIX_LEN
#define XATTR_USER_PREFIX_LEN (sizeof(XATTR_USER_PREFIX) - 1)
@@ -368,6 +368,9 @@ extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]);
#ifndef XATTR_USER_PREFIX
# define XATTR_USER_PREFIX "user."
#endif
+#ifndef XATTR_SIZE_MAX
+#define XATTR_SIZE_MAX 65536
+# define XATTR_SIZE_MAX 65536
+#endif
extern int xattr_fget( int filedes, const char *name, void *value, size_t size );