The branch, master has been updated via d708d002d7d smbd: remove redundant conn arg from non_widelink_open() via f22bf66f758 smbd: realign non_widelink_open() args via f4b37191911 smbd: remove redundant conn arg from fd_open() via c0551b22fd1 smbd: remove redundant conn arg from fd_open_atomic() via 02f744a59b1 smbd: realign fd_open_atomic() args via 134114aa160 smbd: realign args to fd_open_atomic() in open_file() via 5c67a3e8ceb smbd: realign args to open_file() in open_file_ntcreate() via a77f28dcca2 smbd: remove redundant conn arg from open_file() via dd4d4f81297 smbd: assert (fsp->dirfsp == conn->cwd_fsp) in open_file_ntcreate() via 4ae6e5f0548 smbd: set dirfsp in the SMB2 DH reconnect via 5a7ce143bcf smbd: set fsp->dirfsp in create_file_unixpath() via 68b28275f06 smbd: use dirfsp in mkdir_internal() via 435a19eaa72 smbd: fix check_parent_access() args alignment in mkdir_internal() via 0591904bb86 smbd: fix SMB_VFS_MKDIRAT() arg alignment in mkdir_internal() via 31a4a3a5ca8 smbd: pass dirfsp to mkdir_internal() via 0ca3f13b21d smbd: set fsp->dirfsp in open_directory() via 67373681c59 smbd: use dirfsp in open_directory() via 1f581fb384f smbd: pass dirfsp to open_directory() via 227e14acd6d smbd: realign args in calls to open_directory() via 9f5fd738469 smbd: pass dirfsp to create_file_unixpath() via 12b2844571e smbd: realign create_file_unixpath() args via 44cd4159211 smbd: add dirfsp arg to SMB_VFS_CREATE_FILE() via a947b67d788 smbd: handling of fsp->dirfsps in close_file() via 1736ef26c75 smbd: add flag "is_dirfsp" to the fsp_flags via 373d02da756 vfs: add dirfsp to struct files_struct via 95574894789 smbd: move fstat from create_internal_dirfsp() to open_internal_dirfsp() via 8883dacb125 smbd: rename create_internal_dirfsp_at() to create_internal_dirfsp() via 84cf205ff43 smbd: rename open_internal_dirfsp_at() to open_internal_dirfsp() via ef17a408c8a vfs_aio_pthread: avoid parent_smb_fname() via a30825f29ee vfs_aio_pthread: SMB_VFS_OPEN() is called with cwd=parent directory of the file via bd87aeb3d04 vfs_aio_pthread: pass smb_fname to create_private_open_data() via c51a8f36dab vfs_aio_pthread: pass smb_fname to open_async() via a6344334c07 smbd: remove dirfsp arg from [create|open]_internal_dirfsp_at() via 4c720a05f05 smbd: set fsp_name of conn->cwd_fsp via 97d061237b0 smbd: move conn_rootdir_fname to non_widelink_open() via 15303ee19bc smbd: prepare for replacing SMB_VFS_READLINKAT() with SMB_VFS_STATX() in the future via 60c47a5d13b smbd: remove unused variable twrp_name from filename_convert_internal() via 0b31a9ce9a1 smbd: update function documentation header to match actual function argument names via acffa8f406e smbd: add open_flags arg to in open_internal_dirfsp_at() via d60b1134b9e smbd: exit early in the error case in fd_open() via f1d204c5bac smbd: refactor flags computation for fd_open() in open_directory() a bit from 799387963c4 add some missing FSCTL defines
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit d708d002d7d9f4aa630180857caaf027442fcd9b Author: Ralph Boehme <s...@samba.org> Date: Fri May 8 15:46:02 2020 +0200 smbd: remove redundant conn arg from non_widelink_open() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Ralph Böhme <s...@samba.org> Autobuild-Date(master): Thu May 21 06:43:04 UTC 2020 on sn-devel-184 commit f22bf66f758c4a85f1a84d9c156390666dd204c3 Author: Ralph Boehme <s...@samba.org> Date: Fri May 8 15:45:11 2020 +0200 smbd: realign non_widelink_open() args Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit f4b371919116f987d14be1b7f6a94e9dacda597e Author: Ralph Boehme <s...@samba.org> Date: Fri Apr 10 16:58:16 2020 +0200 smbd: remove redundant conn arg from fd_open() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c0551b22fd17fa3a8d66d1efad7bf27dd36eb20e Author: Ralph Boehme <s...@samba.org> Date: Fri Apr 10 16:54:53 2020 +0200 smbd: remove redundant conn arg from fd_open_atomic() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 02f744a59b1d7f83f94badd0b696cff23ca6a4f0 Author: Ralph Boehme <s...@samba.org> Date: Fri May 8 15:24:04 2020 +0200 smbd: realign fd_open_atomic() args Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 134114aa16070b80891ce2b73b2858c499f7c2fe Author: Ralph Boehme <s...@samba.org> Date: Thu May 7 20:52:18 2020 +0200 smbd: realign args to fd_open_atomic() in open_file() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5c67a3e8ceb47e1fe3032577aafcd53177862dd2 Author: Ralph Boehme <s...@samba.org> Date: Thu May 7 20:46:06 2020 +0200 smbd: realign args to open_file() in open_file_ntcreate() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a77f28dcca23c4a9b16d64748a3e97c89fc7ff8d Author: Ralph Boehme <s...@samba.org> Date: Fri Apr 10 16:52:07 2020 +0200 smbd: remove redundant conn arg from open_file() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit dd4d4f812970173897dbf7ce8f9009eff7f04658 Author: Ralph Boehme <s...@samba.org> Date: Mon May 18 12:24:30 2020 +0200 smbd: assert (fsp->dirfsp == conn->cwd_fsp) in open_file_ntcreate() There's a bunch of stuff that needs updating to work with atnames. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4ae6e5f0548139cb824d49bc570f7d49b8d1bdb2 Author: Ralph Boehme <s...@samba.org> Date: Sat May 16 08:23:24 2020 +0200 smbd: set dirfsp in the SMB2 DH reconnect Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5a7ce143bcf8eb368a0c627a973d06f3c0664b68 Author: Ralph Boehme <s...@samba.org> Date: Thu May 7 16:52:20 2020 +0200 smbd: set fsp->dirfsp in create_file_unixpath() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 68b28275f066a03e9a7fe8b2582827bfb7a6c11b Author: Ralph Boehme <s...@samba.org> Date: Fri Apr 10 15:38:55 2020 +0200 smbd: use dirfsp in mkdir_internal() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 435a19eaa72a26c58316b03405bb6f11225bf081 Author: Ralph Boehme <s...@samba.org> Date: Mon May 18 12:09:32 2020 +0200 smbd: fix check_parent_access() args alignment in mkdir_internal() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 0591904bb8618cadbfd5d44eb6ff2513e8eda6e0 Author: Ralph Boehme <s...@samba.org> Date: Thu May 7 17:51:42 2020 +0200 smbd: fix SMB_VFS_MKDIRAT() arg alignment in mkdir_internal() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 31a4a3a5ca8cf72cb75e5b9d610b569cd01cea29 Author: Ralph Boehme <s...@samba.org> Date: Fri Apr 10 15:36:34 2020 +0200 smbd: pass dirfsp to mkdir_internal() Not really used for now and marked with SMB_ASSERT(dirfsp == conn->cwd_fsp) because it needs to be updated later to work with real dirfsp. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 0ca3f13b21d7036be031605da67097474a5d1b3b Author: Ralph Boehme <s...@samba.org> Date: Mon May 18 14:30:56 2020 +0200 smbd: set fsp->dirfsp in open_directory() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 67373681c5907a6dccbc63deedf458d1c6e448e3 Author: Ralph Boehme <s...@samba.org> Date: Mon May 18 17:07:53 2020 +0200 smbd: use dirfsp in open_directory() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 1f581fb384fc6e5751c6bdbc088e36d2c8888756 Author: Ralph Boehme <s...@samba.org> Date: Thu May 7 16:51:35 2020 +0200 smbd: pass dirfsp to open_directory() As the calls to * SMB_VFS_LSTAT() * get_share_mode_lock() and maybe others still have to be updated to work with atnames, we assert (dirfsp == conn->cwd_fsp). Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 227e14acd6df38290365ef649b06ad8a02cf4955 Author: Ralph Boehme <s...@samba.org> Date: Thu May 7 16:50:20 2020 +0200 smbd: realign args in calls to open_directory() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9f5fd73846931b7de90e1d5decf46a6e92cc6f21 Author: Ralph Boehme <s...@samba.org> Date: Thu May 7 16:32:10 2020 +0200 smbd: pass dirfsp to create_file_unixpath() As the calls to * lease_match() * open_streams_for_delete() * check_base_file_access * SMB_VFS_STAT and others needs to be updated to work with atnames in the future, we assert (dirfsp == conn->cwd_fsp). Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 12b2844571e50937542d543c7726bd855020b2e1 Author: Ralph Boehme <s...@samba.org> Date: Thu May 7 16:24:16 2020 +0200 smbd: realign create_file_unixpath() args Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 44cd415921158914bdb74513dde2391d09909b8c Author: Ralph Boehme <s...@samba.org> Date: Thu May 14 14:00:22 2020 +0200 smbd: add dirfsp arg to SMB_VFS_CREATE_FILE() As create_file_default() still need to be updated in the future to replace the SMB_VFS_STAT() calls with AT-based versions, it asserts (dirfsp == dirfsp->conn->cwd_fsp). Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a947b67d788a39fb37a9a00463227e2e642bc4ec Author: Ralph Boehme <s...@samba.org> Date: Mon May 18 14:37:18 2020 +0200 smbd: handling of fsp->dirfsps in close_file() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 1736ef26c753836a6c970d53ad1af69042c9cb2c Author: Ralph Boehme <s...@samba.org> Date: Mon Apr 6 15:41:41 2020 +0200 smbd: add flag "is_dirfsp" to the fsp_flags This denotes pure VFS layer dirfsps that are used in *AT varients of VFS interface functions and which bypass the FSA layer, requiring special handling in codepaths closing/freeing the fsp. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 373d02da7560ef6bbe54c9ed4eedcefbf34f3963 Author: Ralph Boehme <s...@samba.org> Date: Fri May 15 16:18:13 2020 +0200 vfs: add dirfsp to struct files_struct As fsp->fsp_name will be a AT-name in the future, we need something to retrieve the full path for an fsp from for stuff like fsp_str_dbg(). As there are functions like vfs_stat_fsp() that have internal fallbacks to path-based VFS functions if fsp->fh->fh == -1, having the original dirfsp as part of the fsp helps in converting the internal VFS functions to AT versions. In the future when all such internal fallbacks are eliminated we can remove fsp->dirfsp to avoid the additional fd per fsp and use a fsp->path or similar. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9557489478900c074d51bcb99f8b4be9920a0bf7 Author: Ralph Boehme <s...@samba.org> Date: Fri May 15 15:25:07 2020 +0200 smbd: move fstat from create_internal_dirfsp() to open_internal_dirfsp() The original idea of doing the fstat in create_internal_dirfsp() was to return from the function with a valid file_id and that requires valid stat info. However, as dirfsp->fh->fd will still be -1 at this point vfs_stat_fsp() will fallback to path-based stat() which must be avoided. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8883dacb1252c8dba554f666b3e38ebf039d68a5 Author: Ralph Boehme <s...@samba.org> Date: Fri May 15 15:14:26 2020 +0200 smbd: rename create_internal_dirfsp_at() to create_internal_dirfsp() Having removed the unused dirfsp parameter this is not an AT function. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 84cf205ff4358a2cd58053e05bf165801ebf16f6 Author: Ralph Boehme <s...@samba.org> Date: Fri May 15 15:14:26 2020 +0200 smbd: rename open_internal_dirfsp_at() to open_internal_dirfsp() Having removed the unused dirfsp parameter this is not an AT function. Security is provided by symlink safe fd_open(). Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit ef17a408c8a55397de26bb513163e7c172fbb1e7 Author: Ralph Boehme <s...@samba.org> Date: Thu May 14 17:08:15 2020 +0200 vfs_aio_pthread: avoid parent_smb_fname() opd->dname was only needed for debug messages, use opd->fsp_name for that. And opd->fname can be just made a copy of smb_fname. This avoids calling parent_smb_fname(). Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a30825f29ee32050b2506aa0b071c5446412ddc0 Author: Ralph Boehme <s...@samba.org> Date: Thu May 14 17:00:57 2020 +0200 vfs_aio_pthread: SMB_VFS_OPEN() is called with cwd=parent directory of the file Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit bd87aeb3d04f6b3a50c11b9c458deb912089997b Author: Ralph Boehme <s...@samba.org> Date: Thu May 14 16:52:16 2020 +0200 vfs_aio_pthread: pass smb_fname to create_private_open_data() Not yet used. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c51a8f36dabc4d59a7e9bd0727b42f049825cd68 Author: Ralph Boehme <s...@samba.org> Date: Thu May 14 16:50:40 2020 +0200 vfs_aio_pthread: pass smb_fname to open_async() Not yet used. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a6344334c07eebe607fc0f2af0673ef3289742bb Author: Ralph Boehme <s...@samba.org> Date: Thu May 14 18:38:51 2020 +0200 smbd: remove dirfsp arg from [create|open]_internal_dirfsp_at() These are the functions that *create* dirfsps, they can't *take* dirfsps as that would be recursive... Both functions just take a pathname and the internal opening of the underlying fd is secured from symlink races by our chdir("p/a/t/h") ; open(".", O_RDONLY); logic in non_widelink_open(). Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4c720a05f05148a573275fa64695b548269be177 Author: Ralph Boehme <s...@samba.org> Date: Tue Apr 14 21:07:24 2020 +0200 smbd: set fsp_name of conn->cwd_fsp Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 97d061237b0f2e07ae9c8e893734e222e58cfa4e Author: Ralph Boehme <s...@samba.org> Date: Tue Apr 7 18:41:15 2020 +0200 smbd: move conn_rootdir_fname to non_widelink_open() No change in behaviour. This just simplifies fd_open() a bit which will make it easier to add an fd_openat() later. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 15303ee19bce519d18758e7e6cb3aa8a539bab42 Author: Ralph Boehme <s...@samba.org> Date: Thu Apr 9 15:42:59 2020 +0200 smbd: prepare for replacing SMB_VFS_READLINKAT() with SMB_VFS_STATX() in the future Add a large comment inside process_symlink_open() explaining why we need to call SMB_VFS_READLINKAT(). As we don't make use of the returned name and just rely on SMB_VFS_REALPATH() doing its job, remove target_fname Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 60c47a5d13b1ce4b317f319ef4be42443fde50ee Author: Ralph Boehme <s...@samba.org> Date: Thu May 7 11:50:58 2020 +0200 smbd: remove unused variable twrp_name from filename_convert_internal() Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 0b31a9ce9a16de9158137cfc5f473917cd683875 Author: Ralph Boehme <s...@samba.org> Date: Tue Mar 31 18:57:55 2020 +0200 smbd: update function documentation header to match actual function argument names Leaving p_cont_wcard unchanges as updating that would break the nice indentation... :) Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit acffa8f406ed26752fcb45849c06f9c33a1ea570 Author: Ralph Boehme <s...@samba.org> Date: Thu Apr 9 18:24:26 2020 +0200 smbd: add open_flags arg to in open_internal_dirfsp_at() The only caller passes in what was used internally, so no change in behaviour. Prepares for calling open_internal_dirfsp_at() from filename_convert() with additional flags. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d60b1134b9ebb70d65ee3ab1f2ff39b723cb862e Author: Ralph Boehme <s...@samba.org> Date: Wed Mar 4 10:32:43 2020 +0100 smbd: exit early in the error case in fd_open() No change in behaviour. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit f1d204c5bac1ac490369e1acd1811330da02ab76 Author: Ralph Boehme <s...@samba.org> Date: Wed Mar 4 10:56:56 2020 +0100 smbd: refactor flags computation for fd_open() in open_directory() a bit No change in behaviour. A subsequent commit will optionally add an additional flag, this change allows for a smaller diff of that commit. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: examples/VFS/skel_opaque.c | 1 + examples/VFS/skel_transparent.c | 2 + source3/include/vfs.h | 7 + source3/include/vfs_macros.h | 8 +- source3/lib/adouble.c | 6 + source3/modules/vfs_aio_pthread.c | 64 ++++--- source3/modules/vfs_default.c | 3 +- source3/modules/vfs_fruit.c | 5 +- source3/modules/vfs_full_audit.c | 2 + source3/modules/vfs_media_harmony.c | 3 + source3/modules/vfs_not_implemented.c | 1 + source3/modules/vfs_shadow_copy2.c | 7 +- source3/modules/vfs_time_audit.c | 2 + source3/modules/vfs_unityed_media.c | 3 + source3/modules/vfs_worm.c | 3 +- source3/printing/nt_printing.c | 3 + source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 2 + source3/smbd/close.c | 20 +++ source3/smbd/conn.c | 10 ++ source3/smbd/dir.c | 5 +- source3/smbd/dosmode.c | 1 + source3/smbd/durable.c | 5 +- source3/smbd/filename.c | 5 +- source3/smbd/files.c | 54 +++--- source3/smbd/nttrans.c | 4 + source3/smbd/open.c | 284 ++++++++++++++++++------------ source3/smbd/proto.h | 18 +- source3/smbd/reply.c | 11 ++ source3/smbd/smb2_create.c | 1 + source3/smbd/smb2_query_directory.c | 2 +- source3/smbd/trans2.c | 8 + source3/smbd/vfs.c | 5 +- source3/utils/net_vfs.c | 1 + source3/wscript_build | 2 +- 34 files changed, 354 insertions(+), 204 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index cd04de0dab0..77bd471315e 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -200,6 +200,7 @@ static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname, static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirfsp, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index b95ba1b858d..5c758f2fc5f 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -208,6 +208,7 @@ static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname, static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirfsp, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -226,6 +227,7 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, { return SMB_VFS_NEXT_CREATE_FILE(handle, req, + dirfsp, smb_fname, access_mask, share_access, diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 4780d87c3c2..12d048f2138 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -320,6 +320,8 @@ * to struct smb_filename * Version 43 - Move SMB_VFS_GET_NT_ACL() -> SMB_VFS_GET_NT_ACL_AT(). * 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() */ #define SMB_VFS_INTERFACE_VERSION 43 @@ -377,6 +379,7 @@ typedef struct files_struct { struct smbXsrv_open *op; struct connection_struct *conn; struct fd_handle *fh; + struct files_struct *dirfsp; unsigned int num_smb_operations; struct file_id file_id; uint64_t initial_allocation_size; /* Faked up initial allocation on disk. */ @@ -394,6 +397,7 @@ typedef struct files_struct { bool can_write : 1; bool modified : 1; bool is_directory : 1; + bool is_dirfsp : 1; bool aio_write_behind : 1; bool initial_delete_on_close : 1; bool delete_on_close : 1; @@ -762,6 +766,7 @@ struct vfs_fn_pointers { int flags, mode_t mode); NTSTATUS (*create_file_fn)(struct vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirfsp, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -1273,6 +1278,7 @@ int smb_vfs_call_open(struct vfs_handle_struct *handle, int flags, mode_t mode); NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirfsp, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -1727,6 +1733,7 @@ int vfs_not_implemented_open(vfs_handle_struct *handle, 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, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 65de31af08d..5ab825ec312 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -147,14 +147,14 @@ #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) \ smb_vfs_call_open((handle)->next, (fname), (fsp), (flags), (mode)) -#define SMB_VFS_CREATE_FILE(conn, req, smb_fname, access_mask, share_access, create_disposition, \ +#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) \ - smb_vfs_call_create_file((conn)->vfs_handles, (req), (smb_fname), (access_mask), (share_access), (create_disposition), \ + smb_vfs_call_create_file((conn)->vfs_handles, (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)) -#define SMB_VFS_NEXT_CREATE_FILE(handle, req, smb_fname, access_mask, share_access, create_disposition, \ +#define SMB_VFS_NEXT_CREATE_FILE(handle, 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) \ - smb_vfs_call_create_file((handle)->next, (req), (smb_fname), (access_mask), (share_access), (create_disposition), \ + smb_vfs_call_create_file((handle)->next, (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/adouble.c b/source3/lib/adouble.c index 8e8b6a77503..f593759c9a6 100644 --- a/source3/lib/adouble.c +++ b/source3/lib/adouble.c @@ -1109,6 +1109,7 @@ static bool ad_convert_xattr(vfs_handle_struct *handle, status = SMB_VFS_CREATE_FILE( handle->conn, /* conn */ NULL, /* req */ + &handle->conn->cwd_fsp, /* dirfsp */ stream_name, /* fname */ FILE_GENERIC_WRITE, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ @@ -1238,6 +1239,7 @@ static bool ad_convert_finderinfo(vfs_handle_struct *handle, status = SMB_VFS_CREATE_FILE( handle->conn, /* conn */ NULL, /* req */ + &handle->conn->cwd_fsp, /* dirfsp */ stream_name, /* fname */ FILE_GENERIC_WRITE, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ @@ -1468,6 +1470,7 @@ static bool ad_unconvert_open_ad(TALLOC_CTX *mem_ctx, status = SMB_VFS_CREATE_FILE( handle->conn, NULL, /* req */ + &handle->conn->cwd_fsp, /* dirfsp */ adpath, FILE_READ_DATA|FILE_WRITE_DATA, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, @@ -1519,6 +1522,7 @@ static bool ad_unconvert_get_streams(struct vfs_handle_struct *handle, status = SMB_VFS_CREATE_FILE( handle->conn, /* conn */ NULL, /* req */ + &handle->conn->cwd_fsp, /* dirfsp */ smb_fname, /* fname */ FILE_READ_ATTRIBUTES, /* access_mask */ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ @@ -1618,6 +1622,7 @@ static bool ad_collect_one_stream(struct vfs_handle_struct *handle, status = SMB_VFS_CREATE_FILE( handle->conn, NULL, /* req */ + &handle->conn->cwd_fsp, /* dirfsp */ sname, FILE_READ_DATA|DELETE_ACCESS, FILE_SHARE_READ, @@ -2079,6 +2084,7 @@ static int ad_open_rsrc(vfs_handle_struct *handle, status = SMB_VFS_CREATE_FILE( handle->conn, /* conn */ NULL, /* req */ + &handle->conn->cwd_fsp, /* dirfsp */ adp_smb_fname, access_mask, share_access, diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c index 45b59bcb813..65a7c28e7b3 100644 --- a/source3/modules/vfs_aio_pthread.c +++ b/source3/modules/vfs_aio_pthread.c @@ -48,8 +48,8 @@ struct aio_open_private_data { mode_t mode; uint64_t mid; bool in_progress; - struct smb_filename *dname; - struct smb_filename *fname; + struct smb_filename *fsp_name; + struct smb_filename *smb_fname; connection_struct *conn; struct smbXsrv_connection *xconn; const struct security_unix_token *ux_tok; @@ -110,9 +110,8 @@ static void aio_open_handle_completion(struct tevent_req *subreq) * to the NULL context, so just free it so we * don't leak memory. */ - DBG_NOTICE("aio open request for %s/%s abandoned in flight\n", - opd->dname->base_name, - opd->fname->base_name); + DBG_NOTICE("aio open request for %s abandoned in flight\n", + opd->fsp_name->base_name); if (opd->ret_fd != -1) { close(opd->ret_fd); opd->ret_fd = -1; @@ -152,10 +151,9 @@ static void aio_open_handle_completion(struct tevent_req *subreq) } DEBUG(10,("aio_open_handle_completion: mid %llu " - "for file %s/%s completed\n", + "for file %s completed\n", (unsigned long long)opd->mid, - opd->dname->base_name, - opd->fname->base_name)); + opd->fsp_name->base_name)); opd->in_progress = false; @@ -202,7 +200,7 @@ static void aio_open_worker(void *private_data) static void aio_open_do(struct aio_open_private_data *opd) { opd->ret_fd = openat(opd->dir_fd, - opd->fname->base_name, + opd->smb_fname->base_name, opd->flags, opd->mode); @@ -249,13 +247,13 @@ static void opd_free(struct aio_open_private_data *opd) ***********************************************************************/ 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) { struct aio_open_private_data *opd = talloc_zero(ctx, struct aio_open_private_data); - bool ok; if (!opd) { return NULL; @@ -287,22 +285,24 @@ static struct aio_open_private_data *create_private_open_data(TALLOC_CTX *ctx, } /* - * Copy the parent directory name and the - * relative path within it. + * Copy the full fsp_name and smb_fname which is the basename. */ - ok = parent_smb_fname(opd, - fsp->fsp_name, - &opd->dname, - &opd->fname); - if (!ok) { + opd->smb_fname = cp_smb_filename(opd, smb_fname); + if (opd->smb_fname == NULL) { + opd_free(opd); + return NULL; + } + + opd->fsp_name = cp_smb_filename(opd, fsp->fsp_name); + if (opd->fsp_name == NULL) { opd_free(opd); return NULL; } #if defined(O_DIRECTORY) - opd->dir_fd = open(opd->dname->base_name, O_RDONLY|O_DIRECTORY); + opd->dir_fd = open(".", O_RDONLY|O_DIRECTORY); #else - opd->dir_fd = open(opd->dname->base_name, O_RDONLY); + opd->dir_fd = open(".", O_RDONLY); #endif if (opd->dir_fd == -1) { opd_free(opd); @@ -321,9 +321,8 @@ static int opd_inflight_destructor(struct aio_open_private_data *opd) * down which kills the fsp that owns * opd. */ - DBG_NOTICE("aio open request for %s/%s cancelled\n", - opd->dname->base_name, - opd->fname->base_name); + DBG_NOTICE("aio open request for %s cancelled\n", + opd->fsp_name->base_name); opd->conn = NULL; /* Don't let opd go away. */ return -1; @@ -333,9 +332,10 @@ static int opd_inflight_destructor(struct aio_open_private_data *opd) Setup an async open. *****************************************************************/ -static int open_async(const files_struct *fsp, - int flags, - mode_t mode) +static int open_async(const struct smb_filename *smb_fname, + const files_struct *fsp, + int flags, + mode_t mode) { struct aio_open_private_data *opd = NULL; struct tevent_req *subreq = NULL; @@ -351,7 +351,7 @@ static int open_async(const files_struct *fsp, * opd is always safely freed in all codepath so no * memory leaks. */ - opd = create_private_open_data(fsp->conn, fsp, flags, mode); + opd = create_private_open_data(fsp->conn, smb_fname, fsp, flags, mode); if (opd == NULL) { DEBUG(10, ("open_async: Could not create private data.\n")); return -1; @@ -367,10 +367,9 @@ static int open_async(const files_struct *fsp, } tevent_req_set_callback(subreq, aio_open_handle_completion, opd); - DEBUG(5,("open_async: mid %llu created for file %s/%s\n", + DEBUG(5,("open_async: mid %llu created for file %s\n", (unsigned long long)opd->mid, - opd->dname->base_name, - opd->fname->base_name)); + opd->fsp_name->base_name)); /* * Add a destructor to protect us from connection @@ -402,10 +401,9 @@ static bool find_completed_open(files_struct *fsp, if (opd->in_progress) { DEBUG(0,("find_completed_open: mid %llu " "still in progress for " - "file %s/%s. PANIC !\n", + "file %s. PANIC !\n", (unsigned long long)opd->mid, - opd->dname->base_name, - opd->fname->base_name)); + opd->fsp_name->base_name)); /* Disaster ! This is an open timeout. Just panic. */ smb_panic("find_completed_open - in_progress\n"); /* notreached. */ @@ -479,7 +477,7 @@ 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(fsp, flags, mode); + return open_async(smb_fname, fsp, flags, mode); } #endif diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 5512938d6a6..054f6022b48 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -690,6 +690,7 @@ static int vfswrap_open(vfs_handle_struct *handle, static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirfsp, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -707,7 +708,7 @@ static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle, const struct smb2_create_blobs *in_context_blobs, struct smb2_create_blobs *out_context_blobs) { - return create_file_default(handle->conn, req, smb_fname, + return create_file_default(handle->conn, req, dirfsp, smb_fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, lease, diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 7d77393e99a..2cd5b4334ab 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -898,6 +898,7 @@ static bool readdir_attr_meta_finderi_stream( status = SMB_VFS_CREATE_FILE( handle->conn, /* conn */ NULL, /* req */ + &handle->conn->cwd_fsp, /* dirfsp */ stream_name, /* fname */ FILE_READ_DATA, /* access_mask */ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ @@ -3883,6 +3884,7 @@ static int fruit_ftruncate(struct vfs_handle_struct *handle, static NTSTATUS fruit_create_file(vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirfsp, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -3937,7 +3939,7 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle, } status = SMB_VFS_NEXT_CREATE_FILE( - handle, req, smb_fname, + handle, req, dirfsp, smb_fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, @@ -4702,6 +4704,7 @@ static bool fruit_get_bandsize(vfs_handle_struct *handle, status = SMB_VFS_NEXT_CREATE_FILE( handle, /* conn */ NULL, /* req */ + &handle->conn->cwd_fsp, /* dirfsp */ smb_fname, /* fname */ FILE_GENERIC_READ, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 07bbfcce9a7..e7204767f3e 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1093,6 +1093,7 @@ static int smb_full_audit_open(vfs_handle_struct *handle, static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirfsp, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -1139,6 +1140,7 @@ static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle, result = SMB_VFS_NEXT_CREATE_FILE( handle, /* handle */ req, /* req */ + dirfsp, smb_fname, /* fname */ access_mask, /* access_mask */ share_access, /* share_access */ diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index cb1b1398214..fc4426754a1 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -1105,6 +1105,7 @@ out: */ static NTSTATUS mh_create_file(vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirfsp, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -1134,6 +1135,7 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle, status = SMB_VFS_NEXT_CREATE_FILE( handle, req, + dirfsp, smb_fname, access_mask, share_access, @@ -1172,6 +1174,7 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle, status = SMB_VFS_NEXT_CREATE_FILE( handle, req, + dirfsp, clientFname, access_mask, share_access, diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c index 0cb59abcb31..1523ea565f6 100644 --- a/source3/modules/vfs_not_implemented.c +++ b/source3/modules/vfs_not_implemented.c @@ -198,6 +198,7 @@ int vfs_not_implemented_open(vfs_handle_struct *handle, NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirsp, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 6fdf1bcfb86..51c1a5ebc06 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -1956,10 +1956,9 @@ static int shadow_copy2_get_shadow_copy_data( goto done; } - status = create_internal_dirfsp_at(handle->conn, - handle->conn->cwd_fsp, - snapdir_smb_fname, - &dirfsp); + status = create_internal_dirfsp(handle->conn, + snapdir_smb_fname, + &dirfsp); if (!NT_STATUS_IS_OK(status)) { DBG_WARNING("create_internal_dir_fsp() failed for '%s'" " - %s\n", snapdir, nt_errstr(status)); diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index a442e5af315..01b9e987065 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -607,6 +607,7 @@ static int smb_time_audit_open(vfs_handle_struct *handle, static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirfsp, struct smb_filename *fname, uint32_t access_mask, uint32_t share_access, @@ -632,6 +633,7 @@ static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle, result = SMB_VFS_NEXT_CREATE_FILE( handle, /* handle */ req, /* req */ + dirfsp, /* dirfsp */ fname, /* fname */ access_mask, /* access_mask */ share_access, /* share_access */ diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c index 70db8f182d1..e026f9e9398 100644 --- a/source3/modules/vfs_unityed_media.c +++ b/source3/modules/vfs_unityed_media.c @@ -826,6 +826,7 @@ err: static NTSTATUS um_create_file(vfs_handle_struct *handle, struct smb_request *req, + struct files_struct **dirfsp, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -853,6 +854,7 @@ static NTSTATUS um_create_file(vfs_handle_struct *handle, return SMB_VFS_NEXT_CREATE_FILE( handle, req, -- Samba Shared Repository