]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/smbd: use smb_fname->fsp for get_ea_list_from_file_path in estimate_ea_size()
authorNoel Power <npower@quick-trouble.localdomain>
Fri, 29 Jan 2021 14:54:47 +0000 (14:54 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 26 Feb 2021 21:28:33 +0000 (21:28 +0000)
Additionally ensure get_ea_list_from_file_path is called with base file.

Previously fsp was set to NULL if fsp pointed to a ntfs stream which in
turn ensured that 'base_path' from the smb_fname was used (which points
to the base file). Now we get a pathref fsp (pointing to the base file)
instead

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/trans2.c

index 8cdd448a66b3ce9f4036abf3db03c48a3449d3ad..8c973591930c0fe4dddb3ad613a7dca1ceebaf15 100644 (file)
@@ -681,6 +681,7 @@ static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp,
        size_t total_ea_len = 0;
        TALLOC_CTX *mem_ctx;
        struct ea_list *ea_list = NULL;
+       NTSTATUS status;
 
        if (!lp_ea_support(SNUM(conn))) {
                return 0;
@@ -692,16 +693,34 @@ static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp,
         * (streams cannot have EAs), but the estimate isn't just 0 in
         * this case! */
        if (is_ntfs_stream_smb_fname(smb_fname)) {
-               fsp = NULL;
-       }
-       (void)get_ea_list_from_file_path(mem_ctx,
+               struct smb_filename *pathref = NULL;
+               status = synthetic_pathref(mem_ctx,
+                               conn->cwd_fsp,
+                               smb_fname->base_name,
+                               NULL,
+                               NULL,
+                               smb_fname->twrp,
+                               smb_fname->flags,
+                               &pathref);
+               if (!NT_STATUS_IS_OK(status)) {
+                       TALLOC_FREE(mem_ctx);
+                       return 0;
+               }
+               (void)get_ea_list_from_file_path(mem_ctx,
                                conn,
-                               fsp,
+                               pathref->fsp,
+                               pathref,
+                               &total_ea_len,
+                               &ea_list);
+       } else {
+               (void)get_ea_list_from_file_path(mem_ctx,
+                               conn,
+                               smb_fname->fsp,
                                smb_fname,
                                &total_ea_len,
                                &ea_list);
+       }
        if(conn->sconn->using_smb2) {
-               NTSTATUS status;
                unsigned int ret_data_size;
                /*
                 * We're going to be using fill_ea_chained_buffer() to