From acff075a725118d42dc61b64c5ddb6f3178baf2f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 2 Aug 2022 14:16:15 -0700 Subject: [PATCH] s3: smbd: In reply_ntrename(), move the call to get_original_lcomp(..newname..) after the call to extract_snapshot_token(..newname..). This was the last case where the snapshot TWRP token could be passed into get_original_lcomp(). get_original_lcomp() can now be changed to ignore TWRP tokens. Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- source3/smbd/smb1_nttrans.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source3/smbd/smb1_nttrans.c b/source3/smbd/smb1_nttrans.c index aa346a91ced..05f341ae505 100644 --- a/source3/smbd/smb1_nttrans.c +++ b/source3/smbd/smb1_nttrans.c @@ -1489,16 +1489,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) { /* * No point in calling filename_convert() @@ -1543,6 +1533,17 @@ void reply_ntrename(struct smb_request *req) } } + /* 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; + } + + DEBUG(3,("reply_ntrename: %s -> %s\n", smb_fname_str_dbg(smb_fname_old), smb_fname_str_dbg(smb_fname_new))); -- 2.47.3