]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use parent_smb_fname() in copy_internals()
authorRalph Boehme <slow@samba.org>
Tue, 28 Apr 2020 14:11:38 +0000 (16:11 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 29 Apr 2020 16:39:39 +0000 (16:39 +0000)
Prepares for converting file_set_dosmode() to struct smb_filename.

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

index 66bcebf1313dd67c6ce73b2b48c605d2e1d838a0..04420b362d43e138b32b5a11113808b2836e48f7 100644 (file)
@@ -1450,7 +1450,8 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
        int info;
        off_t ret=-1;
        NTSTATUS status = NT_STATUS_OK;
-       char *parent;
+       struct smb_filename *parent = NULL;
+       bool ok;
 
        if (!CAN_WRITE(conn)) {
                status = NT_STATUS_MEDIA_WRITE_PROTECTED;
@@ -1559,12 +1560,16 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
        /* Grrr. We have to do this as open_file_ntcreate adds FILE_ATTRIBUTE_ARCHIVE when it
           creates the file. This isn't the correct thing to do in the copy
           case. JRA */
-       if (!parent_dirname(talloc_tos(), smb_fname_dst->base_name, &parent,
-                           NULL)) {
+
+       ok = parent_smb_fname(talloc_tos(),
+                             smb_fname_dst,
+                             &parent,
+                             NULL);
+       if (!ok) {
                status = NT_STATUS_NO_MEMORY;
                goto out;
        }
-       file_set_dosmode(conn, smb_fname_dst, fattr, parent, false);
+       file_set_dosmode(conn, smb_fname_dst, fattr, parent->base_name, false);
        TALLOC_FREE(parent);
 
        if (ret < (off_t)smb_fname_src->st.st_ex_size) {