mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
s3:smbd: split out create_internal_fsp() from create_internal_dirfsp()
That will be useful in other places as well. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
7dc9a84bb5
commit
22bebaf858
@ -186,6 +186,28 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS create_internal_fsp(connection_struct *conn,
|
||||
const struct smb_filename *smb_fname,
|
||||
struct files_struct **_fsp)
|
||||
{
|
||||
struct files_struct *fsp = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
status = file_new(NULL, conn, &fsp);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = fsp_set_smb_fname(fsp, smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
file_free(NULL, fsp);
|
||||
return status;
|
||||
}
|
||||
|
||||
*_fsp = fsp;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create an internal fsp for an *existing* directory.
|
||||
*
|
||||
@ -199,17 +221,11 @@ NTSTATUS create_internal_dirfsp(connection_struct *conn,
|
||||
struct files_struct *fsp = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
status = file_new(NULL, conn, &fsp);
|
||||
status = create_internal_fsp(conn, smb_dname, &fsp);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = fsp_set_smb_fname(fsp, smb_dname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
file_free(NULL, fsp);
|
||||
return status;
|
||||
}
|
||||
|
||||
fsp->access_mask = FILE_LIST_DIRECTORY;
|
||||
fsp->fsp_flags.is_directory = true;
|
||||
fsp->fsp_flags.is_dirfsp = true;
|
||||
|
@ -447,6 +447,9 @@ NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
|
||||
const struct smb_filename *smb_fname_in);
|
||||
size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen);
|
||||
|
||||
NTSTATUS create_internal_fsp(connection_struct *conn,
|
||||
const struct smb_filename *smb_fname,
|
||||
struct files_struct **_fsp);
|
||||
NTSTATUS create_internal_dirfsp(connection_struct *conn,
|
||||
const struct smb_filename *smb_dname,
|
||||
struct files_struct **_fsp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user