From 4c11d0c8126906d910ba9a7b9488d56dba77e6cf Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Thu, 14 Jan 2016 23:11:35 +0100 Subject: [PATCH] ntdll-DOS_Attributes: Always store SAMBA_XATTR_DOS_ATTRIB when path could be interpreted as hidden. (cherry picked from commit a560ca2cee4a4b5cadad73e1883bd438e70328ad) --- ...re-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch | 46 +++++++++++++++++++ patches/patchinstall.sh | 2 + 2 files changed, 48 insertions(+) create mode 100644 patches/ntdll-DOS_Attributes/0008-ntdll-Always-store-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch diff --git a/patches/ntdll-DOS_Attributes/0008-ntdll-Always-store-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch b/patches/ntdll-DOS_Attributes/0008-ntdll-Always-store-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch new file mode 100644 index 00000000..c7caa861 --- /dev/null +++ b/patches/ntdll-DOS_Attributes/0008-ntdll-Always-store-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch @@ -0,0 +1,46 @@ +From 5a419298c1871c0d71a2892d6ac4b517288b3563 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Thu, 14 Jan 2016 23:09:19 +0100 +Subject: ntdll: Always store SAMBA_XATTR_DOS_ATTRIB when path could be + interpreted as hidden. + +--- + dlls/ntdll/file.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c +index 50b0042..b38698f 100644 +--- a/dlls/ntdll/file.c ++++ b/dlls/ntdll/file.c +@@ -213,12 +213,15 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) + if (S_ISDIR( st->st_mode )) *attr |= FILE_ATTRIBUTE_REPARSE_POINT; + } + *attr |= get_file_attributes( st ); +- /* convert Unix-style hidden files to a DOS hidden file attribute */ +- if (DIR_is_hidden_file( path )) +- *attr |= FILE_ATTRIBUTE_HIDDEN; + /* retrieve any stored DOS attributes */ + len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 ); +- if (len == -1) return ret; ++ if (len == -1) ++ { ++ /* convert Unix-style hidden files to a DOS hidden file attribute */ ++ if (DIR_is_hidden_file( path )) ++ *attr |= FILE_ATTRIBUTE_HIDDEN; ++ return ret; ++ } + *attr |= get_file_xattr( hexattr, len ); + return ret; + } +@@ -231,7 +234,7 @@ NTSTATUS set_file_info( const char *path, ULONG attr ) + /* Note: unix mode already set when called this way */ + attr &= ~FILE_ATTRIBUTE_NORMAL; /* do not store everything, but keep everything Samba can use */ + len = sprintf( hexattr, "0x%x", attr ); +- if (attr != 0) ++ if (attr != 0 || DIR_is_hidden_file( path )) + xattr_set( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, len ); + else + xattr_remove( path, SAMBA_XATTR_DOS_ATTRIB ); +-- +2.6.4 + diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 7406bfad..293d4088 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -4048,6 +4048,7 @@ if test "$enable_ntdll_DOS_Attributes" -eq 1; then patch_apply ntdll-DOS_Attributes/0005-libport-Add-support-for-Mac-OS-X-style-extended-attr.patch patch_apply ntdll-DOS_Attributes/0006-libport-Add-support-for-FreeBSD-style-extended-attri.patch patch_apply ntdll-DOS_Attributes/0007-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch + patch_apply ntdll-DOS_Attributes/0008-ntdll-Always-store-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch ( echo '+ { "Erich E. Hoover", "ntdll: Implement retrieving DOS attributes in NtQueryInformationFile.", 1 },'; echo '+ { "Erich E. Hoover", "ntdll: Implement retrieving DOS attributes in NtQuery[Full]AttributesFile and NtQueryDirectoryFile.", 1 },'; @@ -4056,6 +4057,7 @@ if test "$enable_ntdll_DOS_Attributes" -eq 1; then echo '+ { "Erich E. Hoover", "libport: Add support for Mac OS X style extended attributes.", 1 },'; echo '+ { "Erich E. Hoover", "libport: Add support for FreeBSD style extended attributes.", 1 },'; echo '+ { "Erich E. Hoover", "ntdll: Perform the Unix-style hidden file check within the unified file info grabbing routine.", 1 },'; + echo '+ { "Sebastian Lackner", "ntdll: Always store SAMBA_XATTR_DOS_ATTRIB when path could be interpreted as hidden.", 1 },'; ) >> "$patchlist" fi