1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

smbd: remove fsp->dirfsp

This was supposed to be a shortcut to avoid passing dirfsp around as an explicit
function argument throughout the whole codebase when the new VFS design idea was
based on using *AT functions throughout the VFS.

Now that we've opted for basing the VFS on handles and *AT functions will only
be used in a much more limitted extent, it makes sense to remove this internal
dirfsp reference, otherwise the combination of internal fsp->dirfsp and
smb_fname->fsp is going to be a tough to wrap your head around.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2020-10-02 16:51:16 +02:00 committed by Jeremy Allison
parent b133b81d8d
commit 1c444f9c37
5 changed files with 3 additions and 41 deletions

View File

@ -327,9 +327,11 @@
* Version 43 - SMB_VFS_READ_DFS_PATHAT() should take a non-const name.
There's no easy way to return stat info for a DFS link
otherwise.
* Change to Version 44 - will ship with 4.14.
* Version 44 - Remove dirfsp arg from struct files_struct
*/
#define SMB_VFS_INTERFACE_VERSION 43
#define SMB_VFS_INTERFACE_VERSION 44
/*
All intercepted VFS operations must be declared as static functions inside module source
@ -384,7 +386,6 @@ typedef struct files_struct {
struct smbXsrv_open *op;
struct connection_struct *conn;
struct fd_handle *fh;
struct files_struct *dirfsp;
unsigned int num_smb_operations;
struct file_id file_id;
uint64_t initial_allocation_size; /* Faked up initial allocation on disk. */

View File

@ -187,26 +187,6 @@ const char *fsp_str_dbg(const struct files_struct *fsp)
return "";
}
if (fsp->dirfsp == NULL || fsp->dirfsp == fsp->conn->cwd_fsp) {
return name;
}
if (ISDOT(fsp->dirfsp->fsp_name->base_name)) {
return name;
}
name = smb_fname_str_dbg(fsp->fsp_name);
if (name == NULL) {
return "";
}
name = talloc_asprintf(talloc_tos(),
"%s/%s",
fsp->dirfsp->fsp_name->base_name,
name);
if (name == NULL) {
return "";
}
return name;
}

View File

@ -1300,18 +1300,6 @@ NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
return NT_STATUS_OK;
}
if (fsp->dirfsp != NULL &&
fsp->dirfsp != fsp->conn->cwd_fsp)
{
status = fd_close(fsp->dirfsp);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
file_free(NULL, fsp->dirfsp);
fsp->dirfsp = NULL;
}
if (fsp->fsp_flags.is_directory) {
status = close_directory(req, fsp, close_type);
} else if (fsp->fake_file_handle != NULL) {

View File

@ -761,9 +761,6 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
fsp->close_write_time = nt_time_to_full_timespec(
cookie.close_write_time);
/* TODO: real dirfsp... */
fsp->dirfsp = fsp->conn->cwd_fsp;
status = fsp_set_smb_fname(fsp, smb_fname);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(lck);

View File

@ -3380,8 +3380,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
bool setup_poll = false;
bool ok;
SMB_ASSERT(fsp->dirfsp == conn->cwd_fsp);
if (conn->printer) {
/*
* Printers are handled completely differently.
@ -5647,8 +5645,6 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
goto fail;
}
fsp->dirfsp = fsp->conn->cwd_fsp;
if (base_fsp) {
/*
* We're opening the stream element of a