The branch, master has been updated via c68133d41c3 smbd: prepare DH disconnect for AT-names via 76118b4830a smbd: prepare fsp_str_dbg() for atnames via 75d6943ed88 smbd: use fd_openat() via eaf1c6a338a smbd: add fd_openat() via 32588c023e2 vfs: remove SMB_VFS_OPEN() via 1a3cf6ba590 s3/torture: use SMB_VFS_OPENAT() in cmd_set_nt_acl() via b1d8bb6a402 s3/torture: use SMB_VFS_OPENAT() in cmd_open() via 1304fd92afc s3/pysmbd: use SMB_VFS_OPENAT() in init_files_struct() via c57d76ec1a9 smbd: use SMB_VFS_OPENAT() in non_widelink_open() via 643a441edbf vfs_shadow_copy2: use SMB_VFS_NEXT_OPENAT() in shadow_copy2_get_shadow_copy_data() via a912c1d87d6 s3: VFS: fruit. Now we've gotten rid of SMB_VFS_OPEN(), add const to the functions called by fruit_openat(). via 86ddd9253f8 vfs_fruit: use SMB_VFS_NEXT_OPENAT() via 87b2ab8fc2e vfs_xattr_tdb: implement SMB_VFS_OPENAT() via 7d0616f5f10 vfs_virusfilter: implement SMB_VFS_OPENAT() via 739e100f47c vfs_unityed_media: implement SMB_VFS_OPENAT() via 6939beacb06 vfs_syncops: implement SMB_VFS_OPENAT() via 35765b8fa43 vfs_streams_xattr: implement SMB_VFS_OPENAT() via dcddc45c4c8 vfs_streams_depot: implement SMB_VFS_OPENAT() via 6bd623771ed vfs_snapper: implement SMB_VFS_OPENAT() via 3e5cb65fa85 vfs_preopen: implement SMB_VFS_OPENAT() via d93d73189b5 vfs_prealloc: implement SMB_VFS_OPENAT() via 01f834513fa vfs_media_harmony: implement SMB_VFS_OPENAT() via 91b7ef1c78a vfs_gpfs: implement SMB_VFS_OPENAT() via 712cd71f936 vfs_glusterfs: implement SMB_VFS_OPENAT() via 3ca5297ac81 vfs_fruit: implement SMB_VFS_OPENAT() via c71215bd64b vfs_widelinks: implement SMB_VFS_OPENAT() via 07cb0b409e4 vfs_time_audit: implement SMB_VFS_OPENAT() via d14696f1b93 vfs_shadow_copy2: implement SMB_VFS_OPENAT() via df7882dd083 vfs_full_audit: implement SMB_VFS_OPENAT() via 104302ae1ee vfs_extd_audit: implement SMB_VFS_OPENAT() via 8aff66d437e vfs_error_inject: implement SMB_VFS_OPENAT() via 39b2da610fe vfs_default: implement SMB_VFS_OPENAT() via 9173b5fdac3 vfs_commit: implement SMB_VFS_OPENAT() via 06e14449891 vfs_ceph_snapshots: implement SMB_VFS_OPENAT() via 605c0b3aadc vfs_ceph: implement SMB_VFS_OPENAT() via 6efb7013273 vfs_catia: implement SMB_VFS_OPENAT() via f9ef244e785 s3: VFS: catia: Change saved_errno to catia_saved_errno in a macro. via 01d949bc95f vfs_cap: implement SMB_VFS_OPENAT() via e7b421832e2 vfs_audit: implement SMB_VFS_OPENAT() via bae76f8644b vfs_aio_pthread: implement SMB_VFS_OPENAT() via 42858577d55 vfs_aio_pthread: add dirfsp arg to create_private_open_data() via 9bb9d6d12cf vfs_aio_pthread: realign create_private_open_data() args via dc061a23b45 vfs_aio_pthread: realign create_private_open_data args via e4a38916e60 vfs: add SMB_VFS_OPENAT() via d3c16d93d18 vfs_fruit: pass down cwdfsp as dirfsp in fruit_open() via 19a1ed2cacf s3/vfs: add vfs_at_fspcwd() from d708d002d7d smbd: remove redundant conn arg from non_widelink_open()
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit c68133d41c368c52cd5ac3c34dbe888ceccd7619 Author: Ralph Boehme <s...@samba.org> Date: Sun May 17 08:05:47 2020 +0200 smbd: prepare DH disconnect for AT-names This ensure cookie.base_name is set to the full path to deal with fsp->fsp_name being an atname in the future. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Thu May 21 22:01:25 UTC 2020 on sn-devel-184 commit 76118b4830aa28ac61fb7f43bc103bbffbe3a608 Author: Ralph Boehme <s...@samba.org> Date: Sun May 17 07:53:42 2020 +0200 smbd: prepare fsp_str_dbg() for atnames Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 75d6943ed880019cca1192d4d4d62d5f27b97d2d Author: Ralph Boehme <s...@samba.org> Date: Fri May 8 16:32:56 2020 +0200 smbd: use fd_openat() This leaves basically two callers of fd_open(): * open_internal_dirfsp_at() * smbd_smb2_query_directory_send() Those will be the only codepaths that use full paths relative to the share root and so require and use the symlink race protection provided by non_widelink_open(). Of course, until we actuall start passing real dirfsps to fd_openat(), fd_openat() internally calls fd_open(). Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit eaf1c6a338a6253068fc3e671605f18c71565dbb Author: Ralph Boehme <s...@samba.org> Date: Thu May 14 21:20:22 2020 +0200 smbd: add fd_openat() Until we actually start passing real dirfsps to fd_openat(), fd_openat() internally calls fd_open(). Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 32588c023e20eb5ab61512d8d5d0b6e9ac2c4d33 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:26:14 2020 +0200 vfs: remove SMB_VFS_OPEN() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 1a3cf6ba590de6644d591a1d96ac74dc68037bcb Author: Ralph Boehme <s...@samba.org> Date: Tue May 19 21:35:56 2020 +0200 s3/torture: use SMB_VFS_OPENAT() in cmd_set_nt_acl() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit b1d8bb6a40222c19e496c1812a78e7796f82b4e3 Author: Ralph Boehme <s...@samba.org> Date: Tue May 19 21:34:26 2020 +0200 s3/torture: use SMB_VFS_OPENAT() in cmd_open() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 1304fd92afc4adbd155baf263531c0cc64ffafa7 Author: Ralph Boehme <s...@samba.org> Date: Tue May 19 21:33:00 2020 +0200 s3/pysmbd: use SMB_VFS_OPENAT() in init_files_struct() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c57d76ec1a9ce26bfab1c4c4c3ac130c15fb71f2 Author: Ralph Boehme <s...@samba.org> Date: Tue May 19 21:30:24 2020 +0200 smbd: use SMB_VFS_OPENAT() in non_widelink_open() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 643a441edbf3ff1707e5b4c1e2966af6d5aed927 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:48:36 2020 +0200 vfs_shadow_copy2: use SMB_VFS_NEXT_OPENAT() in shadow_copy2_get_shadow_copy_data() These are paths not under user control, so it should be safe to call it with AT_FDCWD and multi-component paths. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a912c1d87d64badd0e7e3aa44e90b6ff6bda46bd Author: Jeremy Allison <j...@samba.org> Date: Thu May 21 11:56:14 2020 -0700 s3: VFS: fruit. Now we've gotten rid of SMB_VFS_OPEN(), add const to the functions called by fruit_openat(). Remove the hack that allowed openat() to call non-const functions. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 86ddd9253f8da47b0fb845de917210a5089ee386 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:05:07 2020 +0200 vfs_fruit: use SMB_VFS_NEXT_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 87b2ab8fc2e3d1d981d205334bfc0a37d2ea4091 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:32:57 2020 +0200 vfs_xattr_tdb: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 7d0616f5f10a8fbf15c1293d92b29bd31b633b67 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:31:04 2020 +0200 vfs_virusfilter: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 739e100f47cdfec0de0e16f77a2f4b78801afa89 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:24:37 2020 +0200 vfs_unityed_media: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6939beacb0617448a8798a3516dcb899dfcff256 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:22:26 2020 +0200 vfs_syncops: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 35765b8fa433d930a3d533e8f6728b2910026384 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:18:54 2020 +0200 vfs_streams_xattr: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit dcddc45c4c8272e236fa2ca918f376ff0b698f1d Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:07:20 2020 +0200 vfs_streams_depot: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6bd623771ed5517952df84214f9f2aa908f24cbd Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:02:48 2020 +0200 vfs_snapper: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3e5cb65fa85f698e8c3d8b7168081a397622f85f Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 21:51:00 2020 +0200 vfs_preopen: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d93d73189b5aa447b22b236ab5219a3ebc7b407c Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 21:46:41 2020 +0200 vfs_prealloc: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 01f834513fa1517d577185b64c39d4b52b43aeb9 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 21:43:26 2020 +0200 vfs_media_harmony: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 91b7ef1c78a2d20d455f6f7973fc7930d259c39e Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 21:34:35 2020 +0200 vfs_gpfs: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 712cd71f93677adbe7093499f07771ccbf51c6aa Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 21:32:30 2020 +0200 vfs_glusterfs: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3ca5297ac81cb14e25c64886707056a2819e5dbd Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:04:26 2020 +0200 vfs_fruit: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c71215bd64b012ab6ff485f73c8a42390fb4fba6 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:03:30 2020 +0200 vfs_widelinks: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 07cb0b409e4d6d1ee6c1d7ad9e93a83e76aad868 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:03:18 2020 +0200 vfs_time_audit: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d14696f1b93a0856cbc87c362182373e0047049d Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:03:05 2020 +0200 vfs_shadow_copy2: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit df7882dd0836e0a39314498f75b134209e2feaeb Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:02:39 2020 +0200 vfs_full_audit: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 104302ae1ee72737508c01e1df0da7b91dafc902 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:02:20 2020 +0200 vfs_extd_audit: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8aff66d437e53683c67d10b27b3e85d4e42e80e0 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:02:06 2020 +0200 vfs_error_inject: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 39b2da610fe1d1115743e14c626a4e1bc7b7deb2 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:01:54 2020 +0200 vfs_default: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9173b5fdac30e51e8fa59f30789f75fb91f83f6f Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:01:16 2020 +0200 vfs_commit: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 06e144498919ddf9102be05d33f2a86c3d52a9ee Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:01:04 2020 +0200 vfs_ceph_snapshots: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 605c0b3aadc218df617f9a97932d64676118027b Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 23:00:52 2020 +0200 vfs_ceph: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6efb7013273ae62f38db42d811c791a102f5266a Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:59:05 2020 +0200 vfs_catia: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit f9ef244e78599c13500edce7180bf17a9e1f7f47 Author: Jeremy Allison <j...@samba.org> Date: Thu May 21 11:03:14 2020 -0700 s3: VFS: catia: Change saved_errno to catia_saved_errno in a macro. This is a common variable name. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 01d949bc95fcb5d89d2318adf0d0d05b9d0ede9c Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:58:56 2020 +0200 vfs_cap: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e7b421832e22aa7ee92b64f9769af6b6f13f0b71 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:58:47 2020 +0200 vfs_audit: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit bae76f8644b349d1eeca7992c0741f4d6be78213 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 22:58:29 2020 +0200 vfs_aio_pthread: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 42858577d552ba66ce9cda8f8eda16fdf0e34197 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 16:47:05 2020 +0200 vfs_aio_pthread: add dirfsp arg to create_private_open_data() Prepares for an upcoming aio_pthread_openat_fn(). open_async() passes fspcwd. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9bb9d6d12cf2da2783b8ba1676b8019385b5d741 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 16:44:15 2020 +0200 vfs_aio_pthread: realign create_private_open_data() args Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit dc061a23b45b06fdb6ee166cb822bd68fe1c33a3 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 16:43:11 2020 +0200 vfs_aio_pthread: realign create_private_open_data args Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e4a38916e60dd092901cd5c431980b012978e2ee Author: Ralph Boehme <s...@samba.org> Date: Fri May 15 16:29:44 2020 +0200 vfs: add SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d3c16d93d1833ef2756012def053996372245245 Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 17:51:23 2020 +0200 vfs_fruit: pass down cwdfsp as dirfsp in fruit_open() Not yet used, that comes when we add fruit_openat(). Passing cwdfsp as dirfsp ensures when calling openat() we get the same behaviour as open(). Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 19a1ed2cacf691cdf003f44cbe80a772e871254c Author: Ralph Boehme <s...@samba.org> Date: Wed May 20 17:01:48 2020 +0200 s3/vfs: add vfs_at_fspcwd() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: examples/VFS/skel_opaque.c | 10 +++- examples/VFS/skel_transparent.c | 12 ++-- source3/include/proto.h | 4 ++ source3/include/smbprofile.h | 1 + source3/include/vfs.h | 26 ++++++-- source3/include/vfs_macros.h | 8 +-- source3/lib/filename_util.c | 24 +++++++- source3/modules/vfs_aio_pthread.c | 66 +++++++++++++------- source3/modules/vfs_audit.c | 20 ++++--- source3/modules/vfs_cap.c | 43 +++++++++---- source3/modules/vfs_catia.c | 55 +++++++++++------ source3/modules/vfs_ceph.c | 19 ++++-- source3/modules/vfs_ceph_snapshots.c | 58 +++++++++++++----- source3/modules/vfs_commit.c | 23 ++++--- source3/modules/vfs_default.c | 24 ++++---- source3/modules/vfs_error_inject.c | 18 +++--- source3/modules/vfs_extd_audit.c | 38 +++++++----- source3/modules/vfs_fruit.c | 103 +++++++++++++++++++++++--------- source3/modules/vfs_full_audit.c | 21 ++++--- source3/modules/vfs_glusterfs.c | 24 +++++--- source3/modules/vfs_gpfs.c | 26 ++++---- source3/modules/vfs_media_harmony.c | 49 +++++++-------- source3/modules/vfs_not_implemented.c | 11 ++-- source3/modules/vfs_prealloc.c | 18 +++--- source3/modules/vfs_preopen.c | 22 ++++--- source3/modules/vfs_shadow_copy2.c | 79 +++++++++++++++++------- source3/modules/vfs_snapper.c | 53 ++++++++++------ source3/modules/vfs_streams_depot.c | 39 ++++++++++-- source3/modules/vfs_streams_xattr.c | 23 +++++-- source3/modules/vfs_syncops.c | 16 ++--- source3/modules/vfs_time_audit.c | 21 ++++--- source3/modules/vfs_unityed_media.c | 39 +++++++----- source3/modules/vfs_virusfilter.c | 34 +++++++---- source3/modules/vfs_widelinks.c | 61 +++++++------------ source3/modules/vfs_xattr_tdb.c | 35 ++++++----- source3/script/tests/test_open_eintr.sh | 2 +- source3/smbd/durable.c | 4 +- source3/smbd/open.c | 94 +++++++++++++++++++++++++++-- source3/smbd/proto.h | 3 + source3/smbd/pysmbd.c | 14 ++++- source3/smbd/vfs.c | 49 +++++++++++++-- source3/torture/cmd_vfs.c | 33 +++++++++- 42 files changed, 923 insertions(+), 399 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 77bd471315e..1a9b472634d 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -191,8 +191,12 @@ static int skel_closedir(vfs_handle_struct *handle, DIR *dir) return -1; } -static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname, - files_struct *fsp, int flags, mode_t mode) +static int skel_openat(struct vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + struct files_struct *fsp, + int flags, + mode_t mode) { errno = ENOSYS; return -1; @@ -1062,7 +1066,7 @@ static struct vfs_fn_pointers skel_opaque_fns = { /* File operations */ - .open_fn = skel_open, + .openat_fn = skel_openat, .create_file_fn = skel_create_file, .close_fn = skel_close_fn, .pread_fn = skel_pread, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 5c758f2fc5f..fdb6d0d5f54 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -200,10 +200,14 @@ static int skel_closedir(vfs_handle_struct *handle, DIR *dir) return SMB_VFS_NEXT_CLOSEDIR(handle, dir); } -static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname, - files_struct *fsp, int flags, mode_t mode) +static int skel_openat(struct vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + struct files_struct *fsp, + int flags, + mode_t mode) { - return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode); + return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode); } static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, @@ -1370,7 +1374,7 @@ static struct vfs_fn_pointers skel_transparent_fns = { /* File operations */ - .open_fn = skel_open, + .openat_fn = skel_openat, .create_file_fn = skel_create_file, .close_fn = skel_close_fn, .pread_fn = skel_pread, diff --git a/source3/include/proto.h b/source3/include/proto.h index 0e96fcccc65..12aa392abae 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -80,6 +80,10 @@ int map_errno_from_nt_status(NTSTATUS status); struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf); +NTSTATUS vfs_at_fspcwd(TALLOC_CTX *mem_ctx, + struct connection_struct *conn, + struct files_struct **_fsp); + /* The following definitions come from lib/interface.c */ bool ismyaddr(const struct sockaddr *ip); diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h index 91f30661240..1dc3a088655 100644 --- a/source3/include/smbprofile.h +++ b/source3/include/smbprofile.h @@ -51,6 +51,7 @@ struct tevent_context; SMBPROFILE_STATS_BASIC(syscall_mkdirat) \ SMBPROFILE_STATS_BASIC(syscall_closedir) \ SMBPROFILE_STATS_BASIC(syscall_open) \ + SMBPROFILE_STATS_BASIC(syscall_openat) \ SMBPROFILE_STATS_BASIC(syscall_createfile) \ SMBPROFILE_STATS_BASIC(syscall_close) \ SMBPROFILE_STATS_BYTES(syscall_pread) \ diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 12d048f2138..3126f228626 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -322,6 +322,8 @@ * Version 43 - Remove root_dir_fid from SMB_VFS_CREATE_FILE(). * Version 43 - Add dirfsp to struct files_struct * Version 43 - Add dirfsp args to SMB_VFS_CREATE_FILE() + * Version 43 - Add SMB_VFS_OPENAT() + * Version 43 - Remove SMB_VFS_OPEN() */ #define SMB_VFS_INTERFACE_VERSION 43 @@ -761,9 +763,12 @@ struct vfs_fn_pointers { /* File operations */ - int (*open_fn)(struct vfs_handle_struct *handle, - struct smb_filename *smb_fname, files_struct *fsp, - int flags, mode_t mode); + int (*openat_fn)(struct vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + struct files_struct *fsp, + int flags, + mode_t mode); NTSTATUS (*create_file_fn)(struct vfs_handle_struct *handle, struct smb_request *req, struct files_struct **dirfsp, @@ -1273,9 +1278,12 @@ int smb_vfs_call_mkdirat(struct vfs_handle_struct *handle, mode_t mode); int smb_vfs_call_closedir(struct vfs_handle_struct *handle, DIR *dir); -int smb_vfs_call_open(struct vfs_handle_struct *handle, - struct smb_filename *smb_fname, struct files_struct *fsp, - int flags, mode_t mode); +int smb_vfs_call_openat(struct vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + struct files_struct *fsp, + int flags, + mode_t mode); NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle, struct smb_request *req, struct files_struct **dirfsp, @@ -1731,6 +1739,12 @@ int vfs_not_implemented_closedir(vfs_handle_struct *handle, DIR *dir); int vfs_not_implemented_open(vfs_handle_struct *handle, struct smb_filename *smb_fname, files_struct *fsp, int flags, mode_t mode); +int vfs_not_implemented_openat(vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + struct files_struct *fsp, + int flags, + mode_t mode); NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle, struct smb_request *req, struct files_struct **dirfsp, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 5ab825ec312..e0a8d391945 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -142,10 +142,10 @@ smb_vfs_call_closedir((handle)->next, (dir)) /* File operations */ -#define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) \ - smb_vfs_call_open((conn)->vfs_handles, (fname), (fsp), (flags), (mode)) -#define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) \ - smb_vfs_call_open((handle)->next, (fname), (fsp), (flags), (mode)) +#define SMB_VFS_OPENAT(conn, dirfsp, smb_fname, fsp, flags, mode) \ + smb_vfs_call_openat((conn)->vfs_handles, (dirfsp), (smb_fname), (fsp), (flags), (mode)) +#define SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode) \ + smb_vfs_call_openat((handle)->next, (dirfsp), (smb_fname), (fsp), (flags), (mode)) #define SMB_VFS_CREATE_FILE(conn, req, dirfsp, smb_fname, access_mask, share_access, create_disposition, \ create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \ diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c index 00a5fcda997..418dd20327b 100644 --- a/source3/lib/filename_util.c +++ b/source3/lib/filename_util.c @@ -180,7 +180,29 @@ const char *smb_fname_str_dbg(const struct smb_filename *smb_fname) */ const char *fsp_str_dbg(const struct files_struct *fsp) { - return smb_fname_str_dbg(fsp->fsp_name); + const char *name = NULL; + + name = smb_fname_str_dbg(fsp->fsp_name); + if (name == NULL) { + return ""; + } + + if (fsp->dirfsp == NULL || fsp->dirfsp == fsp->conn->cwd_fsp) { + return name; + } + + if (ISDOT(fsp->dirfsp->fsp_name->base_name)) { + return name; + } + + name = talloc_asprintf(talloc_tos(), + "%s/%s", + fsp->dirfsp->fsp_name->base_name, + fsp->fsp_name->base_name); + if (name == NULL) { + return ""; + } + return name; } /** diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c index 65a7c28e7b3..265bae411d6 100644 --- a/source3/modules/vfs_aio_pthread.c +++ b/source3/modules/vfs_aio_pthread.c @@ -44,6 +44,7 @@ struct aio_open_private_data { struct aio_open_private_data *prev, *next; /* Inputs. */ int dir_fd; + bool opened_dir_fd; int flags; mode_t mode; uint64_t mid; @@ -235,7 +236,7 @@ static void aio_open_do(struct aio_open_private_data *opd) static void opd_free(struct aio_open_private_data *opd) { - if (opd->dir_fd != -1) { + if (opd->opened_dir_fd && opd->dir_fd != -1) { close(opd->dir_fd); } DLIST_REMOVE(open_pd_list, opd); @@ -246,11 +247,13 @@ static void opd_free(struct aio_open_private_data *opd) Create and initialize a private data struct for async open. ***********************************************************************/ -static struct aio_open_private_data *create_private_open_data(TALLOC_CTX *ctx, - const struct smb_filename *smb_fname, - const files_struct *fsp, - int flags, - mode_t mode) +static struct aio_open_private_data *create_private_open_data( + TALLOC_CTX *ctx, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + const files_struct *fsp, + int flags, + mode_t mode) { struct aio_open_private_data *opd = talloc_zero(ctx, struct aio_open_private_data); @@ -299,11 +302,16 @@ static struct aio_open_private_data *create_private_open_data(TALLOC_CTX *ctx, return NULL; } + if (dirfsp->fh->fd != AT_FDCWD) { + opd->dir_fd = dirfsp->fh->fd; + } else { #if defined(O_DIRECTORY) - opd->dir_fd = open(".", O_RDONLY|O_DIRECTORY); + opd->dir_fd = open(".", O_RDONLY|O_DIRECTORY); #else - opd->dir_fd = open(".", O_RDONLY); + opd->dir_fd = open(".", O_RDONLY); #endif + opd->opened_dir_fd = true; + } if (opd->dir_fd == -1) { opd_free(opd); return NULL; @@ -332,7 +340,8 @@ static int opd_inflight_destructor(struct aio_open_private_data *opd) Setup an async open. *****************************************************************/ -static int open_async(const struct smb_filename *smb_fname, +static int open_async(const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, const files_struct *fsp, int flags, mode_t mode) @@ -351,7 +360,12 @@ static int open_async(const struct smb_filename *smb_fname, * opd is always safely freed in all codepath so no * memory leaks. */ - opd = create_private_open_data(fsp->conn, smb_fname, fsp, flags, mode); + opd = create_private_open_data(fsp->conn, + dirfsp, + smb_fname, + fsp, + flags, + mode); if (opd == NULL) { DEBUG(10, ("open_async: Could not create private data.\n")); return -1; @@ -432,18 +446,19 @@ static bool find_completed_open(files_struct *fsp, opens to prevent any race conditions. *****************************************************************/ -static int aio_pthread_open_fn(vfs_handle_struct *handle, - struct smb_filename *smb_fname, - files_struct *fsp, - int flags, - mode_t mode) +static int aio_pthread_openat_fn(vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + struct files_struct *fsp, + int flags, + mode_t mode) { int my_errno = 0; int fd = -1; bool aio_allow_open = lp_parm_bool( SNUM(handle->conn), "aio_pthread", "aio open", false); - if (smb_fname->stream_name) { + if (smb_fname->stream_name != NULL) { /* Don't handle stream opens. */ errno = ENOENT; return -1; @@ -451,17 +466,26 @@ static int aio_pthread_open_fn(vfs_handle_struct *handle, if (!aio_allow_open) { /* aio opens turned off. */ - return open(smb_fname->base_name, flags, mode); + return openat(dirfsp->fh->fd, + smb_fname->base_name, + flags, + mode); } if (!(flags & O_CREAT)) { /* Only creates matter. */ - return open(smb_fname->base_name, flags, mode); + return openat(dirfsp->fh->fd, + smb_fname->base_name, + flags, + mode); } if (!(flags & O_EXCL)) { /* Only creates with O_EXCL matter. */ - return open(smb_fname->base_name, flags, mode); + return openat(dirfsp->fh->fd, + smb_fname->base_name, + flags, + mode); } /* @@ -477,13 +501,13 @@ static int aio_pthread_open_fn(vfs_handle_struct *handle, } /* Ok, it's a create exclusive call - pass it to a thread helper. */ - return open_async(smb_fname, fsp, flags, mode); + return open_async(dirfsp, smb_fname, fsp, flags, mode); } #endif static struct vfs_fn_pointers vfs_aio_pthread_fns = { #if defined(HAVE_OPENAT) && defined(HAVE_LINUX_THREAD_CREDENTIALS) - .open_fn = aio_pthread_open_fn, + .openat_fn = aio_pthread_openat_fn, #endif }; diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c index 916d8a04206..ce7eb7a46fb 100644 --- a/source3/modules/vfs_audit.c +++ b/source3/modules/vfs_audit.c @@ -197,17 +197,21 @@ static int audit_mkdirat(vfs_handle_struct *handle, return result; } -static int audit_open(vfs_handle_struct *handle, - struct smb_filename *smb_fname, files_struct *fsp, - int flags, mode_t mode) +static int audit_openat(vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + struct files_struct *fsp, + int flags, + mode_t mode) { int result; - result = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode); + result = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode); - syslog(audit_syslog_priority(handle), "open %s (fd %d) %s%s%s\n", - smb_fname->base_name, result, - ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", + syslog(audit_syslog_priority(handle), + "openat %s (fd %d) %s%s%s\n", + fsp_str_dbg(fsp), result, + ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); @@ -305,7 +309,7 @@ static struct vfs_fn_pointers vfs_audit_fns = { .connect_fn = audit_connect, .disconnect_fn = audit_disconnect, .mkdirat_fn = audit_mkdirat, - .open_fn = audit_open, + .openat_fn = audit_openat, .close_fn = audit_close, .renameat_fn = audit_renameat, .unlinkat_fn = audit_unlinkat, diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index ab84c3143cc..c713d30301e 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -147,29 +147,48 @@ static int cap_mkdirat(vfs_handle_struct *handle, mode); } -static int cap_open(vfs_handle_struct *handle, struct smb_filename *smb_fname, - files_struct *fsp, int flags, mode_t mode) +static int cap_openat(vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname_in, + files_struct *fsp, + int flags, + mode_t mode) { - char *cappath; - char *tmp_base_name = NULL; + char *cappath = NULL; + struct smb_filename *smb_fname = NULL; int ret; + int saved_errno = 0; cappath = capencode(talloc_tos(), smb_fname->base_name); - - if (!cappath) { + if (cappath == NULL) { errno = ENOMEM; return -1; } - tmp_base_name = smb_fname->base_name; + smb_fname = cp_smb_filename(talloc_tos(), smb_fname_in); + if (smb_fname == NULL) { + TALLOC_FREE(cappath); + errno = ENOMEM; + return -1; + } smb_fname->base_name = cappath; - DEBUG(3,("cap: cap_open for %s\n", smb_fname_str_dbg(smb_fname))); - ret = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode); + DBG_DEBUG("cap_open for %s\n", smb_fname_str_dbg(smb_fname)); + ret = SMB_VFS_NEXT_OPENAT(handle, + dirfsp, + smb_fname, + fsp, + flags, + mode); - smb_fname->base_name = tmp_base_name; + if (ret == -1) { + saved_errno = errno; + } TALLOC_FREE(cappath); - + TALLOC_FREE(smb_fname); + if (saved_errno != 0) { + errno = saved_errno; + } return ret; } @@ -1061,7 +1080,7 @@ static struct vfs_fn_pointers vfs_cap_fns = { .get_quota_fn = cap_get_quota, .readdir_fn = cap_readdir, .mkdirat_fn = cap_mkdirat, - .open_fn = cap_open, + .openat_fn = cap_openat, .renameat_fn = cap_renameat, .stat_fn = cap_stat, .lstat_fn = cap_lstat, diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 6b89974a7ae..6fc14de076b 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -438,9 +438,9 @@ static int catia_fetch_fsp_pre_next(TALLOC_CTX *mem_ctx, } #define CATIA_FETCH_FSP_POST_NEXT(_cc, fsp) do { \ - int saved_errno = errno; \ + int catia_saved_errno = errno; \ catia_fetch_fsp_post_next((_cc), (fsp), __func__); \ - errno = saved_errno; \ + errno = catia_saved_errno; \ } while(0) static void catia_fetch_fsp_post_next(struct catia_cache **_cc, @@ -485,21 +485,23 @@ static void catia_fetch_fsp_post_next(struct catia_cache **_cc, return; } -static int catia_open(vfs_handle_struct *handle, - struct smb_filename *smb_fname, - files_struct *fsp, - int flags, - mode_t mode) +static int catia_openat(vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname_in, + files_struct *fsp, + int flags, + mode_t mode) { -- Samba Shared Repository