From: Ralph Boehme Date: Mon, 24 Feb 2020 14:03:56 +0000 (+0100) Subject: VFS: default: add support for FILE_ATTRIBUTE_OFFLINE to async dosmode X-Git-Tag: ldb-2.2.0~1609 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a23f8d913fa8d77bab394aea9a8e7df2704e8b19;p=thirdparty%2Fsamba.git VFS: default: add support for FILE_ATTRIBUTE_OFFLINE to async dosmode This had been missing in the initial async dosmode implementation. It's the responsibility of the sync and async dosmode functions to call vfswrap_is_offline() since the offline functionality has been converted from a first class VFS function to be a part of the DOS attributes VFS functions. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index bd5d4f3416a..a30f3ba1d31 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1719,6 +1719,12 @@ static void vfswrap_get_dos_attributes_getxattr_done(struct tevent_req *subreq) struct vfswrap_get_dos_attributes_state); ssize_t xattr_size; DATA_BLOB blob = {0}; + char *path = NULL; + char *tofree = NULL; + char pathbuf[PATH_MAX+1]; + ssize_t pathlen; + struct smb_filename smb_fname; + bool offline; NTSTATUS status; xattr_size = SMB_VFS_GETXATTRAT_RECV(subreq, @@ -1767,6 +1773,29 @@ static void vfswrap_get_dos_attributes_getxattr_done(struct tevent_req *subreq) return; } + pathlen = full_path_tos(state->dir_fsp->fsp_name->base_name, + state->smb_fname->base_name, + pathbuf, + sizeof(pathbuf), + &path, + &tofree); + if (pathlen == -1) { + tevent_req_nterror(req, NT_STATUS_NO_MEMORY); + return; + } + + smb_fname = (struct smb_filename) { + .base_name = path, + .st = state->smb_fname->st, + .flags = state->smb_fname->flags, + }; + + offline = vfswrap_is_offline(state->conn, &smb_fname); + if (offline) { + state->dosmode |= FILE_ATTRIBUTE_OFFLINE; + } + TALLOC_FREE(tofree); + tevent_req_done(req); return; }