From: Jeremy Allison Date: Tue, 2 Aug 2022 21:16:15 +0000 (-0700) Subject: s3: smbd: In reply_ntrename(), move the call to get_original_lcomp(..newname..) after... X-Git-Tag: samba-4.17.0rc1~82 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=acff075a725118d42dc61b64c5ddb6f3178baf2f;p=thirdparty%2Fsamba.git 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 --- 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)));