The branch, master has been updated via c2fde31b1c2 s3: smbd: Cleanup - rename get_ea_names_from_file() -> get_ea_names_from_fsp(). via e30094e6c03 s3: smbd: Rename get_ea_value() -> get_ea_value_fsp(). via a117624bb19 s3: VFS: streams_xattr: Rename get_xattr_size() -> get_xattr_size_fsp(). via 0c210a84dbf s3: VFS: streams_xattr: In streams_xattr_stat() - ~S_IFMT already removes S_IFDIR. via 5f54eb555d0 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. via 33521d2df33 s3: VFS: streams_xattr: In streams_xattr_stat(), make use of smb_fname->fsp->base_fsp if it has one. via d1a0e9b81da s3: VFS: streams_xattr: Bring streams_xattr_stat_base() inline into streams_xattr_stat(). via d515c13ba75 s3: VFS: streams_xattr: Simplify streams_xattr_lstat(). via cacce8babf9 s3: VFS: streams_xattr: Use fsp->base_fsp for the fsp parameter to get_xattr_size() in streams_xattr_fstat(). via 520a78d9752 s3: VFS: streams_xattr: Add an fsp parameter to get_xattr_size(). via 3c0594d42eb s3: VFS: streams_xattr: In streams_xattr_openat() we can assume fsp->base_fsp != NULL. via 82c95d13390 s3: VFS: streams_xattr: In walk_xattr_streams() use smb_fname->fsp for get_ea_value(). via fa3609fb89f s3: VFS: streams_xattr: In streams_xattr_ftruncate() - remove smb_fname_base. via caf61fc8c9a s3: VFS: streams_xattr: In streams_xattr_ftruncate() - use the fsp->base_fsp argument for get_ea_value(). via 5d12971c58b s3: VFS: streams_xattr: In streams_xattr_ftruncate() - remove conditional. via 435c3f9ec1a s3: VFS: streams_xattr: In streams_xattr_pread() - remove smb_fname_base. via fbfd4183d64 s3: VFS: streams_xattr: In streams_xattr_pread() - use the fsp->base_fsp argument for get_ea_value(). via b8190ce3d87 s3: VFS: streams_xattr: In streams_xattr_pwrite() - remove smb_fname_base. via 2fdbac2c5fe s3: VFS: streams_xattr: In streams_xattr_pwrite() - use the fsp->base_fsp argument for get_ea_value(). via 28f7846fdd5 s3: VFS: streams_xattr: In streams_xattr_pwrite() - remove conditional. via 0f04e1a47df s3: VFS: ceph_snapshots: Remove ceph_snap_get_btime(). via 2298974b3fa s3: VFS: ceph_snapshots: In ceph_snap_gmt_convert_dir() - change to use ceph_snap_get_btime_fsp(). via 8fc84ac100d s3: VFS: ceph_snapshots: In ceph_snap_fill_label(), use ceph_snap_get_btime_fsp() instead of ceph_snap_get_btime(). via abe3a396e0e s3: VFS: ceph_snapshots: In ceph_snap_fill_label() - pass in dirfsp instead of the raw path. via fe9575c88f0 s3: VFS: ceph_snapshots: Add ceph_snap_get_btime_fsp(). via da18c67732f s3: VFS: fake_acls: Remove unused fake_acls_uid()/fake_acls_gid(). via 2e518078388 s3: VFS: fake_acls: In fake_acls_stat() - Now we always have a valid fsp, remove the calls to the path-based functions. via 243bce41583 s3: VFS: fake_acls: In fake_acls_stat() - use openat_pathref_fsp() to always get a pathref fsp. via d2b78728514 s3: VFS: fake_acls: In fake_acls_stat() - if we have a pathref fsp, use it. via 6e6f532c5fc s3: VFS: fake_acls: In fake_acls_stat() - remove call to get_full_smb_filename(). via cf51681aac9 s3: VFS: fake_acls: In fake_acls_lstat() - get a pathref on whatever the link points to and use the handle-based functions. via 13778b4c731 s3: VFS: fake_acls: In fake_acls_lstat() - remove call to get_full_smb_filename(). via c308ffa41c2 s3: VFS: streams_depot: file_is_valid(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR(). via 981f714369b s3: lib: adouble: Remove ad_set() - Dead code. Not used anywhere. via 303d15e14fc s3: lib: adouble: Protect ad_read_meta() from accidently using a NULL fsp. via ff09fc77a21 s3: torture: In cmd_getxattr(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR(). via 198413da763 s3: smbd: get_ea_list_from_fsp(). Make it clear we're using only the fsp by replacing the fsp->fsp_name with NULL. via 757b7d5c6ae s3: smbd: fload_inherited_info(). Always use SMB_VFS_FGETXATTR(). via f694b36335e s3: modules: acl_xattr: getxattr_do(). Remove the smb_fname parameter. via 4670cf1da6f s3: smbd: Temporarily add protection to get_ea_value() for fsp==NULL and smb_fname==NULL. via 2dd7ac6a6eb s3: smbd: get_ea_value(). If we have an fsp, *always* use it for SMB_VFS_FGETXATTR(). via b63ac2ed97f s3: smbd: Move the call to fsp_set_fd(conn->cwd_fsp, AT_FDCWD) to just after SMB_VFS_CHDIR(). via bd0bad6f58a s3: smbd: On startup file_name_hash() can be called with an absolute pathname. via a6df051dd5e s3: smbd: In openat_pathref_fsp(), just check we're opening the same file type, not dev and inode. via 0d78398beea s4: torture: Improve error messages in check_stream() and read_stream() to include the filename and NTSTATUS. from 466aa8b6f5a ctdb-scripts: Ignore ShellCheck SC3013 for test -nt
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit c2fde31b1c2ec7482f7424f7b7cb443aae582c2e Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 12:12:30 2021 -0700 s3: smbd: Cleanup - rename get_ea_names_from_file() -> get_ea_names_from_fsp(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> Autobuild-User(master): Ralph Böhme <s...@samba.org> Autobuild-Date(master): Fri Jun 25 16:37:59 UTC 2021 on sn-devel-184 commit e30094e6c039c17bdea8b27df9a8a1ead7cc21e4 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:53:29 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit a117624bb193e32222ba7ed5eb5bafc8b1e0d876 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:03:20 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 0c210a84dbfdf81e31dd1e79736c1d9e695d3fc7 Author: Jeremy Allison <j...@samba.org> Date: Thu Jun 24 21:42:16 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 5f54eb555d0ef5ff332ed635ce2c52625ce74952 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 16:49:11 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 33521d2df33a4759f61ab0bfc16d9b583c161375 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 14:24:15 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit d1a0e9b81da07ff7566227eb8a14f88914d01c3d Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 14:19:13 2021 -0700 s3: VFS: streams_xattr: Bring streams_xattr_stat_base() inline into streams_xattr_stat(). That was its only caller. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit d515c13ba754986e086eb4bc490e634d220e562c Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 14:16:04 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit cacce8babf989b51eebb9194f5b57bef3634de67 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 13:47:46 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 520a78d97527b313bae0f7596d713e6e8ab00360 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 13:46:01 2021 -0700 s3: VFS: streams_xattr: Add an fsp parameter to get_xattr_size(). Not yet used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 3c0594d42ebaa90b4322b9e672987bcd6315805d Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:23:32 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 82c95d13390904ae6957280dac137e54e9a988bb Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 12:17:37 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit fa3609fb89fe7a9ee79c1496014b81fc2dcba795 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:38:46 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit caf61fc8c9a9bd507032ebfd7ab94b80008ccb81 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:37:51 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 5d12971c58beaddb8400bba9e134eb5e4439894b Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:36:28 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 435c3f9ec1ad01a70adc0b9e0a44721ac2e8ae19 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:20:08 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit fbfd4183d64e0173550963269a83732c4c3cfd74 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:19:08 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit b8190ce3d87be016709f3ddcd8bc763d3418ead9 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:16:09 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 2fdbac2c5fe368204267bb3d07bcbee4b6b92ca7 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:14:52 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 28f7846fdd507a6befea76518f8cd45855e51fc7 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:10:50 2021 -0700 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 <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 0f04e1a47dfeb9848b995329bf82744df0bbae3d Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 11:45:25 2021 -0700 s3: VFS: ceph_snapshots: Remove ceph_snap_get_btime(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 2298974b3fafbcb352279067aa004e66263fe31c Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 11:44:23 2021 -0700 s3: VFS: ceph_snapshots: In ceph_snap_gmt_convert_dir() - change to use ceph_snap_get_btime_fsp(). Comment out ceph_snap_get_btime() as it has no more callers. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 8fc84ac100d80aced6f1d852ae17bebd4e855b16 Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 11:29:18 2021 -0700 s3: VFS: ceph_snapshots: In ceph_snap_fill_label(), use ceph_snap_get_btime_fsp() instead of ceph_snap_get_btime(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit abe3a396e0e32f72a4fc0f9b2b10a968c8542fea Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 11:14:52 2021 -0700 s3: VFS: ceph_snapshots: In ceph_snap_fill_label() - pass in dirfsp instead of the raw path. We will use this for openat_pathref_fsp() later. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit fe9575c88f048ac760a33fd5f65c18e8f2714e70 Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 10:58:40 2021 -0700 s3: VFS: ceph_snapshots: Add ceph_snap_get_btime_fsp(). Handle-based copy of ceph_snap_get_btime(). Uses SMB_VFS_NEXT_FGETXATTR() instead of SMB_VFS_NEXT_GETXATTR(). Commented out as nothing uses it yet. This will change shortly. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit da18c67732f847a037e505a6db395de2b757dabb Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 10:50:04 2021 -0700 s3: VFS: fake_acls: Remove unused fake_acls_uid()/fake_acls_gid(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 2e5180783882ed842fcee172ed67f4eae5099697 Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 10:48:49 2021 -0700 s3: VFS: fake_acls: In fake_acls_stat() - Now we always have a valid fsp, remove the calls to the path-based functions. Comment out fake_acls_uid()/fake_acls_gid(), they are no longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 243bce415830885a70ff0aba0b829291bb0dc760 Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 10:43:51 2021 -0700 s3: VFS: fake_acls: In fake_acls_stat() - use openat_pathref_fsp() to always get a pathref fsp. Add a recursion guard so that openat_pathref_fsp() doesn't end up recursing into itself when it calls SMB_VFS_STAT(). We now always have a valid fsp inside fake_acls_stat(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit d2b78728514a68df29efc483ede90cd804880685 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 19:10:37 2021 -0700 s3: VFS: fake_acls: In fake_acls_stat() - if we have a pathref fsp, use it. We will add a pathref open for the case where we don't next. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 6e6f532c5fc7daad019d717302abe72f6fc97de0 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 19:05:06 2021 -0700 s3: VFS: fake_acls: In fake_acls_stat() - remove call to get_full_smb_filename(). It serves no purpose here. We no longer need the frame pointer. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit cf51681aac924ce203c84b8f99b0ef7a0b10a3e0 Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 10:27:13 2021 -0700 s3: VFS: fake_acls: In fake_acls_lstat() - get a pathref on whatever the link points to and use the handle-based functions. Add a recursion guard so that synthetic_pathref() can't recurse into itself by calling SMB_VFS_LSTAT(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 13778b4c73155cef09709f676d23046e6a94f8bc Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 19:05:57 2021 -0700 s3: VFS: fake_acls: In fake_acls_lstat() - remove call to get_full_smb_filename(). It serves no purpose here. We no longer need the frame pointer. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit c308ffa41c2020d3287bd19f743a2cd43e035d9e Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 12:01:13 2021 -0700 s3: VFS: streams_depot: file_is_valid(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 981f714369b2b5e5f26a6408778a852a889720e2 Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 15:11:47 2021 -0700 s3: lib: adouble: Remove ad_set() - Dead code. Not used anywhere. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 303d15e14fc47a7c3f5cb9cc8c074281f58e4f9b Author: Jeremy Allison <j...@samba.org> Date: Thu Jun 24 20:23:39 2021 -0700 s3: lib: adouble: Protect ad_read_meta() from accidently using a NULL fsp. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit ff09fc77a21dd8baa75e64037b4cbdfc841ffb78 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 11:47:25 2021 -0700 s3: torture: In cmd_getxattr(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 198413da763ee652dad65a430962031be974b51c Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 11:43:56 2021 -0700 s3: smbd: get_ea_list_from_fsp(). Make it clear we're using only the fsp by replacing the fsp->fsp_name with NULL. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 757b7d5c6ae830975513a95296c6faf160cd04f3 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 11:40:31 2021 -0700 s3: smbd: fload_inherited_info(). Always use SMB_VFS_FGETXATTR(). If the underlying fd is -1, we want this to fail with EBADF. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit f694b36335ef650b9eee6666b10ae3aafd7bee7d Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 11:29:21 2021 -0700 s3: modules: acl_xattr: getxattr_do(). Remove the smb_fname parameter. It was always NULL. Always use the passed in fsp. If the underlying fd is -1, we want this to fail with EBADF. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 4670cf1da6feb7e7316db42079ce43ff22f7015e Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:31:41 2021 -0700 s3: smbd: Temporarily add protection to get_ea_value() for fsp==NULL and smb_fname==NULL. This will go away once get_ea_value() is fully handle-based and renamed to get_ea_value_fsp(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 2dd7ac6a6eb88443a44564ad12799f05e8be764c Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 11:26:59 2021 -0700 s3: smbd: get_ea_value(). If we have an fsp, *always* use it for SMB_VFS_FGETXATTR(). If the underlying fd is -1, we want this to fail with EBADF. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit b63ac2ed97f92e1c435e72e8edaee00a8366a31d Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 23:38:44 2021 -0700 s3: smbd: Move the call to fsp_set_fd(conn->cwd_fsp, AT_FDCWD) to just after SMB_VFS_CHDIR(). Once SMB_VFS_CHDIR() has been called and returned success, cwd_fsp *must* be AT_FDCWD. We needs this so that SMB_VFS_STAT() can work correctly with at startup time with modules that need to create pathref fsp's. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit bd0bad6f58ab9aff789392ba1a8e817d7bdca5c8 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 23:39:41 2021 -0700 s3: smbd: On startup file_name_hash() can be called with an absolute pathname. This occurs on first CHDIR to the root of the share. Ensure we don't add conn->connectpath twice when doing creating the file name hash. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit a6df051dd5e8c63f2fdfdb20ee01169d2bdb97dd Author: Jeremy Allison <j...@samba.org> Date: Thu Jun 24 19:11:38 2021 -0700 s3: smbd: In openat_pathref_fsp(), just check we're opening the same file type, not dev and inode. As this is an internal open and we don't have any locks around, we don't have to mandate the dev and ino pair are the same (and in fact not doing so fixes bugs when this is called by VFS modules that like to play tricks with ino number on stream paths (fruit, and streams_xattr are the two that currently do this). There's no security advantage to checking that, as the fd_openat() ensures this is safe. As fd_openat() does an FSTAT on the handle, update the smb_fname stat info with the "correct" values from the handle. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 0d78398beea47b25d3e701db23933280cf1e1919 Author: Jeremy Allison <j...@samba.org> Date: Thu Jun 24 20:05:01 2021 -0700 s4: torture: Improve error messages in check_stream() and read_stream() to include the filename and NTSTATUS. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> ----------------------------------------------------------------------- Summary of changes: source3/lib/adouble.c | 49 +----- source3/lib/adouble.h | 3 - source3/modules/vfs_acl_xattr.c | 12 +- source3/modules/vfs_ceph_snapshots.c | 92 ++++++++++-- source3/modules/vfs_fake_acls.c | 208 +++++++++++++++----------- source3/modules/vfs_streams_depot.c | 28 +++- source3/modules/vfs_streams_xattr.c | 280 ++++++++++++++--------------------- source3/smbd/files.c | 45 ++++-- source3/smbd/nttrans.c | 4 +- source3/smbd/posix_acls.c | 10 +- source3/smbd/proto.h | 11 +- source3/smbd/trans2.c | 40 +++-- source3/smbd/vfs.c | 2 +- source3/torture/cmd_vfs.c | 25 +++- source4/torture/vfs/fruit.c | 7 +- 15 files changed, 436 insertions(+), 380 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c index 3dcabeb5739..3788943941e 100644 --- a/source3/lib/adouble.c +++ b/source3/lib/adouble.c @@ -2096,10 +2096,12 @@ exit: if (rc != 0) { ealen = -1; if (errno == EINVAL) { - become_root(); - (void)SMB_VFS_FREMOVEXATTR(smb_fname->fsp, - AFPINFO_EA_NETATALK); - unbecome_root(); + if (smb_fname->fsp != NULL) { + become_root(); + (void)SMB_VFS_FREMOVEXATTR(smb_fname->fsp, + AFPINFO_EA_NETATALK); + unbecome_root(); + } errno = ENOENT; } } @@ -2566,45 +2568,6 @@ struct adouble *ad_fget(TALLOC_CTX *ctx, vfs_handle_struct *handle, return ad_get_internal(ctx, handle, fsp, NULL, type); } -/** - * Set AppleDouble metadata on a file or directory - * - * @param[in] ad adouble handle - * - * @param[in] smb_fname pathname to file or directory - * - * @return status code, 0 means success - **/ -int ad_set(vfs_handle_struct *handle, - struct adouble *ad, - const struct smb_filename *smb_fname) -{ - bool ok; - int ret; - - DBG_DEBUG("Path [%s]\n", smb_fname->base_name); - - if (ad->ad_type != ADOUBLE_META) { - DBG_ERR("ad_set on [%s] used with ADOUBLE_RSRC\n", - smb_fname->base_name); - return -1; - } - - ok = ad_pack(handle, ad, NULL); - if (!ok) { - return -1; - } - - ret = SMB_VFS_FSETXATTR(smb_fname->fsp, - AFPINFO_EA_NETATALK, - ad->ad_data, - AD_DATASZ_XATTR, 0); - - DBG_DEBUG("Path [%s] ret [%d]\n", smb_fname->base_name, ret); - - return ret; -} - /** * Set AppleDouble metadata on a file or directory * diff --git a/source3/lib/adouble.h b/source3/lib/adouble.h index 040568a44b6..8b14d0ab871 100644 --- a/source3/lib/adouble.h +++ b/source3/lib/adouble.h @@ -175,9 +175,6 @@ struct adouble *ad_get(TALLOC_CTX *ctx, adouble_type_t type); struct adouble *ad_fget(TALLOC_CTX *ctx, vfs_handle_struct *handle, files_struct *fsp, adouble_type_t type); -int ad_set(vfs_handle_struct *handle, - struct adouble *ad, - const struct smb_filename *smb_fname); int ad_fset(struct vfs_handle_struct *handle, struct adouble *ad, files_struct *fsp); diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c index 4d5ae5616cb..ad11e20b7dc 100644 --- a/source3/modules/vfs_acl_xattr.c +++ b/source3/modules/vfs_acl_xattr.c @@ -37,7 +37,6 @@ static ssize_t getxattr_do(vfs_handle_struct *handle, files_struct *fsp, - const struct smb_filename *smb_fname, const char *xattr_name, uint8_t *val, size_t size) @@ -46,12 +45,7 @@ static ssize_t getxattr_do(vfs_handle_struct *handle, int saved_errno = 0; become_root(); - if (fsp && fsp_get_pathref_fd(fsp) != -1) { - sizeret = SMB_VFS_FGETXATTR(fsp, xattr_name, val, size); - } else { - sizeret = SMB_VFS_GETXATTR(handle->conn, smb_fname, - XATTR_NTACL_NAME, val, size); - } + sizeret = SMB_VFS_FGETXATTR(fsp, xattr_name, val, size); if (sizeret == -1) { saved_errno = errno; } @@ -86,7 +80,7 @@ static NTSTATUS fget_acl_blob(TALLOC_CTX *ctx, val = tmp; sizeret = - getxattr_do(handle, fsp, NULL, XATTR_NTACL_NAME, val, size); + getxattr_do(handle, fsp, XATTR_NTACL_NAME, val, size); if (sizeret >= 0) { pblob->data = val; @@ -100,7 +94,7 @@ static NTSTATUS fget_acl_blob(TALLOC_CTX *ctx, /* Too small, try again. */ sizeret = - getxattr_do(handle, fsp, NULL, XATTR_NTACL_NAME, NULL, 0); + getxattr_do(handle, fsp, XATTR_NTACL_NAME, NULL, 0); if (sizeret < 0) { goto err; } diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index be9b2dd1aa6..26844e50187 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -48,9 +48,9 @@ */ #define CEPH_SNAP_BTIME_XATTR "ceph.snap.btime" -static int ceph_snap_get_btime(struct vfs_handle_struct *handle, - struct smb_filename *smb_fname, - time_t *_snap_secs) +static int ceph_snap_get_btime_fsp(struct vfs_handle_struct *handle, + struct files_struct *fsp, + time_t *_snap_secs) { int ret; char snap_btime[33]; @@ -59,8 +59,11 @@ static int ceph_snap_get_btime(struct vfs_handle_struct *handle, struct timespec snap_timespec; int err; - ret = SMB_VFS_NEXT_GETXATTR(handle, smb_fname, CEPH_SNAP_BTIME_XATTR, - snap_btime, sizeof(snap_btime)); + ret = SMB_VFS_NEXT_FGETXATTR(handle, + fsp, + CEPH_SNAP_BTIME_XATTR, + snap_btime, + sizeof(snap_btime)); if (ret < 0) { DBG_ERR("failed to get %s xattr: %s\n", CEPH_SNAP_BTIME_XATTR, strerror(errno)); @@ -122,17 +125,20 @@ static int ceph_snap_get_btime(struct vfs_handle_struct *handle, */ static int ceph_snap_fill_label(struct vfs_handle_struct *handle, TALLOC_CTX *tmp_ctx, - const char *parent_snapsdir, + struct files_struct *dirfsp, const char *subdir, SHADOW_COPY_LABEL this_label) { + const char *parent_snapsdir = dirfsp->fsp_name->base_name; struct smb_filename *smb_fname; + struct smb_filename *atname = NULL; time_t snap_secs; struct tm gmt_snap_time; struct tm *tm_ret; size_t str_sz; char snap_path[PATH_MAX + 1]; int ret; + NTSTATUS status; /* * CephFS snapshot creation times are available via a special @@ -154,10 +160,39 @@ static int ceph_snap_fill_label(struct vfs_handle_struct *handle, return -ENOMEM; } - ret = ceph_snap_get_btime(handle, smb_fname, &snap_secs); + ret = vfs_stat(handle->conn, smb_fname); + if (ret < 0) { + ret = -errno; + TALLOC_FREE(smb_fname); + return ret; + } + + atname = synthetic_smb_fname(tmp_ctx, + subdir, + NULL, + &smb_fname->st, + 0, + 0); + if (atname == NULL) { + TALLOC_FREE(smb_fname); + return -ENOMEM; + } + + status = openat_pathref_fsp(dirfsp, atname); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(smb_fname); + TALLOC_FREE(atname); + return -map_errno_from_nt_status(status); + } + + ret = ceph_snap_get_btime_fsp(handle, atname->fsp, &snap_secs); if (ret < 0) { + TALLOC_FREE(smb_fname); + TALLOC_FREE(atname); return ret; } + TALLOC_FREE(smb_fname); + TALLOC_FREE(atname); tm_ret = gmtime_r(&snap_secs, &gmt_snap_time); if (tm_ret == NULL) { @@ -258,8 +293,10 @@ static int ceph_snap_enum_snapdir(struct vfs_handle_struct *handle, } DBG_DEBUG("filling shadow copy label for %s/%s\n", snaps_dname->base_name, dname); - ret = ceph_snap_fill_label(handle, snaps_dname, - snaps_dname->base_name, dname, + ret = ceph_snap_fill_label(handle, + snaps_dname, + dirfsp, + dname, sc_data->labels[sc_data->num_volumes - 1]); if (ret < 0) { TALLOC_FREE(talloced); @@ -545,7 +582,8 @@ static int ceph_snap_gmt_convert_dir(struct vfs_handle_struct *handle, while ((dname = ReadDirName(dir_hnd, &offset, NULL, &talloced)) != NULL) { - struct smb_filename *smb_fname; + struct smb_filename *smb_fname = NULL; + struct smb_filename *atname = NULL; time_t snap_secs = 0; if (ISDOT(dname) || ISDOTDOT(dname)) { @@ -571,11 +609,43 @@ static int ceph_snap_gmt_convert_dir(struct vfs_handle_struct *handle, goto err_out; } - ret = ceph_snap_get_btime(handle, smb_fname, &snap_secs); + ret = vfs_stat(handle->conn, smb_fname); if (ret < 0) { + ret = -errno; + TALLOC_FREE(smb_fname); goto err_out; } + atname = synthetic_smb_fname(tmp_ctx, + dname, + NULL, + &smb_fname->st, + 0, + 0); + if (atname == NULL) { + TALLOC_FREE(smb_fname); + ret = -ENOMEM; + goto err_out; + } + + status = openat_pathref_fsp(dirfsp, atname); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(smb_fname); + TALLOC_FREE(atname); + ret = -map_errno_from_nt_status(status); + goto err_out; + } + + ret = ceph_snap_get_btime_fsp(handle, atname->fsp, &snap_secs); + if (ret < 0) { + TALLOC_FREE(smb_fname); + TALLOC_FREE(atname); + goto err_out; + } + + TALLOC_FREE(smb_fname); + TALLOC_FREE(atname); + /* * check gmt_snap_time matches @timestamp */ diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c index 28d6acef163..79735a81233 100644 --- a/source3/modules/vfs_fake_acls.c +++ b/source3/modules/vfs_fake_acls.c @@ -35,43 +35,6 @@ #define FAKE_ACL_ACCESS_XATTR "system.fake_access_acl" #define FAKE_ACL_DEFAULT_XATTR "system.fake_default_acl" -static int fake_acls_uid(vfs_handle_struct *handle, - struct smb_filename *smb_fname, - uid_t *uid) -{ - ssize_t size; - uint8_t uid_buf[4]; - size = SMB_VFS_NEXT_GETXATTR(handle, smb_fname, - FAKE_UID, uid_buf, sizeof(uid_buf)); - if (size == -1 && errno == ENOATTR) { - return 0; - } - if (size != 4) { - return -1; - } - *uid = IVAL(uid_buf, 0); - return 0; -} - -static int fake_acls_gid(vfs_handle_struct *handle, - struct smb_filename *smb_fname, - uid_t *gid) -{ - ssize_t size; - uint8_t gid_buf[4]; - - size = SMB_VFS_NEXT_GETXATTR(handle, smb_fname, - FAKE_GID, gid_buf, sizeof(gid_buf)); - if (size == -1 && errno == ENOATTR) { - return 0; - } - if (size != 4) { - return -1; - } - *gid = IVAL(gid_buf, 0); - return 0; -} - static int fake_acls_fuid(vfs_handle_struct *handle, files_struct *fsp, uid_t *uid) @@ -112,40 +75,94 @@ static int fake_acls_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname) { int ret = -1; + static bool in_openat_pathref_fsp = false; ret = SMB_VFS_NEXT_STAT(handle, smb_fname); if (ret == 0) { - TALLOC_CTX *frame = talloc_stackframe(); - char *path; - struct smb_filename smb_fname_base = { - .base_name = smb_fname->base_name - }; - NTSTATUS status; + struct smb_filename *smb_fname_cp = NULL; + struct files_struct *fsp = NULL; + /* - * As we're calling getxattr directly here - * we need to use only the base_name, not - * the full name containing any stream name. + * Ensure openat_pathref_fsp() + * can't recurse into fake_acls_stat(). + * openat_pathref_fsp() doesn't care + * about the uid/gid values, it only + * wants a valid/invalid stat answer + * and we know smb_fname exists as + * the SMB_VFS_NEXT_STAT() returned + * zero above. */ - status = get_full_smb_filename(frame, &smb_fname_base, &path); - if (!NT_STATUS_IS_OK(status)) { - errno = map_errno_from_nt_status(status); - TALLOC_FREE(frame); - return -1; + if (in_openat_pathref_fsp) { + return 0; } - - ret = fake_acls_uid(handle, &smb_fname_base, - &smb_fname->st.st_ex_uid); + + if (smb_fname->fsp != NULL) { + fsp = smb_fname->fsp; + if (fsp->base_fsp != NULL) { + /* + * This is a stream pathname. Use + * the base_fsp to get the xattr. + */ + fsp = fsp->base_fsp; + } + } else { + NTSTATUS status; + /* + * openat_pathref_fsp() expects a talloc'ed + * smb_filename. stat can be passed a struct + * from the stack. Make a talloc'ed copy + * so openat_pathref_fsp() can add its + * destructor. + */ + smb_fname_cp = cp_smb_filename(talloc_tos(), + smb_fname); + /* Recursion guard. */ + in_openat_pathref_fsp = true; + status = openat_pathref_fsp(handle->conn->cwd_fsp, + smb_fname_cp); + /* End recursion guard. */ + in_openat_pathref_fsp = false; + + if (!NT_STATUS_IS_OK(status)) { + /* + * Ignore errors here. We know + * the path exists (the SMB_VFS_NEXT_STAT() + * above succeeded. So being unable to + * open a pathref fsp can be due to a + * range of errors (startup path beginning + * with '/' for example, path = ".." when + * enumerating a directory. Just treat this + * the same way as the path not having the + * FAKE_UID or FAKE_GID EA's present. For the + * test purposes of this module (fake NT ACLs + * from windows clients) this is close enough. + * Just report for debugging purposes. + */ + DBG_DEBUG("Unable to get pathref fsp on %s. " + "Error %s\n", + smb_fname_str_dbg(smb_fname_cp), + nt_errstr(status)); + TALLOC_FREE(smb_fname_cp); + return 0; + } + fsp = smb_fname_cp->fsp; + } + + ret = fake_acls_fuid(handle, + fsp, + &smb_fname->st.st_ex_uid); if (ret != 0) { - TALLOC_FREE(frame); + TALLOC_FREE(smb_fname_cp); return ret; } - ret = fake_acls_gid(handle, &smb_fname_base, - &smb_fname->st.st_ex_gid); + ret = fake_acls_fgid(handle, + fsp, + &smb_fname->st.st_ex_gid); if (ret != 0) { - TALLOC_FREE(frame); + TALLOC_FREE(smb_fname_cp); return ret; } - TALLOC_FREE(frame); + TALLOC_FREE(smb_fname_cp); } return ret; @@ -155,39 +172,58 @@ static int fake_acls_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname) { int ret = -1; + static bool in_synthetic_pathref = false; ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname); if (ret == 0) { - TALLOC_CTX *frame = talloc_stackframe(); - char *path; - struct smb_filename smb_fname_base = { - .base_name = smb_fname->base_name - }; + struct smb_filename *smb_fname_base = NULL; + SMB_STRUCT_STAT sbuf = { 0 }; NTSTATUS status; - /* - * As we're calling getxattr directly here - * we need to use only the base_name, not - * the full name containing any stream name. - */ - status = get_full_smb_filename(frame, &smb_fname_base, &path); - if (!NT_STATUS_IS_OK(status)) { - errno = map_errno_from_nt_status(status); - TALLOC_FREE(frame); - return -1; + + if (in_synthetic_pathref) { + /* + * Ensure synthetic_pathref() + * can't recurse into fake_acls_lstat(). + * synthetic_pathref() doesn't care + * about the uid/gid values, it only + * wants a valid/invalid stat answer + * and we know smb_fname exists as + * the SMB_VFS_NEXT_LSTAT() returned + * zero above. + */ + return 0; } - /* This isn't quite right (calling getxattr not - * lgetxattr), but for the test purposes of this - * module (fake NT ACLs from windows clients), it is - * close enough. We removed the l*xattr functions - * because linux doesn't support using them, but we - * could fake them in xattr_tdb if we really wanted - * to. We ignore errors because the link might not point anywhere */ -- Samba Shared Repository