1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3: VFS: fruit: Implement SMB_VFS_FNTIMES()

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Samuel Cabrero 2021-04-13 16:23:41 +02:00 committed by Samuel Cabrero
parent 5e0def5e32
commit 5d84ad711a

View File

@ -3912,6 +3912,46 @@ exit:
return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
}
static int fruit_fntimes(vfs_handle_struct *handle,
files_struct *fsp,
struct smb_file_time *ft)
{
int rc = 0;
struct adouble *ad = NULL;
struct fruit_config_data *config = NULL;
SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data,
return -1);
if ((config->meta != FRUIT_META_NETATALK) ||
is_omit_timespec(&ft->create_time))
{
return SMB_VFS_NEXT_FNTIMES(handle, fsp, ft);
}
DBG_DEBUG("set btime for %s to %s\n", fsp_str_dbg(fsp),
time_to_asc(convert_timespec_to_time_t(ft->create_time)));
ad = ad_fget(talloc_tos(), handle, fsp, ADOUBLE_META);
if (ad == NULL) {
goto exit;
}
ad_setdate(ad, AD_DATE_CREATE | AD_DATE_UNIX,
convert_time_t_to_uint32_t(ft->create_time.tv_sec));
rc = ad_fset(handle, ad, fsp);
exit:
TALLOC_FREE(ad);
if (rc != 0) {
DBG_WARNING("%s\n", fsp_str_dbg(fsp));
return -1;
}
return SMB_VFS_NEXT_FNTIMES(handle, fsp, ft);
}
static int fruit_fallocate(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t mode,
@ -5210,6 +5250,7 @@ static struct vfs_fn_pointers vfs_fruit_fns = {
.fstat_fn = fruit_fstat,
.streaminfo_fn = fruit_streaminfo,
.ntimes_fn = fruit_ntimes,
.fntimes_fn = fruit_fntimes,
.ftruncate_fn = fruit_ftruncate,
.fallocate_fn = fruit_fallocate,
.create_file_fn = fruit_create_file,