s3: smbd: SMB1 reply_ntrename() - Move the call to get_original_lcomp() to before...
authorJeremy Allison <jra@samba.org>
Tue, 29 Sep 2020 03:47:42 +0000 (20:47 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 30 Sep 2020 20:46:39 +0000 (20:46 +0000)
Simple code re-arrangement to make the next change clear.

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

index ae116218ad777f04bf598f13b68d6a0da4ab33bb..7ab1c5d178d7384bddb044f2c05e35eb23c1ccbe 100644 (file)
@@ -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);