From 454ecaf3b4b26619f5a82b265a9f3bb65b8967a2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 25 Mar 2020 16:20:23 -0700 Subject: [PATCH] s3: smbd: Add a dst_original_lcomp parameter to rename_internals_fsp(). Currently passed in as dst_fname->original_lcomp in all callers but will eventually be converted to allow original_lcomp to be removed from struct smb_filename. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/proto.h | 1 + source3/smbd/reply.c | 11 +++++++---- source3/smbd/trans2.c | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 12d0753ae5f..d6d85e12a61 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -1018,6 +1018,7 @@ void reply_rmdir(struct smb_request *req); NTSTATUS rename_internals_fsp(connection_struct *conn, files_struct *fsp, const struct smb_filename *smb_fname_dst_in, + const char *dst_original_lcomp, uint32_t attrs, bool replace_if_exists); NTSTATUS rename_internals(TALLOC_CTX *ctx, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index cea2334ca73..31ef904d65b 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -7575,6 +7575,7 @@ static NTSTATUS parent_dirname_compatible_open(connection_struct *conn, NTSTATUS rename_internals_fsp(connection_struct *conn, files_struct *fsp, const struct smb_filename *smb_fname_dst_in, + const char *dst_original_lcomp, uint32_t attrs, bool replace_if_exists) { @@ -7627,7 +7628,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, /* * Split off the last component of the processed * destination name. We will compare this to - * the split components of smb_fname_dst->original_lcomp. + * the split components of dst_original_lcomp. */ if (!parent_dirname(ctx, smb_fname_dst->base_name, @@ -7638,7 +7639,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, } /* - * The original_lcomp component contains + * The dst_original_lcomp component contains * the last_component of the path + stream * name (if a stream exists). * @@ -7649,13 +7650,13 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, if (fsp->posix_flags & FSP_POSIX_FLAGS_PATHNAMES) { /* POSIX - no stream component. */ orig_lcomp_path = talloc_strdup(ctx, - smb_fname_dst->original_lcomp); + dst_original_lcomp); if (orig_lcomp_path == NULL) { ok = false; } } else { ok = split_stream_filename(ctx, - smb_fname_dst->original_lcomp, + dst_original_lcomp, &orig_lcomp_path, &orig_lcomp_stream); } @@ -8064,6 +8065,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, status = rename_internals_fsp(conn, fsp, smb_fname_dst, + smb_fname_dst->original_lcomp, attrs, replace_if_exists); @@ -8235,6 +8237,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, status = rename_internals_fsp(conn, fsp, smb_fname_dst, + smb_fname_dst->original_lcomp, attrs, replace_if_exists); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 0fb2284be36..70d45bf7654 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -7177,6 +7177,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn, status = rename_internals_fsp(conn, fsp, smb_fname_dst, + smb_fname_dst->original_lcomp, (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM), overwrite); @@ -7449,6 +7450,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn, status = rename_internals_fsp(conn, fsp, smb_fname_dst, + smb_fname_dst->original_lcomp, 0, overwrite); } else { -- 2.34.1