]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use openat_pathref_fsp() in open_streams_for_delete()
authorRalph Boehme <slow@samba.org>
Thu, 12 Nov 2020 11:56:56 +0000 (12:56 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:31 +0000 (09:08 +0000)
Ensures we have a pathref handle in the smb_fname we pass to
SMB_VFS_CREATE_FILE().

As the create_disposition is FILE_OPEN we just return the error if
openat_pathref_fsp() fails

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

index 3fbb72572d802e898e93ebe1fb20edeaf7f191fb..361c35303f639e4d9b288eb722c12952436b2524 100644 (file)
@@ -4828,6 +4828,18 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn,
                                   smb_fname_str_dbg(smb_fname_cp)));
                }
 
+               status = openat_pathref_fsp(conn->cwd_fsp, smb_fname_cp);
+               if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) {
+                       status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+               }
+               if (!NT_STATUS_IS_OK(status)) {
+                       DBG_DEBUG("Unable to open stream [%s]: %s\n",
+                                 smb_fname_str_dbg(smb_fname_cp),
+                                 nt_errstr(status));
+                       TALLOC_FREE(smb_fname_cp);
+                       break;
+               }
+
                status = SMB_VFS_CREATE_FILE(
                         conn,                  /* conn */
                         NULL,                  /* req */