From 71c4c96d97888588b78bddee495106ac08745fb2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 28 Sep 2020 20:47:42 -0700 Subject: [PATCH] s3: smbd: SMB1 reply_ntrename() - Move the call to get_original_lcomp() to before filename_convert() for the destination name. Simple code re-arrangement to make the next change clear. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/nttrans.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index ae116218ad7..7ab1c5d178d 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -1786,6 +1786,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; + } + status = filename_convert(ctx, conn, newname, ucf_flags_dst, @@ -1804,16 +1814,6 @@ 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); -- 2.47.3