mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
smbd: add and use vfs_fget_dos_attributes()
Commit d71ef1365cdde47aeb3465699181656b0655fa04 caused a regression where the creation date on streams wasn't updated anymore on the stream fsp. By adding a simple wrapper vfs_fget_dos_attributes() that takes care of - passing only the base_fsp to the VFS, so the VFS can be completely agnostic of all the streams related complexity like fake fds, - propagating any updated btime from the base_fsp->fsp_name to the stream_fsp->fsp_name BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126 MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
e74b10e17e
commit
3f7d8db994
@ -1 +0,0 @@
|
||||
^samba3.smb2.streams streams_xattr.attributes2
|
@ -82,6 +82,9 @@ NTSTATUS vfs_at_fspcwd(TALLOC_CTX *mem_ctx,
|
||||
struct connection_struct *conn,
|
||||
struct files_struct **_fsp);
|
||||
|
||||
NTSTATUS vfs_fget_dos_attributes(struct files_struct *fsp,
|
||||
uint32_t *dosmode);
|
||||
|
||||
#include "source3/lib/interface.h"
|
||||
|
||||
/* The following definitions come from lib/ldap_debug_handler.c */
|
||||
|
@ -727,8 +727,7 @@ uint32_t fdos_mode(struct files_struct *fsp)
|
||||
}
|
||||
|
||||
/* Get the DOS attributes via the VFS if we can */
|
||||
status = SMB_VFS_FGET_DOS_ATTRIBUTES(
|
||||
fsp->conn, metadata_fsp(fsp), &result);
|
||||
status = vfs_fget_dos_attributes(fsp, &result);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
/*
|
||||
* Only fall back to using UNIX modes if we get NOT_IMPLEMENTED.
|
||||
|
@ -3651,8 +3651,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
|
||||
*/
|
||||
uint32_t attr = 0;
|
||||
|
||||
status = SMB_VFS_FGET_DOS_ATTRIBUTES(
|
||||
conn, metadata_fsp(smb_fname->fsp), &attr);
|
||||
status = vfs_fget_dos_attributes(smb_fname->fsp, &attr);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
existing_dos_attributes = attr;
|
||||
}
|
||||
|
@ -1509,6 +1509,45 @@ NTSTATUS vfs_at_fspcwd(TALLOC_CTX *mem_ctx,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS vfs_fget_dos_attributes(struct files_struct *fsp,
|
||||
uint32_t *dosmode)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
/*
|
||||
* First make sure to pass the base_fsp to the VFS
|
||||
*/
|
||||
status = SMB_VFS_FGET_DOS_ATTRIBUTES(
|
||||
fsp->conn, metadata_fsp(fsp), dosmode);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* If this isn't a stream fsp we're done, ...
|
||||
*/
|
||||
if (!fsp_is_alternate_stream(fsp)) {
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* ...otherwise the VFS might have updated the btime, propagate the
|
||||
* btime from the base_fsp to the stream fsp.
|
||||
*/
|
||||
|
||||
if (fsp->base_fsp->fsp_name->st.st_ex_iflags & ST_EX_IFLAG_CALCULATED_BTIME) {
|
||||
/*
|
||||
* Not a value from backend storage, ignore it
|
||||
*/
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
update_stat_ex_create_time(&fsp->fsp_name->st,
|
||||
fsp->base_fsp->fsp_name->st.st_ex_btime);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
int smb_vfs_call_connect(struct vfs_handle_struct *handle,
|
||||
const char *service, const char *user)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user