]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Pass "dirfsp" to ad_collect_one_stream()
authorVolker Lendecke <vl@samba.org>
Thu, 20 Mar 2025 08:47:15 +0000 (09:47 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 27 Mar 2025 13:13:31 +0000 (13:13 +0000)
Avoid a call to SMB_VFS_CREATE_FILE with dirfsp==NULL

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/lib/adouble.c

index b2fae5a50ca4b1fa38b2809ab2aa0a235b937872..6f5ffe35c8fd5bbfd5415cd15f9e068872de1d12 100644 (file)
@@ -1733,6 +1733,7 @@ struct ad_collect_state {
 
 static NTSTATUS ad_collect_one_stream(struct vfs_handle_struct *handle,
                                      struct char_mappings **cmaps,
+                                     struct files_struct *dirfsp,
                                      struct smb_filename *smb_fname,
                                      const struct stream_struct *stream,
                                      struct adouble *ad,
@@ -1774,7 +1775,7 @@ static NTSTATUS ad_collect_one_stream(struct vfs_handle_struct *handle,
        status = SMB_VFS_CREATE_FILE(
                handle->conn,
                NULL,                           /* req */
-               NULL,                           /* dirfsp */
+               dirfsp,                         /* dirfsp */
                sname,
                FILE_READ_DATA|DELETE_ACCESS,
                FILE_SHARE_READ,
@@ -1837,7 +1838,7 @@ static NTSTATUS ad_collect_one_stream(struct vfs_handle_struct *handle,
        if (is_afpresource_stream(stream->name)) {
                ad->ad_rsrc_data = talloc_size(ad, stream->size);
                if (ad->ad_rsrc_data == NULL) {
-                       ok = false;
+                       status = NT_STATUS_NO_MEMORY;
                        goto out;
                }
 
@@ -2089,8 +2090,13 @@ NTSTATUS ad_unconvert(TALLOC_CTX *mem_ctx,
        }
 
        for (i = 0; i < num_streams; i++) {
-               status = ad_collect_one_stream(
-                       handle, cmaps, fullname, &streams[i], ad, &state);
+               status = ad_collect_one_stream(handle,
+                                              cmaps,
+                                              dirfsp,
+                                              fullname,
+                                              &streams[i],
+                                              ad,
+                                              &state);
                if (!NT_STATUS_IS_OK(status)) {
                        goto out;
                }