1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00

smbd: stat path before calling openat_pathref_fsp() in unlink_internals()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2021-02-01 12:00:35 +01:00
parent 4f30c04462
commit ab82dbc5ae

View File

@ -3281,6 +3281,7 @@ NTSTATUS unlink_internals(connection_struct *conn,
NTSTATUS status = NT_STATUS_OK;
struct smb_filename *smb_fname_dir = NULL;
TALLOC_CTX *ctx = talloc_tos();
int ret;
/* Split up the directory from the filename/mask. */
status = split_fname_dir_mask(ctx, smb_fname->base_name,
@ -3457,6 +3458,15 @@ NTSTATUS unlink_internals(connection_struct *conn,
goto out;
}
ret = vfs_stat(conn, f);
if (ret != 0) {
status = map_nt_error_from_unix(errno);
TALLOC_FREE(dir_hnd);
TALLOC_FREE(frame);
TALLOC_FREE(talloced);
goto out;
}
status = openat_pathref_fsp(conn->cwd_fsp, f);
if (!NT_STATUS_IS_OK(status) &&
!NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK))