s3: smbd: Use get_original_lcomp() inside reply_mv().
authorJeremy Allison <jra@samba.org>
Thu, 26 Mar 2020 22:51:18 +0000 (15:51 -0700)
committerRalph Boehme <slow@samba.org>
Mon, 30 Mar 2020 14:45:31 +0000 (14:45 +0000)
Pass to rename_internals().

Removes one more use of the struct member original_lcomp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/reply.c

index 826387b99149b37971d35eaf9d384e0f22b8e5d5..eee9c986db638f763cada93748dcdeb581741537 100644 (file)
@@ -8290,6 +8290,7 @@ void reply_mv(struct smb_request *req)
        TALLOC_CTX *ctx = talloc_tos();
        struct smb_filename *smb_fname_src = NULL;
        struct smb_filename *smb_fname_dst = NULL;
+       const char *dst_original_lcomp = NULL;
        uint32_t src_ucf_flags = ucf_flags_from_smb_request(req) |
                (req->posix_pathnames ?
                        UCF_UNIX_NAME_LOOKUP :
@@ -8373,6 +8374,16 @@ void reply_mv(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,
+                                       dst_ucf_flags);
+       if (dst_original_lcomp == NULL) {
+               reply_nterror(req, NT_STATUS_NO_MEMORY);
+               goto out;
+       }
+
        if (stream_rename) {
                /* smb_fname_dst->base_name must be the same as
                   smb_fname_src->base_name. */
@@ -8393,7 +8404,7 @@ void reply_mv(struct smb_request *req)
                                req,
                                smb_fname_src,
                                smb_fname_dst,
-                               smb_fname_dst->original_lcomp,
+                               dst_original_lcomp,
                                attrs,
                                false,
                                src_has_wcard,