From: Ralph Boehme Date: Wed, 20 May 2020 20:24:37 +0000 (+0200) Subject: vfs_unityed_media: implement SMB_VFS_OPENAT() X-Git-Tag: ldb-2.2.0~377 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=739e100f47cdfec0de0e16f77a2f4b78801afa89;p=thirdparty%2Fsamba.git vfs_unityed_media: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c index e026f9e9398..bffa60b7181 100644 --- a/source3/modules/vfs_unityed_media.c +++ b/source3/modules/vfs_unityed_media.c @@ -824,6 +824,61 @@ err: return ret; } +static int um_openat(struct vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + struct files_struct *fsp, + int flags, + mode_t mode) +{ + struct smb_filename *client_fname = NULL; + int ret; + + DBG_DEBUG("Entering with smb_fname->base_name '%s'\n", + smb_fname->base_name); + + if (!is_in_media_files(smb_fname->base_name)) { + return SMB_VFS_NEXT_OPENAT(handle, + dirfsp, + smb_fname, + fsp, + flags, + mode); + } + + if (alloc_get_client_smb_fname(handle, talloc_tos(), + smb_fname, + &client_fname)) { + ret = -1; + goto err; + } + + /* + * FIXME: + * What about fsp->fsp_name? We also have to get correct stat + * info into fsp and smb_fname for DB files, don't we? + */ + + DEBUG(10, ("Leaving with smb_fname->base_name '%s' " + "smb_fname->st.st_ex_mtime %s" + "fsp->fsp_name->st.st_ex_mtime %s", + smb_fname->base_name, + ctime(&(smb_fname->st.st_ex_mtime.tv_sec)), + ctime(&(fsp->fsp_name->st.st_ex_mtime.tv_sec)))); + + ret = SMB_VFS_NEXT_OPENAT(handle, + dirfsp, + client_fname, + fsp, + flags, + mode); +err: + TALLOC_FREE(client_fname); + DEBUG(10, ("Leaving with smb_fname->base_name '%s'\n", + smb_fname->base_name)); + return ret; +} + static NTSTATUS um_create_file(vfs_handle_struct *handle, struct smb_request *req, struct files_struct **dirfsp, @@ -1839,6 +1894,7 @@ static struct vfs_fn_pointers vfs_um_fns = { /* File operations */ .open_fn = um_open, + .openat_fn = um_openat, .create_file_fn = um_create_file, .renameat_fn = um_renameat, .stat_fn = um_stat,