smbd: pass struct smb_filename parent_dir to file_set_dosmode()
authorRalph Boehme <slow@samba.org>
Tue, 28 Apr 2020 16:09:18 +0000 (18:09 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 29 Apr 2020 16:39:40 +0000 (16:39 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/dosmode.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/proto.h

index 95d1606f1220341c38edc2ab8b4b0bcfac0decbd..1baee073a3665ecb59fa7c6663cdd7f497c0e6bf 100644 (file)
@@ -953,7 +953,7 @@ NTSTATUS dos_mode_at_recv(struct tevent_req *req, uint32_t *dosmode)
 int file_set_dosmode(connection_struct *conn,
                     struct smb_filename *smb_fname,
                     uint32_t dosmode,
-                    const char *parent_dir,
+                    struct smb_filename *parent_dir,
                     bool newfile)
 {
        int mask=0;
@@ -1006,7 +1006,7 @@ int file_set_dosmode(connection_struct *conn,
        }
 
        /* Fall back to UNIX modes. */
-       unixmode = unix_mode(conn, dosmode, smb_fname, parent_dir);
+       unixmode = unix_mode(conn, dosmode, smb_fname, parent_dir->base_name);
 
        /* preserve the file type bits */
        mask |= S_IFMT;
index 04420b362d43e138b32b5a11113808b2836e48f7..a99aa78bde867f3273d251949f080be2be40a303 100644 (file)
@@ -1569,7 +1569,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
                status = NT_STATUS_NO_MEMORY;
                goto out;
        }
-       file_set_dosmode(conn, smb_fname_dst, fattr, parent->base_name, false);
+       file_set_dosmode(conn, smb_fname_dst, fattr, parent, false);
        TALLOC_FREE(parent);
 
        if (ret < (off_t)smb_fname_src->st.st_ex_size) {
index 76f85fcc25c24b54ab0fa0e3a7e4f1b2cb495363..4f2f7d2923d12d5ecd87e59cf1495a559f5d2328 100644 (file)
@@ -3978,7 +3978,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                        if (!posix_open) {
                                if (file_set_dosmode(conn, smb_fname,
                                            new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE,
-                                           parent_dir, true) == 0) {
+                                           parent_dir_fname, true) == 0) {
                                        unx_mode = smb_fname->st.st_ex_mode;
                                }
                        }
@@ -4145,7 +4145,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
                if (!posix_open) {
                        file_set_dosmode(conn, smb_dname,
                                         file_attributes | FILE_ATTRIBUTE_DIRECTORY,
-                                        parent_dir, true);
+                                        parent_dir_fname, true);
                }
        }
 
index d926058857adf5612fa2cfc9a9665ebc2da9db8e..e1c892209a170d92decc2c9f3812522139949711 100644 (file)
@@ -271,7 +271,7 @@ NTSTATUS dos_mode_at_recv(struct tevent_req *req, uint32_t *dosmode);
 int file_set_dosmode(connection_struct *conn,
                     struct smb_filename *smb_fname,
                     uint32_t dosmode,
-                    const char *parent_dir,
+                    struct smb_filename *parent_dir,
                     bool newfile);
 NTSTATUS file_set_sparse(connection_struct *conn,
                         struct files_struct *fsp,