From: Jeremy Allison Date: Thu, 26 Mar 2020 22:48:08 +0000 (-0700) Subject: s3: smbd: Use get_original_lcomp() inside reply_ntrename(). X-Git-Tag: ldb-2.2.0~1150 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d2cb52163baed3cfd5e7f16cb42d513371d4cbf;p=thirdparty%2Fsamba.git s3: smbd: Use get_original_lcomp() inside reply_ntrename(). Pass to rename_internals(). Removes one more use of the struct member original_lcomp. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 229232244c4..670711ff79b 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -1585,6 +1585,7 @@ void reply_ntrename(struct smb_request *req) struct smb_filename *smb_fname_new = NULL; char *oldname = NULL; char *newname = NULL; + const char *dst_original_lcomp = NULL; const char *p; NTSTATUS status; bool src_has_wcard = False; @@ -1685,6 +1686,16 @@ void reply_ntrename(struct smb_request *req) goto out; } + /* Get the last component of the destination for rename_internals(). */ + dst_original_lcomp = get_original_lcomp(ctx, + conn, + newname, + ucf_flags_dst); + if (dst_original_lcomp == NULL) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + goto out; + } + if (stream_rename) { /* smb_fname_new must be the same as smb_fname_old. */ TALLOC_FREE(smb_fname_new->base_name); @@ -1707,7 +1718,7 @@ void reply_ntrename(struct smb_request *req) req, smb_fname_old, smb_fname_new, - smb_fname_new->original_lcomp, + dst_original_lcomp, attrs, false, src_has_wcard,