From b7b1c2d787cc76c6db285e18aea4c4f07a21059d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 31 Mar 2006 20:07:13 +0000 Subject: [PATCH] * fhandler_disk_file.cc (FS_IS_SAMBA_WITH_QUOTA): New define. (path_conv::hasgood_inode): Recognize Samba with quota support compiled in. (path_conv::is_samba): Ditto. Fix comment to include Samba version numbers for later reference. --- winsup/cygwin/ChangeLog | 8 ++++++++ winsup/cygwin/fhandler_disk_file.cc | 20 +++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index f307547f4..0730fd688 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2006-03-31 Corinna Vinschen + + * fhandler_disk_file.cc (FS_IS_SAMBA_WITH_QUOTA): New define. + (path_conv::hasgood_inode): Recognize Samba with quota support + compiled in. + (path_conv::is_samba): Ditto. Fix comment to include Samba version + numbers for later reference. + 2006-03-30 Corinna Vinschen * security.h (sec_user_nih): Make sid1 argument mandatory. diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 0c1ed37ab..5fc20d37c 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -200,6 +200,12 @@ path_conv::ndisk_links (DWORD nNumberOfLinks) | FILE_CASE_PRESERVED_NAMES \ | FILE_PERSISTENT_ACLS) +#define FS_IS_SAMBA_WITH_QUOTA \ + (FILE_CASE_SENSITIVE_SEARCH \ + | FILE_CASE_PRESERVED_NAMES \ + | FILE_PERSISTENT_ACLS \ + | FILE_VOLUME_QUOTAS) + bool path_conv::hasgood_inode () { @@ -223,7 +229,8 @@ path_conv::hasgood_inode () testing for the flag values returned by a 3.x Samba explicitely for now. But note the comment in the below "is_samba" function. */ if (!(fs_flags () & FILE_SUPPORTS_OBJECT_IDS) - && fs_flags () != FS_IS_SAMBA) + && fs_flags () != FS_IS_SAMBA + && fs_flags () != FS_IS_SAMBA_WITH_QUOTA) return false; } return true; @@ -232,9 +239,10 @@ path_conv::hasgood_inode () bool path_conv::is_samba () { - /* Something weird happens on Samba. FileIdBothDirectoryInformation - seems to work nicely, but only up to the 128th entry in the - directory. After reaching this entry, the next call to + /* Something weird happens on Samba up to version 3.0.21c, which is + fixed in 3.0.22. FileIdBothDirectoryInformation seems to work + nicely, but only up to the 128th entry in the directory. After + reaching this entry, the next call to NtQueryDirectoryFile(FileIdBothDirectoryInformation) returns STATUS_INVAILD_LEVEL. Why should we care, we can just switch to FileBothDirectoryInformation, isn't it? Nope! The next call to @@ -245,7 +253,9 @@ path_conv::is_samba () can read the whole directory unmolested. So we have to excempt Samba from the usage of FileIdBothDirectoryInformation entirely, even though Samba returns valid File IDs. */ - return drive_type () == DRIVE_REMOTE && fs_flags () == FS_IS_SAMBA; + return drive_type () == DRIVE_REMOTE + && (fs_flags () == FS_IS_SAMBA + || fs_flags () == FS_IS_SAMBA_WITH_QUOTA); } int __stdcall