mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
smbd: simplify openat_pathref_fullname()
We don't have to deal with stream opens anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
9a80e4e27a
commit
31eac22e08
@ -404,20 +404,16 @@ static int smb_fname_fsp_destructor(struct smb_filename *smb_fname)
|
|||||||
static NTSTATUS openat_pathref_fullname(
|
static NTSTATUS openat_pathref_fullname(
|
||||||
struct connection_struct *conn,
|
struct connection_struct *conn,
|
||||||
const struct files_struct *dirfsp,
|
const struct files_struct *dirfsp,
|
||||||
struct files_struct *basefsp,
|
|
||||||
struct smb_filename **full_fname,
|
struct smb_filename **full_fname,
|
||||||
struct smb_filename *smb_fname,
|
struct smb_filename *smb_fname,
|
||||||
const struct vfs_open_how *how)
|
const struct vfs_open_how *how)
|
||||||
{
|
{
|
||||||
struct files_struct *fsp = NULL;
|
struct files_struct *fsp = NULL;
|
||||||
bool have_dirfsp = (dirfsp != NULL);
|
|
||||||
bool have_basefsp = (basefsp != NULL);
|
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
DBG_DEBUG("smb_fname [%s]\n", smb_fname_str_dbg(smb_fname));
|
DBG_DEBUG("smb_fname [%s]\n", smb_fname_str_dbg(smb_fname));
|
||||||
|
|
||||||
SMB_ASSERT(smb_fname->fsp == NULL);
|
SMB_ASSERT(smb_fname->fsp == NULL);
|
||||||
SMB_ASSERT(have_dirfsp != have_basefsp);
|
|
||||||
|
|
||||||
status = fsp_new(conn, conn, &fsp);
|
status = fsp_new(conn, conn, &fsp);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
@ -434,7 +430,6 @@ static NTSTATUS openat_pathref_fullname(
|
|||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
fsp_set_base_fsp(fsp, basefsp);
|
|
||||||
|
|
||||||
status = fd_openat(dirfsp, smb_fname, fsp, how);
|
status = fd_openat(dirfsp, smb_fname, fsp, how);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
@ -493,7 +488,6 @@ fail:
|
|||||||
smb_fname_str_dbg(smb_fname),
|
smb_fname_str_dbg(smb_fname),
|
||||||
nt_errstr(status));
|
nt_errstr(status));
|
||||||
|
|
||||||
fsp_set_base_fsp(fsp, NULL);
|
|
||||||
fd_close(fsp);
|
fd_close(fsp);
|
||||||
file_free(NULL, fsp);
|
file_free(NULL, fsp);
|
||||||
return status;
|
return status;
|
||||||
@ -546,7 +540,7 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
status = openat_pathref_fullname(
|
status = openat_pathref_fullname(
|
||||||
conn, dirfsp, NULL, &full_fname, smb_fname, &how);
|
conn, dirfsp, &full_fname, smb_fname, &how);
|
||||||
TALLOC_FREE(full_fname);
|
TALLOC_FREE(full_fname);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -569,7 +563,7 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status = openat_pathref_fullname(
|
status = openat_pathref_fullname(
|
||||||
conn, dirfsp, NULL, &full_fname, base_fname, &how);
|
conn, dirfsp, &full_fname, base_fname, &how);
|
||||||
TALLOC_FREE(full_fname);
|
TALLOC_FREE(full_fname);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
DBG_DEBUG("openat_pathref_fullname() failed: %s\n",
|
DBG_DEBUG("openat_pathref_fullname() failed: %s\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user