From f4b48729823b0a32d53abaeba2bbafa54a36a11c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Mar 2016 14:16:13 -0800 Subject: [PATCH] s3: smbd: Change open_streams_for_delete() to take a struct smb_filename *. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Prepare for changing vfs_streaminfo to do the same. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Mon Mar 7 21:12:56 CET 2016 on sn-devel-144 --- examples/VFS/skel_opaque.c | 2 +- examples/VFS/skel_transparent.c | 9 ++++--- source3/include/vfs.h | 6 +++-- source3/include/vfs_macros.h | 8 +++---- source3/modules/vfs_catia.c | 21 ++++++++++++---- source3/modules/vfs_default.c | 15 ++++++------ source3/modules/vfs_fruit.c | 19 ++++----------- source3/modules/vfs_full_audit.c | 6 ++--- source3/modules/vfs_media_harmony.c | 37 ++++++++++++++--------------- source3/modules/vfs_streams_depot.c | 16 +++++++++---- source3/modules/vfs_streams_xattr.c | 29 +++++++++++++--------- source3/modules/vfs_time_audit.c | 4 ++-- source3/modules/vfs_unityed_media.c | 19 ++++++++------- source3/smbd/close.c | 2 +- source3/smbd/filename.c | 2 +- source3/smbd/nttrans.c | 4 ++-- source3/smbd/open.c | 2 +- source3/smbd/proto.h | 2 +- source3/smbd/trans2.c | 8 +++++-- source3/smbd/vfs.c | 13 ++++++---- 20 files changed, 128 insertions(+), 96 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 457881dc8be..67c387d83df 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -579,7 +579,7 @@ static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle, static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 55b1ed60c62..9fc943819d6 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -699,14 +699,17 @@ static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle, static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams) { return SMB_VFS_NEXT_STREAMINFO(handle, - fsp, - fname, mem_ctx, num_streams, streams); + fsp, + smb_fname, + mem_ctx, + num_streams, + streams); } static int skel_get_real_filename(struct vfs_handle_struct *handle, diff --git a/source3/include/vfs.h b/source3/include/vfs.h index e77d702d742..1c6bc2f8fa2 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -188,6 +188,8 @@ const struct smb_filename * */ /* Version 35 - Change lchown from const char *, to const struct smb_filename * */ +/* Version 35 - Change streaminfo from const char *, to + const struct smb_filename * */ #define SMB_VFS_INTERFACE_VERSION 35 @@ -721,7 +723,7 @@ struct vfs_fn_pointers { NTSTATUS (*streaminfo_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams); @@ -1153,7 +1155,7 @@ struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle, const SMB_STRUCT_STAT *sbuf); NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index ae2ba1b797f..6059c2ab1a6 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -346,10 +346,10 @@ #define SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf) \ smb_vfs_call_file_id_create((handle)->next, (sbuf)) -#define SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) \ - smb_vfs_call_streaminfo((conn)->vfs_handles, (fsp), (fname), (mem_ctx), (num_streams), (streams)) -#define SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, num_streams, streams) \ - smb_vfs_call_streaminfo((handle)->next, (fsp), (fname), (mem_ctx), (num_streams), (streams)) +#define SMB_VFS_STREAMINFO(conn, fsp, smb_fname, mem_ctx, num_streams, streams) \ + smb_vfs_call_streaminfo((conn)->vfs_handles, (fsp), (smb_fname), (mem_ctx), (num_streams), (streams)) +#define SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx, num_streams, streams) \ + smb_vfs_call_streaminfo((handle)->next, (fsp), (smb_fname), (mem_ctx), (num_streams), (streams)) #define SMB_VFS_GET_REAL_FILENAME(conn, path, name, mem_ctx, found_name) \ smb_vfs_call_get_real_filename((conn)->vfs_handles, (path), (name), (mem_ctx), (found_name)) diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 4a988b9b3a6..e2b4eb5745e 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -792,7 +792,7 @@ static int catia_chflags(struct vfs_handle_struct *handle, static NTSTATUS catia_streaminfo(struct vfs_handle_struct *handle, struct files_struct *fsp, - const char *path, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *_num_streams, struct stream_struct **_streams) @@ -800,22 +800,35 @@ catia_streaminfo(struct vfs_handle_struct *handle, char *mapped_name = NULL; NTSTATUS status; int i; + struct smb_filename *catia_smb_fname = NULL; unsigned int num_streams = 0; struct stream_struct *streams = NULL; *_num_streams = 0; *_streams = NULL; - status = catia_string_replace_allocate(handle->conn, path, - &mapped_name, vfs_translate_to_unix); + status = catia_string_replace_allocate(handle->conn, + smb_fname->base_name, + &mapped_name, + vfs_translate_to_unix); if (!NT_STATUS_IS_OK(status)) { errno = map_errno_from_nt_status(status); return status; } - status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, mapped_name, + catia_smb_fname = synthetic_smb_fname(talloc_tos(), + mapped_name, + NULL, + NULL); + if (catia_smb_fname == NULL) { + TALLOC_FREE(mapped_name); + return NT_STATUS_NO_MEMORY; + } + + status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, catia_smb_fname, mem_ctx, &num_streams, &streams); TALLOC_FREE(mapped_name); + TALLOC_FREE(catia_smb_fname); if (!NT_STATUS_IS_OK(status)) { return status; } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 4de965e239c..ee9ddb20e5f 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2186,7 +2186,7 @@ static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle, static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *pnum_streams, struct stream_struct **pstreams) @@ -2206,17 +2206,18 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle, ret = SMB_VFS_FSTAT(fsp, &sbuf); } else { - struct smb_filename smb_fname; + struct smb_filename smb_fname_cp; - ZERO_STRUCT(smb_fname); - smb_fname.base_name = discard_const_p(char, fname); + ZERO_STRUCT(smb_fname_cp); + smb_fname_cp.base_name = discard_const_p(char, + smb_fname->base_name); if (lp_posix_pathnames()) { - ret = SMB_VFS_LSTAT(handle->conn, &smb_fname); + ret = SMB_VFS_LSTAT(handle->conn, &smb_fname_cp); } else { - ret = SMB_VFS_STAT(handle->conn, &smb_fname); + ret = SMB_VFS_STAT(handle->conn, &smb_fname_cp); } - sbuf = smb_fname.st; + sbuf = smb_fname_cp.st; } if (ret == -1) { diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index e0d1fae06d6..0c742861d76 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -3168,24 +3168,18 @@ exit: static NTSTATUS fruit_streaminfo(vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *pnum_streams, struct stream_struct **pstreams) { struct fruit_config_data *config = NULL; - struct smb_filename *smb_fname = NULL; struct adouble *ad = NULL; NTSTATUS status; SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data, return NT_STATUS_UNSUCCESSFUL); - DEBUG(10, ("fruit_streaminfo called for %s\n", fname)); - - smb_fname = synthetic_smb_fname(talloc_tos(), fname, NULL, NULL); - if (smb_fname == NULL) { - return NT_STATUS_NO_MEMORY; - } + DEBUG(10, ("fruit_streaminfo called for %s\n", smb_fname->base_name)); if (config->meta == FRUIT_META_NETATALK) { ad = ad_get(talloc_tos(), handle, @@ -3197,7 +3191,6 @@ static NTSTATUS fruit_streaminfo(vfs_handle_struct *handle, smb_roundup(handle->conn, AFP_INFO_SIZE))) { TALLOC_FREE(ad); - TALLOC_FREE(smb_fname); return NT_STATUS_NO_MEMORY; } } @@ -3216,16 +3209,13 @@ static NTSTATUS fruit_streaminfo(vfs_handle_struct *handle, ad_getentrylen( ad, ADEID_RFORK)))) { TALLOC_FREE(ad); - TALLOC_FREE(smb_fname); return NT_STATUS_NO_MEMORY; } } TALLOC_FREE(ad); } - TALLOC_FREE(smb_fname); - - status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, + status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx, pnum_streams, pstreams); if (!NT_STATUS_IS_OK(status)) { return status; @@ -3236,7 +3226,6 @@ static NTSTATUS fruit_streaminfo(vfs_handle_struct *handle, if (!del_fruit_stream(mem_ctx, pnum_streams, pstreams, ":" NETATALK_META_XATTR ":$DATA")) { TALLOC_FREE(ad); - TALLOC_FREE(smb_fname); return NT_STATUS_NO_MEMORY; } } @@ -3792,7 +3781,7 @@ static void fruit_copy_chunk_done(struct tevent_req *subreq) * because streams are few and small. */ status = vfs_streaminfo(state->handle->conn, state->src_fsp, - state->src_fsp->fsp_name->base_name, + state->src_fsp->fsp_name, req, &num_streams, &streams); if (tevent_req_nterror(req, status)) { return; diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index d29064b00d1..691b1e14deb 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1674,18 +1674,18 @@ static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *ha static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *pnum_streams, struct stream_struct **pstreams) { NTSTATUS result; - result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, + result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx, pnum_streams, pstreams); do_log(SMB_VFS_OP_STREAMINFO, NT_STATUS_IS_OK(result), handle, - "%s", fname); + "%s", smb_fname->base_name); return result; } diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index 67e2541c123..2ae6c4a96a1 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -1962,43 +1962,42 @@ out: */ static NTSTATUS mh_streaminfo(struct vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *ctx, unsigned int *num_streams, struct stream_struct **streams) { NTSTATUS status; - char *clientPath; - TALLOC_CTX *mem_ctx; + int ret; + struct smb_filename *clientFname = NULL; DEBUG(MH_INFO_DEBUG, ("Entering mh_streaminfo\n")); - if (!is_in_media_files(fname)) - { - status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, - ctx, num_streams, streams); + if (!is_in_media_files(smb_fname->base_name)) { + status = SMB_VFS_NEXT_STREAMINFO(handle, + fsp, + smb_fname, + ctx, + num_streams, + streams); goto out; } - clientPath = NULL; - mem_ctx = talloc_tos(); - - if (alloc_get_client_path(handle, mem_ctx, - fname, - &clientPath)) - { - status = map_nt_error_from_unix(errno); + ret = alloc_get_client_smb_fname(handle, + talloc_tos(), + smb_fname, + &clientFname); + if (ret != 0) { + status = NT_STATUS_NO_MEMORY; goto err; } /* This only works on files, so we don't have to worry about * our fake directory stat'ing here. */ - // But what does this function do, exactly? Does it need - // extra modifications for the Avid stuff? - status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, clientPath, + status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, clientFname, ctx, num_streams, streams); err: - TALLOC_FREE(clientPath); + TALLOC_FREE(clientFname); out: return status; } diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index d998dc51a34..ef5ef64dfa0 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -911,17 +911,20 @@ static bool collect_one_stream(const char *dirname, static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *pnum_streams, struct stream_struct **pstreams) { - struct smb_filename *smb_fname_base; + struct smb_filename *smb_fname_base = NULL; int ret; NTSTATUS status; struct streaminfo_state state; - smb_fname_base = synthetic_smb_fname(talloc_tos(), fname, NULL, NULL); + smb_fname_base = synthetic_smb_fname(talloc_tos(), + smb_fname->base_name, + NULL, + NULL); if (smb_fname_base == NULL) { return NT_STATUS_NO_MEMORY; } @@ -975,7 +978,12 @@ static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle, *pnum_streams = state.num_streams; *pstreams = state.streams; - status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams); + status = SMB_VFS_NEXT_STREAMINFO(handle, + fsp, + smb_fname_base, + mem_ctx, + pnum_streams, + pstreams); out: TALLOC_FREE(smb_fname_base); diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index b54809f134e..3887d9ffce8 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -811,7 +811,7 @@ static bool collect_one_stream(struct ea_struct *ea, void *private_data) static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *pnum_streams, struct stream_struct **pstreams) @@ -825,19 +825,21 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle, ret = SMB_VFS_FSTAT(fsp, &sbuf); } else { - struct smb_filename *smb_fname = NULL; - smb_fname = synthetic_smb_fname(talloc_tos(), fname, NULL, - NULL); - if (smb_fname == NULL) { + struct smb_filename *smb_fname_base = NULL; + smb_fname_base = synthetic_smb_fname(talloc_tos(), + smb_fname->base_name, + NULL, + NULL); + if (smb_fname_base == NULL) { return NT_STATUS_NO_MEMORY; } if (lp_posix_pathnames()) { - ret = SMB_VFS_LSTAT(handle->conn, smb_fname); + ret = SMB_VFS_LSTAT(handle->conn, smb_fname_base); } else { - ret = SMB_VFS_STAT(handle->conn, smb_fname); + ret = SMB_VFS_STAT(handle->conn, smb_fname_base); } - sbuf = smb_fname->st; - TALLOC_FREE(smb_fname); + sbuf = smb_fname_base->st; + TALLOC_FREE(smb_fname_base); } if (ret == -1) { @@ -860,7 +862,7 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle, */ status = NT_STATUS_OK; } else { - status = walk_xattr_streams(handle, fsp, fname, + status = walk_xattr_streams(handle, fsp, smb_fname->base_name, collect_one_stream, &state); } @@ -877,7 +879,12 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle, *pnum_streams = state.num_streams; *pstreams = state.streams; - return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams); + return SMB_VFS_NEXT_STREAMINFO(handle, + fsp, + smb_fname, + mem_ctx, + pnum_streams, + pstreams); } static uint32_t streams_xattr_fs_capabilities(struct vfs_handle_struct *handle, diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 30dae9814df..3bdc98b4fd6 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1533,7 +1533,7 @@ static struct file_id smb_time_audit_file_id_create(struct vfs_handle_struct *ha static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *pnum_streams, struct stream_struct **pstreams) @@ -1543,7 +1543,7 @@ static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle, double timediff; clock_gettime_mono(&ts1); - result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, + result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx, pnum_streams, pstreams); clock_gettime_mono(&ts2); timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c index d46b376099f..7544b8fdfa0 100644 --- a/source3/modules/vfs_unityed_media.c +++ b/source3/modules/vfs_unityed_media.c @@ -1489,26 +1489,27 @@ err: static NTSTATUS um_streaminfo(struct vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *ctx, unsigned int *num_streams, struct stream_struct **streams) { NTSTATUS status; - char *client_path = NULL; int ret; + struct smb_filename *client_fname = NULL; DEBUG(10, ("Entering um_streaminfo\n")); - if (!is_in_media_files(fname)) { - return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, + if (!is_in_media_files(smb_fname->base_name)) { + return SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, ctx, num_streams, streams); } - ret = alloc_get_client_path(handle, talloc_tos(), - fname, &client_path); + ret = alloc_get_client_smb_fname(handle, + talloc_tos(), + smb_fname, + &client_fname); if (ret != 0) { - status = map_nt_error_from_unix(errno); goto err; } @@ -1518,10 +1519,10 @@ static NTSTATUS um_streaminfo(struct vfs_handle_struct *handle, * function do, exactly? Does it need extra modifications for * the Avid stuff? */ - status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, client_path, + status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, client_fname, ctx, num_streams, streams); err: - TALLOC_FREE(client_path); + TALLOC_FREE(client_fname); return status; } diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 144998f3ebd..3b887c86385 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -170,7 +170,7 @@ NTSTATUS delete_all_streams(connection_struct *conn, TALLOC_CTX *frame = talloc_stackframe(); NTSTATUS status; - status = vfs_streaminfo(conn, NULL, smb_fname->base_name, talloc_tos(), + status = vfs_streaminfo(conn, NULL, smb_fname, talloc_tos(), &num_streams, &stream_info); if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) { diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 86f66860f5b..14eb53f3146 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -1315,7 +1315,7 @@ static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx, } /* Fall back to a case-insensitive scan of all streams on the file. */ - status = vfs_streaminfo(conn, NULL, smb_fname->base_name, mem_ctx, + status = vfs_streaminfo(conn, NULL, smb_fname, mem_ctx, &num_streams, &streams); if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 75b283e7999..c6ad095919b 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -698,7 +698,7 @@ void reply_ntcreate_and_X(struct smb_request *req) if (NT_STATUS_IS_OK(status) && num_names) { file_status &= ~NO_EAS; } - status = vfs_streaminfo(conn, NULL, smb_fname->base_name, ctx, + status = vfs_streaminfo(conn, NULL, smb_fname, ctx, &num_streams, &streams); /* There is always one stream, ::$DATA. */ if (NT_STATUS_IS_OK(status) && num_streams > 1) { @@ -1337,7 +1337,7 @@ static void call_nt_transact_create(connection_struct *conn, if (NT_STATUS_IS_OK(status) && num_names) { file_status &= ~NO_EAS; } - status = vfs_streaminfo(conn, NULL, smb_fname->base_name, ctx, + status = vfs_streaminfo(conn, NULL, smb_fname, ctx, &num_streams, &streams); /* There is always one stream, ::$DATA. */ if (NT_STATUS_IS_OK(status) && num_streams > 1) { diff --git a/source3/smbd/open.c b/source3/smbd/open.c index a80d2e643c2..baebd7c5f2b 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3859,7 +3859,7 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn, TALLOC_CTX *frame = talloc_stackframe(); NTSTATUS status; - status = vfs_streaminfo(conn, NULL, smb_fname->base_name, talloc_tos(), + status = vfs_streaminfo(conn, NULL, smb_fname, talloc_tos(), &num_streams, &stream_info); if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED) diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index a859cb6a966..e1ec063226f 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -1215,7 +1215,7 @@ NTSTATUS vfs_stat_fsp(files_struct *fsp); NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid); NTSTATUS vfs_streaminfo(connection_struct *conn, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 8cd03c49900..b1eb9a9d2af 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -5180,8 +5180,12 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, return NT_STATUS_INVALID_PARAMETER; } - status = vfs_streaminfo(conn, fsp, smb_fname->base_name, - talloc_tos(), &num_streams, &streams); + status = vfs_streaminfo(conn, + fsp, + smb_fname, + talloc_tos(), + &num_streams, + &streams); if (!NT_STATUS_IS_OK(status)) { DEBUG(10, ("could not get stream info: %s\n", diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 19f75d17cc0..a1154aee784 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -1365,14 +1365,19 @@ NTSTATUS vfs_stat_fsp(files_struct *fsp) */ NTSTATUS vfs_streaminfo(connection_struct *conn, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams) { *num_streams = 0; *streams = NULL; - return SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams); + return SMB_VFS_STREAMINFO(conn, + fsp, + smb_fname, + mem_ctx, + num_streams, + streams); } /* @@ -2124,13 +2129,13 @@ struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle, NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle, struct files_struct *fsp, - const char *fname, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams) { VFS_FIND(streaminfo); - return handle->fns->streaminfo_fn(handle, fsp, fname, mem_ctx, + return handle->fns->streaminfo_fn(handle, fsp, smb_fname, mem_ctx, num_streams, streams); } -- 2.34.1