VFS: default: add support for FILE_ATTRIBUTE_OFFLINE to async dosmode
authorRalph Boehme <slow@samba.org>
Mon, 24 Feb 2020 14:03:56 +0000 (15:03 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 25 Feb 2020 17:44:44 +0000 (17:44 +0000)
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 <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_default.c

index bd5d4f3416a273d94f096b2bfff968a4ae6bd611..a30f3ba1d31646e66c8c45eb933c892489ab69b3 100644 (file)
@@ -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;
 }