Commit 433d7bf0 authored by Erich E. Hoover's avatar Erich E. Hoover Committed by Vitaly Lipatov

ntdll: Implement retrieving DOS attributes in [fd_]get_file_info().

parent 094e2ad3
......@@ -886,6 +886,7 @@ with_unwind
with_usb
with_v4l2
with_vulkan
with_xattr
with_xcomposite
with_xcursor
with_xfixes
......@@ -2379,6 +2380,7 @@ Optional Packages:
--without-usb do not use the libusb library
--without-v4l2 do not use v4l2 (video capture)
--without-vulkan do not use Vulkan
--without-xattr do not use xattr (security attributes support)
--without-xcomposite do not use the Xcomposite extension
--without-xcursor do not use the Xcursor extension
--without-xfixes do not use Xfixes for clipboard change notifications
......@@ -3929,6 +3931,12 @@ if test "${with_vulkan+set}" = set; then :
fi
# Check whether --with-xattr was given.
if test "${with_xattr+set}" = set; then :
withval=$with_xattr;
fi
# Check whether --with-xcomposite was given.
if test "${with_xcomposite+set}" = set; then :
withval=$with_xcomposite; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi
......@@ -7569,6 +7577,35 @@ fi
done
if test "x$with_xattr" != "xno"
then
for ac_header in attr/xattr.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "attr/xattr.h" "ac_cv_header_attr_xattr_h" "$ac_includes_default"
if test "x$ac_cv_header_attr_xattr_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_ATTR_XATTR_H 1
_ACEOF
HAVE_XATTR=1
fi
done
fi
if test "x$with_xattr" = "xyes"
then
if test "x$HAVE_XATTR" = "x"; then :
case "x$with_xattr" in
xno) ;;
*) as_fn_error $? "xattr ${notice_platform}development files \
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.
Use the --without-xattr option if you really want this." "$LINENO" 5 ;;
esac
fi
fi
DLLFLAGS=""
......
......@@ -64,6 +64,7 @@ AC_ARG_WITH(unwind, AS_HELP_STRING([--without-unwind],[do not use the libunwi
AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb library]))
AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)]))
AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan]))
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]),
......@@ -635,6 +636,17 @@ AC_CHECK_HEADERS([libprocstat.h],,,
#include <sys/queue.h>
#endif])
if test "x$with_xattr" != "xno"
then
AC_CHECK_HEADERS(attr/xattr.h, [HAVE_XATTR=1])
fi
if test "x$with_xattr" = "xyes"
then
WINE_ERROR_WITH(xattr,[test "x$HAVE_XATTR" = "x"],[xattr ${notice_platform}development files \
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
dnl **** Check for working dll ****
AC_SUBST(DLLFLAGS,"")
......
......@@ -98,6 +98,9 @@
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
#endif
#include <time.h>
#include <unistd.h>
......@@ -355,6 +358,20 @@ NTSTATUS errno_to_status( int err )
}
}
#ifndef XATTR_USER_PREFIX
#define XATTR_USER_PREFIX "user."
#endif
static int xattr_get( const char *path, const char *name, void *value, size_t size )
{
#if defined(HAVE_ATTR_XATTR_H)
return getxattr( path, name, value, size );
#else
errno = ENOSYS;
return -1;
#endif
}
/* get space from the current directory data buffer, allocating a new one if necessary */
static void *get_dir_data_space( struct dir_data *data, unsigned int size )
{
......@@ -1436,6 +1453,22 @@ static BOOL append_entry( struct dir_data *data, const char *long_name,
}
/* Match the Samba conventions for storing DOS file attributes */
#define SAMBA_XATTR_DOS_ATTRIB XATTR_USER_PREFIX "DOSATTRIB"
/* We are only interested in some attributes, the others have corresponding Unix attributes */
#define XATTR_ATTRIBS_MASK (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)
/* decode the xattr-stored DOS attributes */
static inline int get_file_xattr( char *hexattr, int attrlen )
{
if (attrlen > 2 && hexattr[0] == '0' && hexattr[1] == 'x')
{
hexattr[attrlen] = 0;
return strtol( hexattr+2, NULL, 16 ) & XATTR_ATTRIBS_MASK;
}
return 0;
}
/* fetch the attributes of a file */
static inline ULONG get_file_attributes( const struct stat *st )
{
......@@ -1479,7 +1512,8 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
static int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
char *parent_path;
int ret;
char hexattr[11];
int len, ret;
*attr = 0;
ret = lstat( path, st );
......@@ -1505,6 +1539,9 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
free( parent_path );
}
*attr |= get_file_attributes( st );
len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 );
if (len == -1) return ret;
*attr |= get_file_xattr( hexattr, len );
return ret;
}
......
......@@ -25,6 +25,9 @@
/* Define to 1 if you have the <asm/user.h> header file. */
#undef HAVE_ASM_USER_H
/* Define to 1 if you have the <attr/xattr.h> header file. */
#undef HAVE_ATTR_XATTR_H
/* Define to 1 if you have the <capi20.h> header file. */
#undef HAVE_CAPI20_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment