summaryrefslogtreecommitdiff
path: root/source3/modules
Commit message (Collapse)AuthorAgeFilesLines
* vfs_ceph: remove ceph_fallocate/ceph_ftruncate fallbackDavid Disseldorp2019-03-051-94/+8
| | | | | | | | | | | | | | | Both libcephfs functions are supported and capable of extending files, so fallback can be dropped. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13807 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> (cherry picked from commit 155f1289ba7a4802fbb99fbc9ea90d8bc6cff0c9) [ddiss@samba.org: rebase atop 48t without 532ff3a5b958] Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Tue Mar 5 13:01:15 UTC 2019 on sn-devel-144
* vfs_ceph: fix strict_allocate_ftruncate()David Disseldorp2019-03-051-2/+4
| | | | | | | | | | | The vfs_ceph "strict allocate = yes" ftruncate wrapper may attempt *local* filesystem ftruncate(). Fix this. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13807 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> (cherry picked from commit 70329c36ed91dd0e50ff66f9b0a85c62ac8a621e)
* vfs_ceph: add missing fallocate hookDavid Disseldorp2019-03-051-0/+17
| | | | | | | | | | | | SMB_VFS_FALLOCATE() calls atop a vfs_ceph share currently fall through to vfs_default, which results in a local filesystem I/O attempt using a libcephfs file-descriptor. Add the missing fallocate hook to vfs_ceph. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13807 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> (cherry picked from commit 5a7e7280813559fb70a9fc8e4238cb6015ee3b53)
* s3:vfs: Correctly check if OFD locks should be enabled or notAndreas Schneider2019-02-211-10/+4
| | | | | | | | | | | | | | | Also the smb.conf options should only be checked once and a reload of the config should not switch to a different locking mode. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13770 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Feb 9 03:43:50 CET 2019 on sn-devel-144 (cherry picked from commit 7ff94b18e2e39567ef7a208084cc5c914c39d3bd)
* s3:vfs: Initialize pid to 0 in test_netatalk_lock()Andreas Schneider2019-02-211-1/+1
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13770 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 2ff2594b2bd878928cec30bc72a95a6d38bee154)
* s3: VFS: vfs_fruit. Fix the NetAtalk deny mode compatibility code.Jeremy Allison2019-02-211-106/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This exhibited itself as a problem with OFD locks reported as: BUG: https://bugzilla.samba.org/show_bug.cgi?id=13770 However, due to underlying bugs in the vfs_fruit code the file locks were not being properly applied. There are two problems in fruit_check_access(). Problem #1: Inside fruit_check_access() we have: flags = fcntl(fsp->fh->fd, F_GETFL); .. if (flags & (O_RDONLY|O_RDWR)) { We shouldn't be calling fcntl(fsp->fh->fd, ..) directly. fsp->fh->fd may be a made up number from an underlying VFS module that has no meaning to a system call. Secondly, in all POSIX systems - O_RDONLY is defined as *zero*. O_RDWR = 2. Which means flags & (O_RDONLY|O_RDWR) becomes (flags & 2), not what we actually thought. Problem #2: deny_mode is *not* a bitmask, it's a set of discrete values. Inside fruit_check_access() we have: if (deny_mode & DENY_READ) and also (deny_mode & DENY_WRITE) However, deny modes are defined as: /* deny modes */ define DENY_DOS 0 define DENY_ALL 1 define DENY_WRITE 2 define DENY_READ 3 define DENY_NONE 4 define DENY_FCB 7 so if deny_mode = DENY_WRITE, or if deny_mode = DENY_READ then it's going to trigger both the if (deny_mode & DENY_READ) *and* the (deny_mode & DENY_WRITE) conditions. These problems allowed the original test test_netatalk_lock code to pass (which was added for BUG: https://bugzilla.samba.org/show_bug.cgi?id=13584 to demonstrate the lock order violation). This patch refactors the fruit_check_access() code to be much simpler (IMHO) to understand. Firstly, pass in the SMB1/2 share mode, not old DOS deny modes. Secondly, read all the possible NetAtalk locks into local variables: netatalk_already_open_for_reading netatalk_already_open_with_deny_read netatalk_already_open_for_writing netatalk_already_open_with_deny_write Then do the share mode/access mode checks with the requested values against any stored netatalk modes/access modes. Finally add in NetATalk compatible locks that represent our share modes/access modes into the file, with an early return if we don't have FILE_READ_DATA (in which case we can't write locks anyway). The patch is easier to understand by looking at the completed patched fruit_check_access() function, rather than trying to look at the diff. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org> (cherry picked from commit 3204dc66f6801a7c8c87c48f601e0ebdee9e3d40)
* s3-vfs: Use ENOATTR in errno comparison for getxattrAnoop C S2019-02-053-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | * ENODATA is not defined in FreeBSD * ENOATTR is defined to be a synonym for ENODATA in Linux * In its absence Samba already defines ENOATTR to either ENODATA or ENOENT Thus it is safe and correct to compare with ENOATTR rather than ENODATA. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13774 Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Jan 23 21:59:10 CET 2019 on sn-devel-144 (cherry picked from commit c99402724a65f4e1f8ed4dcd236a43e0603bef0a) Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Tue Feb 5 20:31:37 CET 2019 on sn-devel-144
* s3-vfs: add glusterfs_fuse vfs module.Günther Deschner2019-02-052-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | This module only implements the get_real_filename function by accessing a distinct extended attribute that is available over a glusterfs fuse mount. By implementing this vfs function users of a glusterfs fuse mount achieve a much better performance in create based workloads where samba then can avoid trying multiple case folding options to detect the real filename. Patch is based on an initial patch provided by Poornima G <pgurusid@redhat.com> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13774 Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Tue Jan 22 18:37:56 CET 2019 on sn-devel-144 (cherry picked from commit adffe0dcf002aa4721dc7897261895e3486d5271)
* vfs_glusterfs: Adapt to changes in libgfapi signaturesAnoop C S2019-02-051-0/+19
| | | | | | | | | | | | | | | | | VFS module for GlusterFS fails to compile due to recent changes done to some API signatures. Therefore adding missing arguments to those APIs adapting to new signatures. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13330 Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sun Feb 3 17:00:33 CET 2019 on sn-devel-144 (cherry picked from commit 0e3eda5bab5ae9316a42725aea048fb350020ec7)
* vfs_fileid: fix fsname_norootdir algorithmRalph Wuerthner2019-02-051-1/+2
| | | | | | | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13744 Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Jan 17 01:36:54 CET 2019 on sn-devel-144 (cherry picked from commit 2723d900ef35f4797058675f298f4a4364b29cd3)
* vfs_fileid: fix get_connectpath_inoRalph Wuerthner2019-02-011-1/+3
| | | | | | | | | | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13741 Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue Jan 15 04:13:15 CET 2019 on sn-devel-144 (cherry picked from commit 12398a2d1ddcd326e02e5d8b0749e0e796145165) Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Fri Feb 1 17:06:06 CET 2019 on sn-devel-144
* s3-vfs-fruit: add close callGünther Deschner2019-01-141-0/+82
| | | | | | | | | | | | | | | | | | | | | https://bugzilla.samba.org/show_bug.cgi?id=13725 We cannot always rely on vfs_default to close the fake fds. This mostly is relevant when used with another non-local VFS filesystem module such as gluster. Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Dec 21 07:20:49 CET 2018 on sn-devel-144 (cherry picked from commit ba016939aa91e0806f509c8b8ce9506bebceb7e5) Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Mon Jan 14 14:50:09 CET 2019 on sn-devel-144
* s3-vfs-streams_xattr: add close callGünther Deschner2019-01-141-0/+26
| | | | | | | | | | | | | | | | | | https://bugzilla.samba.org/show_bug.cgi?id=13725 We cannot always rely on vfs_default to close the fake fds. This mostly is relevant when used with another non-local VFS filesystem module such as gluster. Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Dec 20 07:18:20 CET 2018 on sn-devel-144 (cherry picked from commit 1b263ed631c86bf4117c9388fce3fa1f24cea4c9)
* vfs_shadow_copy2: in fstat also convert fsp->fsp_name and ↵Ralph Boehme2018-12-131-8/+50
| | | | | | | | | | | | | | | | fsp->base_fsp->fsp_name Stacked VFS modules might use the file name, not the file handle. Looking at you, vfs_fruit... Bug: https://bugzilla.samba.org/show_bug.cgi?id=13455 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit aa1fac696956f96e89e54ddd4535a6e2844161b0) Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Thu Dec 13 18:20:47 CET 2018 on sn-devel-144
* s3-vfs: Prevent NULL pointer dereference in vfs_glusterfs.Günther Deschner2018-12-131-32/+168
| | | | | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13708 Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Tue Dec 11 17:26:31 CET 2018 on sn-devel-144 (cherry picked from commit 75d15484f3b71b1a2684c4a73e53aaa467f9932b)
* vfs_shadow_copy2: nicely deal with attempts to open previous version for writingRalph Boehme2018-12-131-2/+122
| | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit cf95756235f718478e556ce1fbf7c032f9c9acfb)
* vfs_shadow_copy2: add shadow_copy2_strip_snapshot_convertedRalph Boehme2018-12-131-0/+16
| | | | | | | | | | | Can be used by callers to determine if a path is in fact pointing at a file in a snapshot. Will be used in the next commit. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 14d6488d355e960ab02e72c414cbbc316f1db718)
* vfs_shadow_copy2: add _already_converted arg to ↵Ralph Boehme2018-12-131-8/+24
| | | | | | | | | | | | shadow_copy2_strip_snapshot_internal() Not used for now, all existing callers pass NULL. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 87bf06ed790dad8a4f650c0cd1b6781864666cbf)
* vfs_error_inject: add EBADF errorRalph Boehme2018-12-131-0/+1
| | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 523a9b312c9f09178a5afefb48343e684e41d817)
* vfs_error_inject: add pwriteRalph Boehme2018-12-131-0/+18
| | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 55a82f907f6410ff478e82b0cf7f1caeacaf5ddd)
* vfs_zfsacl: return synthesized ACL when ZFS return ENOTSUPRalph Boehme2018-11-281-2/+34
| | | | | | | | | | | | | | | | | | This allows accessing the ZFS .snapshots directory where ZFS returns ENOTSUP when calling acl(".snapshots"). Bug: https://bugzilla.samba.org/show_bug.cgi?id=13175 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri May 18 22:03:21 CEST 2018 on sn-devel-144 (cherry picked from commit f93cc232377d4c686ac35ee5e14e798974bc0700) Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Wed Nov 28 13:20:55 CET 2018 on sn-devel-144
* vfs_fruit: validation of writes on AFP_AfpInfo streamRalph Boehme2018-11-141-8/+55
| | | | | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13677 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (backported from commit a7c877847f855be5ee6673e541a181b818013abf) Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Wed Nov 14 17:12:08 CET 2018 on sn-devel-144
* vfs_fruit: move a comment to the right placeRalph Boehme2018-11-141-7/+12
| | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13677 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 4901d71c3de754a106662d01481b960ed7c2c4dd)
* vfs_fruit: let fruit_open_meta() with O_CREAT return a fake-fdRalph Boehme2018-11-061-93/+72
| | | | | | | | | | | | | | | | | This is the final step in implementing the needed macOS semantics on the FinderInfo stream: as long as the client hasn't written a non-zero FinderInfo blob to the stream, there mustn't be a visible filesystem entry for other openers. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Nov 1 01:14:23 CET 2018 on sn-devel-144 (cherry picked from commit 1b2de44ea8114cf2025e8b8c843131e2f2dbed27)
* vfs_fruit: don't check for delete-on-close on the FinderInfo streamRalph Boehme2018-11-061-72/+1
| | | | | | | | | | | macOS SMB server doesn't filter out the FinderInfo stream if it has delete-on-close set. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit d8c1bb52018289878b9397d513ebbae63933a05f)
* vfs_fruit: let fruit_pwrite_meta_stream also ftruncate empty FinderInfoRalph Boehme2018-11-061-12/+18
| | | | | | | | | | | | | | | | | | | | | fruit_streaminfo currently filters out the FinderInfo stream is delete-on-close is set. We set it here internally, but the client may also set it over SMB. Turns out that the macOS SMB server does NOT filter out FinderInfo stream with delete-on-close set, so we must change the way filtering is done in fruit_streaminfo. Filtering is now done based on the FinderInfo stream being 0-bytes large which is why I'm adding the ftruncate here. No idea why the tests that check the filtering passed the commits leading up to this one, but if you revert this commit after applying the whole patchset, the "delete AFP_AfpInfo by writing all 0" test will fail. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 480695cd723cc4949e0b39ddb83560efac393412)
* vfs_fruit: pass stream size to delete_invalid_meta_stream()Ralph Boehme2018-11-061-3/+12
| | | | | | | | | | | | | delete_invalid_meta_stream() is meant to guard against random data being present in the FinderInfo stream. If the stream size is 0, it's likely a freshly created stream where no data has been written to yet, so don't delete it. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 6e13dbddaec9f8118e11309297f85c3cdfd22e43)
* vfs_fruit: let fruit handle all aio on the FinderInfo metadata streamRalph Boehme2018-11-061-3/+1
| | | | | | | | | | | This will be required to support using fake fds for the FinderInfo metadata stream. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 6fd256afcd5fedc894036efbfba1fc6d2264fba9)
* vfs_fruit: do ino calculationRalph Boehme2018-11-061-2/+48
| | | | | | | | | | | | As we'll start returning fake fds in open shortly, we can't rely on the next module to calculat correct inode numbers for streams and must take over that responsibility. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 80afafe398566fd622f431966808d08ba9ec6473)
* vfs_fruit: prepare fruit_pread_meta() for reading on fake-fdRalph Boehme2018-11-061-2/+20
| | | | | | | | | | | | | If the read on the stream fails we may have hit a handle on a just created stream (fio->created=true) with no data written yet. If that's the case return an empty initialized FinderInfo blob. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit d7d92710711f6e555ed45c1dda528cd6a83e1bf5)
* vfs_fruit: prepare fruit_pwrite_meta() for on-demand opening and writingRalph Boehme2018-11-061-0/+34
| | | | | | | | | | | | | | | | | | This avoid creating files or blobs in our streams backend when a client creates a stream but hasn't written anything yet. This is the only sane way to implement the following semantics: * client 1: create stream "file:foo" * client 2: open stream "file:foo" The second operation of client 2 must fail with NT_STATUS_NOT_FOUND. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 4a5c9a9e73230f640eb045a3c47af75b5be9f1d6)
* vfs_fruit: prepare struct fio for fake-fd and on-demand openingRalph Boehme2018-11-061-0/+11
| | | | | | | | | | Not used for now, that comes in the subsequent commits. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 96320eccc9a63b793ff8d05842bce54f120286f9)
* vfs_fruit: add fio->createdRalph Boehme2018-11-061-0/+9
| | | | | | | | | | fio->created tracks whether a create created a stream. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 1e055a79541eb69eb2deeae897dde3665c5ffee2)
* vfs_fruit: remove resource fork special casingRalph Boehme2018-11-061-8/+0
| | | | | | | | | | Directly unlinking a file with open handles is not good, don't do it. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit a26032c3f68028b01fb6a7d38851409db1858161)
* vfs_fruit: add some debugging of dev/inoRalph Boehme2018-11-061-2/+11
| | | | | | | | | | Aids in debugging dev/ino mismatch failures in open_file_ntcreate. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 993c7c4e711612225bd07b8fa5544c4bfef88a9e)
* vfs_fruit: filter empty streamsRalph Boehme2018-11-061-6/+38
| | | | | | | | | | | | | | | | | | | | | | | First step in achieving macOS compliant behaviour wrt to empty streams: - hide empty streams in streaminfo - prevent opens of empty streams This means that we may carry 0-byte sized streams in our streams backend, but this shouldn't really hurt. The previous attempt of deleting the streams when an SMB setinfo eof to 0 request came in, turned out be a road into desaster. We could set delete-on-close on the stream, but that means we'd have to check for it for every write on a stream and checking the delete-on-close bits requires fetching the locking.tdb record, so this is expensive and I'd like to avoid that overhead. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit ebfcf75e993b1a792db76b94aa898532e1c81eeb)
* vfs_fruit: use check on global_fruit_config.nego_aapl for macOS specific ↵Ralph Boehme2018-11-061-1/+2
| | | | | | | | | | | | | | | | behaviour Ensure any non MS compliant protocol behaviour targetted at supporting macOS clients are only effective if the client negotiated AAPL. Currently this only guards the resource fork which only macOS client are going to use, but subsequent commits add more this at this place. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 046456fca60b9fef38a0cdf5a116883fb1c7dffe)
* vfs_fruit: don't unlink 0-byte size truncated streamsRalph Boehme2018-11-061-7/+0
| | | | | | | | | | | | This caused all sort of havoc with subsequent SMB request that acted on the handle of the then deleted backend storage (file or blob, depending on the used streams module). Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 287082d739362ad068df37076712927ccd7ca90c)
* vfs_fruit: update handling of read-only creation of resource forkRalph Boehme2018-11-061-20/+3
| | | | | | | | | | | macOS SMB server versions supports this since 10.12, so we adapt our behaviour. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 055ca448f1a2bd995291af1810c9ec94f90f32dd)
* vfs_streams_xattr: fix open implementationRalph Boehme2018-11-061-26/+38
| | | | | | | | | | | | | | | | | | Since a long time the modules's open function happily returned success when opening a non existent stream without O_CREAT. This change fixes it to return -1 and errno=ENOATTR if o get_ea_value() returns NT_STATUS_NOT_FOUND (eg mapped from getxattr() = -1, errno=ENOATTR) and o flags doesn't contain O_CREAT Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 9f58997d7a1ab0358963a45cb8bf291e7afa8068)
* vfs_delay_inject: implement pread_send and pwrite_sendRalph Boehme2018-11-061-0/+262
| | | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 35f9bc06722fb07143c832442d784beb204bd367)
* vfs_fruit: optionally delete AppleDouble files without Resourcefork dataRalph Boehme2018-11-021-0/+42
| | | | | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13642 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 3649f1a41a299b14609318ef52b44e2d53cba4b5) Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Fri Nov 2 15:02:42 CET 2018 on sn-devel-144
* vfs_fruit: add option "delete_empty_adfiles"Ralph Boehme2018-11-021-0/+5
| | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13642 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit e00e61345ccd88022cd24e62ac29e2c56a8f6117)
* vfs_fruit: detect empty resource forks in ad_convert()Ralph Boehme2018-11-021-1/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some reason the macOS client often writes AppleDouble files with a non-zero sized resource fork, but the resource fork data is just boilerplate data with the following string close to the start This resource fork intentionally left blank A dump with apple_dump looks like this: Entry ID : 00000002 : Resource Fork Offset : 00000052 : 82 Length : 0000011E : 286 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII) 00000000 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................ 00000010 : 54 68 69 73 20 72 65 73 6F 75 72 63 65 20 66 6F : This resource fo 00000020 : 72 6B 20 69 6E 74 65 6E 74 69 6F 6E 61 6C 6C 79 : rk intentionally 00000030 : 20 6C 65 66 74 20 62 6C 61 6E 6B 20 20 20 00 00 : left blank .. 00000040 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 00000050 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 00000060 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 00000070 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 00000080 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 00000090 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 000000A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 000000B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 000000C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 000000D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 000000E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 000000F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................ 00000100 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................ 00000110 : 00 00 00 00 00 00 00 00 00 1C 00 1E FF FF : .............. We can safely discard this Resource Fork data. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13642 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 7be979f958295474f0c0df6a4db0b5bca9a6676d)
* vfs_fruit: add option "wipe_intentionally_left_blank_rfork"Ralph Boehme2018-11-021-0/+5
| | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13642 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 2dbb2d287399e9c829a4fd4908a6dfba9fdfd7e8)
* vfs_fruit: remove check for number of xattrs from ad_convert_xattrRalph Boehme2018-11-011-4/+0
| | | | | | | | | | | | | | | | | | Turns out that there exist AppleDouble files with an extended FinderInfo entry that includes the xattr marshall buffer, but the count of xattrs in the buffer is just zero. We do want to discard this extended FinderInfo entry and convert it to a simple fixed size FinderInfo entry, so remove the check. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13649 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 5d565f636fcf49fc1bbbfbc24ef730d2f7cc2cf0) Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Thu Nov 1 18:58:13 CET 2018 on sn-devel-144
* vfs_fruit: move check in ad_convert() to ad_convert_*() subfunctionsRalph Boehme2018-10-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently the whole conversion is skipped if the FinderInfo entry in the AppleDouble file is of the default size (ie not containing xattrs). That also means we never converted FinderInfo from the AppleDouble file to stream format. This change finally fixes this. Note that this keeps failing with streams_depot, much like the existing known-fail of "samba3.vfs.fruit streams_depot.OS X AppleDouble file conversion". Fixing the conversion to work with vfs_streams_depot is a task for another day. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13649 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Thu Oct 11 01:30:13 CEST 2018 on sn-devel-144 (cherry picked from commit 31daab88e6a415e72ead69844e3eccf5dc02e53c) Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-8-test): Thu Oct 18 17:37:52 CEST 2018 on sn-devel-144
* vfs_fruit: make call to ad_convert_truncate() optionalRalph Boehme2018-10-181-3/+5
| | | | | | | | | | | | | | Call ad_convert_truncate() based on whether the previous call ad_convert_xattr() returned converted_xattr=true. Upcoming fixes for a different Samba bug (#13642) will hook into calling ad_convert_truncate() in other cases, this also prepares for that. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13649 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 9cf087a474bb2d7d29ca0daeaef412f6b545d0e0)
* vfs_fruit: add out arg "converted_xattr" to ad_convert_xattrRalph Boehme2018-10-181-2/+7
| | | | | | | | | | | Used to let the caller know if a conversion has been done. Currently not used in the caller, that comes next. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13649 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit acb72c1ea7fecc9a7e8eb0219096b1bbdfd8850e)
* vfs_fruit: add check for OS X filler in FinderInfo conversionRalph Boehme2018-10-181-0/+6
| | | | | | | | | | | | This ensures that the function only acts on AppleDouble files created by macOS and not AppleDouble files created by us that are already in the correct format (only using the Resource Fork). Bug: https://bugzilla.samba.org/show_bug.cgi?id=13649 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 5598e6bc3583a88f474afa2996d1f9362d1bd9fb)