1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

165 Commits

Author SHA1 Message Date
Volker Lendecke
30bbff383e vfs: Simplify streams_xattr_unlinkat()
It would be a logic error to call rmdir on a stream. This simplifies
the logic a bit.

Signed-off-by: Volker Lendecke <vl@samba.org>
2022-02-11 20:54:37 +00:00
Volker Lendecke
aacb3618c1 smbd: Use fsp_is_alternate_stream() where an fsp is available
Make it clear that being an alternate data stream handle is much more
a fsp property than a file name property.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-02-11 20:54:37 +00:00
Volker Lendecke
21b380ca13 smbd: Introduce fsp_is_alternate_stream()
To me this is more descriptive than "fsp->base_fsp != NULL". If this
turns out to be a performance problem, I would go and make this a
static inline in smbd/proto.h.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-02-11 20:54:37 +00:00
Volker Lendecke
621ceafe7f vfs: Modernize a DEBUG statement
Fix the function name printed

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-01-05 00:11:38 +00:00
Christof Schmitt
4209e42ab1 vfs_streams_xattr: Rename kernel_flock to filesystem_sharemode
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
c794e77381 VFS: Rename kernel_flock to filesystem_sharemode
With the removal of the call to flock LOCK_MAND, the only remaining use
of this VFS path is to register sharemodes with specific file systems.
Rename the VFS call to reflect that this is no longer related to flock.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Jeremy Allison
40cf129abb s3: VFS: streams_xattr: In streams_xattr_stat() use synthetic_pathref() with basename
Remove my poor imitation of synthetic_pathref(), just call the real thing.

We need to go through the full VFS stack here to get
the ino correct to get the fsp handle.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
c2fde31b1c s3: smbd: Cleanup - rename get_ea_names_from_file() -> get_ea_names_from_fsp().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Jun 25 16:37:59 UTC 2021 on sn-devel-184
2021-06-25 16:37:59 +00:00
Jeremy Allison
e30094e6c0 s3: smbd: Rename get_ea_value() -> get_ea_value_fsp().
Remove the connection struct and smb_filename parameters.

There are now no more callers of SMB_VFS_GETXATTR().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
a117624bb1 s3: VFS: streams_xattr: Rename get_xattr_size() -> get_xattr_size_fsp().
It now only needs 2 parameters, fsp and EA name.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
0c210a84db s3: VFS: streams_xattr: In streams_xattr_stat() - ~S_IFMT already removes S_IFDIR.
We don't need to do this separately.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
5f54eb555d s3: VFS: streams_xattr: Use openat_pathref_fsp() to create a smb_fname->fsp (and the smb_fname->fsp->base_fsp) if the incoming name doesn't have one.
Use new smb_fname->fsp->base_fsp parameter in get_xattr_size(), change name parameter to NULL.

If openat_pathref_fsp() fails, return the correct error code (thanks Ralph!).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
33521d2df3 s3: VFS: streams_xattr: In streams_xattr_stat(), make use of smb_fname->fsp->base_fsp if it has one.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
d1a0e9b81d s3: VFS: streams_xattr: Bring streams_xattr_stat_base() inline into streams_xattr_stat().
That was its only caller.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
d515c13ba7 s3: VFS: streams_xattr: Simplify streams_xattr_lstat().
There can never be EA's on a symlink. Windows will never
see a symlink, and in SMB_FILENAME_POSIX_PATH mode we don't
allow EA's on a symlink.

All of the previous code boiled down to errno = ENOENT, return -1
so make that explicit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
cacce8babf s3: VFS: streams_xattr: Use fsp->base_fsp for the fsp parameter to get_xattr_size() in streams_xattr_fstat().
We no longer need the 'struct smb_filename *smb_fname_base' here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
520a78d975 s3: VFS: streams_xattr: Add an fsp parameter to get_xattr_size().
Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
3c0594d42e s3: VFS: streams_xattr: In streams_xattr_openat() we can assume fsp->base_fsp != NULL.
It should have been opened/created by this point.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
82c95d1339 s3: VFS: streams_xattr: In walk_xattr_streams() use smb_fname->fsp for get_ea_value().
We know this is a valid fsp as we have already used it above inside
walk_xattr_streams() as an argument to get_ea_names_from_file().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
fa3609fb89 s3: VFS: streams_xattr: In streams_xattr_ftruncate() - remove smb_fname_base.
No longer used and we were leaking it onto the talloc_tos() anyway.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
caf61fc8c9 s3: VFS: streams_xattr: In streams_xattr_ftruncate() - use the fsp->base_fsp argument for get_ea_value().
We know it must be valid here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
5d12971c58 s3: VFS: streams_xattr: In streams_xattr_ftruncate() - remove conditional.
We know fsp->base_fsp must be valid here for SMB_VFS_FSETXATTR()

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
435c3f9ec1 s3: VFS: streams_xattr: In streams_xattr_pread() - remove smb_fname_base.
No longer used and we were leaking it onto the talloc_tos() anyway.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
fbfd4183d6 s3: VFS: streams_xattr: In streams_xattr_pread() - use the fsp->base_fsp argument for get_ea_value().
We know it must be valid here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
b8190ce3d8 s3: VFS: streams_xattr: In streams_xattr_pwrite() - remove smb_fname_base.
No longer used and we were leaking it onto the talloc_tos() anyway.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
2fdbac2c5f s3: VFS: streams_xattr: In streams_xattr_pwrite() - use the fsp->base_fsp argument for get_ea_value().
We know it must be valid here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
28f7846fdd s3: VFS: streams_xattr: In streams_xattr_pwrite() - remove conditional.
We know fsp->base_fsp must be valid here for SMB_VFS_FSETXATTR().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-25 15:53:31 +00:00
Jeremy Allison
ab01a36d4a s3: VFS: streams_xattr: Use real dirfsp for SMB_VFS_RENAMEAT()
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2021-06-22 13:44:34 +00:00
Noel Power
8df9d738f5 s3/modules: VFS: stream_xattr: Remove SMB_VFS_STREAMINFO
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-05-11 15:49:28 +00:00
Noel Power
a8eb80a578 s3: VFS: streams_xattr: Add impl for SMB_VFS_FSTREAMINFO
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-05-11 15:49:28 +00:00
Andrew Walker
21934c09bd s3:smbd - support streams larger than 64 KiB
Add support for streams that are larger than 64 KiB in size. Upper
and lower bound are controlled by the parameters smbd max_xattr_size.
Testing against ReFS on Windows (where ADS size is limited in size
shows the server responding with STATUS_FILESYSTEM_LIMITATION.
Do the same in samba for this case.

Currently, large xattrs are supported in FreeBSD.

Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon May 10 20:16:21 UTC 2021 on sn-devel-184
2021-05-10 20:16:21 +00:00
Jeremy Allison
9386e6ef5d s3: VFS: streams_xattr: Now we know we will never be doing ACL operations on streams, delete the now unneeded code.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Apr  9 20:48:17 UTC 2021 on sn-devel-184
2021-04-09 20:48:17 +00:00
Jeremy Allison
f6cd9a548f VFS: streams_xattr: In streams_xattr_renameat(), change SMB_VFS_REMOVEXATTR() -> SMB_VFS_FREMOVEXATTR().
Note that now we're doing this by handle
not by pathname we must do it on the base_fsp,
as we have to remove the actual xattr on the base file.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-04-07 16:26:28 +00:00
Noel Power
055e87233e s3/modules: streams_xattr_renameat SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-11 17:50:30 +00:00
Noel Power
86d645a71b s3/modules: streams_xattr: Fix fname passed to SETXATTR
we see to be overwritting the 'old' stream, this change fixes it

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-11 17:50:30 +00:00
Noel Power
ee4afd5955 s3/modules: streams_xattr_ftruncate SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-11 17:50:30 +00:00
Noel Power
c02cdcd5fb s3/modules: streams_xattr_pwrite SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-11 17:50:30 +00:00
Noel Power
147183e24a streams_xattr_openat SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-11 17:50:30 +00:00
Noel Power
1d1b80e5dc s3/smbd: Remove connection_struct from get_ea_names_from_file
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-02-26 21:28:33 +00:00
Noel Power
dfc80b4ce8 s3/smbd: modify get_ea_names_from_file signature fn to take fsp alone
Removes the smb_filename function parameter

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-02-26 21:28:33 +00:00
Ralph Boehme
274ed8c012 vfs_streams_xattr: use pathref in streams_xattr_unlink_internal()
All callers now pass an smb_fname that has a valid pathref fsp.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-28 08:11:49 +00:00
Stefan Metzmacher
40e70cbd3c vfs_streams_xattr: make use of vfs_fake_fd_close()
When we used vfs_fake_fd() we should use vfs_fake_fd_close()
in order to have things symetric.

That may allows us to change vfs_fake_fd() internally if required.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14596

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-08 20:31:33 +00:00
Ralph Boehme
8d0ea8bafa vfs: add acl type arg to SMB_VFS_SYS_ACL_SET_FD()
No change in behaviour, the new arg is not yet used in any module.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-17 18:56:28 +00:00
Ralph Boehme
985c1be5cc smbd: use vfs_stat() in more places
This replaces the code in a bunch of places where we choose between stat() and
lstat() based on req->posix_pathname. The new code inside vfs_stat() is based on
checking the smb_fname flag SMB_FILENAME_POSIX_PATH.

req->posix_pathname is inherited from the global POSIX pathnames state and the
smb_fname flags is also inherited from that indirectly via the UCF flags.

Tl;dr: no change in behaviour. :)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-16 09:08:31 +00:00
Ralph Boehme
bc908ea3f2 smbd: use fsp_get_pathref_fd() for *at related directory handles
Obviously correct to use fsp_get_pathref_fd() here.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-16 09:08:30 +00:00
Ralph Boehme
0208ca6946 smbd: use fsp_get_pathref_fd() when close()ing fds
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-16 09:08:30 +00:00
Ralph Boehme
50ce980902 smbd: use fsp_set_fd()
No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-16 09:08:30 +00:00
Ralph Boehme
ac45ce0227 vfs_streams_xattr: only assert AT_FDCWD for streams
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-10-23 07:56:32 +00:00
Ralph Boehme
089d8f4438 vfs: add and use vfs_fake_fd()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-10-02 19:39:43 +00:00
Ralph Boehme
32588c023e vfs: remove SMB_VFS_OPEN()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 20:38:34 +00:00