s3: VFS: Change SMB_VFS_CHDIR to use const struct smb_filename * instead of const...
[kai/samba-autobuild/.git] / source3 / smbd / vfs.c
index 9221107f9fc5a00b5dff641f66db61377f986696..40c41ed27fc29787573444414917586ccc776f44 100644 (file)
@@ -133,7 +133,7 @@ bool vfs_init_custom(connection_struct *conn, const char *vfs_object)
        }
 
        if(!backends) {
-               static_init_vfs;
+               static_init_vfs(NULL);
        }
 
        DEBUG(3, ("Initialising custom vfs hooks from [%s]\n", vfs_object));
@@ -316,6 +316,36 @@ void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
 
 #undef EXT_DATA_AREA
 
+/*
+ * Ensure this module catches all VFS functions.
+ */
+#ifdef DEVELOPER
+void smb_vfs_assert_all_fns(const struct vfs_fn_pointers* fns,
+                           const char *module)
+{
+       bool missing_fn = false;
+       unsigned int idx;
+       const uintptr_t *end = (const uintptr_t *)(fns + 1);
+
+       for (idx = 0; ((const uintptr_t *)fns + idx) < end; idx++) {
+               if (*((const uintptr_t *)fns + idx) == 0) {
+                       DBG_ERR("VFS function at index %d not implemented "
+                               "in module %s\n", idx, module);
+                       missing_fn = true;
+               }
+       }
+
+       if (missing_fn) {
+               smb_panic("Required VFS function not implemented in module.\n");
+       }
+}
+#else
+void smb_vfs_assert_all_fns(const struct vfs_fn_pointers* fns,
+                           const char *module)
+{
+}
+#endif
+
 /*****************************************************************
  Generic VFS init.
 ******************************************************************/
@@ -593,8 +623,8 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
 
        len -= fsp->fsp_name->st.st_ex_size;
        len /= 1024; /* Len is now number of 1k blocks needed. */
-       space_avail = get_dfree_info(conn, fsp->fsp_name->base_name,
-                                    &bsize, &dfree, &dsize);
+       space_avail =
+           get_dfree_info(conn, fsp->fsp_name, &bsize, &dfree, &dsize);
        if (space_avail == (uint64_t)-1) {
                return -1;
        }
@@ -825,7 +855,7 @@ const char *vfs_readdirname(connection_struct *conn, void *p,
  A wrapper for vfs_chdir().
 ********************************************************************/
 
-int vfs_ChDir(connection_struct *conn, const char *path)
+int vfs_ChDir(connection_struct *conn, const struct smb_filename *smb_fname)
 {
        int ret;
 
@@ -833,21 +863,22 @@ int vfs_ChDir(connection_struct *conn, const char *path)
                LastDir = SMB_STRDUP("");
        }
 
-       if (ISDOT(path)) {
+       if (ISDOT(smb_fname->base_name)) {
                return 0;
        }
 
-       if (*path == '/' && strcsequal(LastDir,path)) {
+       if (*smb_fname->base_name == '/' &&
+                       strcsequal(LastDir,smb_fname->base_name)) {
                return 0;
        }
 
-       DEBUG(4,("vfs_ChDir to %s\n",path));
+       DEBUG(4,("vfs_ChDir to %s\n", smb_fname->base_name));
 
-       ret = SMB_VFS_CHDIR(conn,path);
+       ret = SMB_VFS_CHDIR(conn, smb_fname);
        if (ret == 0) {
                /* Global cache. */
                SAFE_FREE(LastDir);
-               LastDir = SMB_STRDUP(path);
+               LastDir = SMB_STRDUP(smb_fname->base_name);
 
                /* conn cache. */
                TALLOC_FREE(conn->cwd);
@@ -876,7 +907,7 @@ char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn)
                goto nocache;
        }
 
-       smb_fname_dot = synthetic_smb_fname(ctx, ".", NULL, NULL);
+       smb_fname_dot = synthetic_smb_fname(ctx, ".", NULL, NULL, 0);
        if (smb_fname_dot == NULL) {
                errno = ENOMEM;
                goto out;
@@ -904,7 +935,7 @@ char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn)
                   && (cache_value.data[cache_value.length-1] == '\0'));
 
        smb_fname_full = synthetic_smb_fname(ctx, (char *)cache_value.data,
-                                            NULL, NULL);
+                                            NULL, NULL, 0);
        if (smb_fname_full == NULL) {
                errno = ENOMEM;
                goto out;
@@ -979,6 +1010,7 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
        const char *last_component = NULL;
        char *resolved_name = NULL;
        char *saved_dir = NULL;
+       struct smb_filename *saved_dir_fname = NULL;
        struct smb_filename *smb_fname_cwd = NULL;
        struct privilege_paths *priv_paths = NULL;
        int ret;
@@ -1019,8 +1051,18 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
                goto err;
        }
 
+       saved_dir_fname = synthetic_smb_fname(ctx,
+                                       saved_dir,
+                                       NULL,
+                                       NULL,
+                                       0);
+       if (saved_dir_fname == NULL) {
+               status = NT_STATUS_NO_MEMORY;
+               goto err;
+       }
+
        /* Go to the parent directory to lock in memory. */
-       if (vfs_ChDir(conn, priv_paths->parent_name.base_name) == -1) {
+       if (vfs_ChDir(conn, &priv_paths->parent_name) == -1) {
                status = map_nt_error_from_unix(errno);
                goto err;
        }
@@ -1044,7 +1086,7 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
                resolved_name));
 
        /* Now check the stat value is the same. */
-       smb_fname_cwd = synthetic_smb_fname(talloc_tos(), ".", NULL, NULL);
+       smb_fname_cwd = synthetic_smb_fname(talloc_tos(), ".", NULL, NULL, 0);
        if (smb_fname_cwd == NULL) {
                status = NT_STATUS_NO_MEMORY;
                goto err;
@@ -1135,8 +1177,10 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
 
   err:
 
-       if (saved_dir) {
-               vfs_ChDir(conn, saved_dir);
+       if (saved_dir_fname) {
+               vfs_ChDir(conn, saved_dir_fname);
+               TALLOC_FREE(saved_dir);
+               TALLOC_FREE(saved_dir_fname);
        }
        SAFE_FREE(resolved_name);
        if (!NT_STATUS_IS_OK(status)) {
@@ -1149,11 +1193,20 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
 /*******************************************************************
  Reduce a file name, removing .. elements and checking that
  it is below dir in the heirachy. This uses realpath.
+
+ If cwd_name == NULL then fname is a client given path relative
+ to the root path of the share.
+
+ If cwd_name != NULL then fname is a client given path relative
+ to cwd_name. cwd_name is relative to the root path of the share.
 ********************************************************************/
 
-NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
+NTSTATUS check_reduced_name(connection_struct *conn,
+                               const char *cwd_name,
+                               const char *fname)
 {
        char *resolved_name = NULL;
+       char *new_fname = NULL;
        bool allow_symlinks = true;
        bool allow_widelinks = false;
 
@@ -1277,8 +1330,11 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
                        /* fname can't have changed in resolved_path. */
                        const char *p = &resolved_name[rootdir_len];
 
-                       /* *p can be '\0' if fname was "." */
-                       if (*p == '\0' && ISDOT(fname)) {
+                       /*
+                        * UNIX filesystem semantics, names consisting
+                        * only of "." or ".." CANNOT be symlinks.
+                        */
+                       if (ISDOT(fname) || ISDOTDOT(fname)) {
                                goto out;
                        }
 
@@ -1292,11 +1348,32 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
                        }
 
                        p++;
+
+                       /*
+                        * If cwd_name is present and not ".",
+                        * then fname is relative to that, not
+                        * the root of the share. Make sure the
+                        * path we check is the one the client
+                        * sent (cwd_name+fname).
+                        */
+                       if (cwd_name != NULL && !ISDOT(cwd_name)) {
+                               new_fname = talloc_asprintf(talloc_tos(),
+                                                       "%s/%s",
+                                                       cwd_name,
+                                                       fname);
+                               if (new_fname == NULL) {
+                                       SAFE_FREE(resolved_name);
+                                       return NT_STATUS_NO_MEMORY;
+                               }
+                               fname = new_fname;
+                       }
+
                        if (strcmp(fname, p)!=0) {
                                DEBUG(2, ("check_reduced_name: Bad access "
                                        "attempt: %s is a symlink to %s\n",
                                          fname, p));
                                SAFE_FREE(resolved_name);
+                               TALLOC_FREE(new_fname);
                                return NT_STATUS_ACCESS_DENIED;
                        }
                }
@@ -1306,6 +1383,7 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
 
        DBG_INFO("%s reduced to %s\n", fname, resolved_name);
        SAFE_FREE(resolved_name);
+       TALLOC_FREE(new_fname);
        return NT_STATUS_OK;
 }
 
@@ -1315,15 +1393,17 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
  *
  * Called when we know stream name parsing has already been done.
  */
-int vfs_stat_smb_basename(struct connection_struct *conn, const char *fname,
-                      SMB_STRUCT_STAT *psbuf)
+int vfs_stat_smb_basename(struct connection_struct *conn,
+                       const struct smb_filename *smb_fname_in,
+                       SMB_STRUCT_STAT *psbuf)
 {
        struct smb_filename smb_fname = {
-                       .base_name = discard_const_p(char, fname)
+               .base_name = discard_const_p(char, smb_fname_in->base_name),
+               .flags = smb_fname_in->flags
        };
        int ret;
 
-       if (lp_posix_pathnames()) {
+       if (smb_fname.flags & SMB_FILENAME_POSIX_PATH) {
                ret = SMB_VFS_LSTAT(conn, &smb_fname);
        } else {
                ret = SMB_VFS_STAT(conn, &smb_fname);
@@ -1365,14 +1445,19 @@ NTSTATUS vfs_stat_fsp(files_struct *fsp)
  */
 NTSTATUS vfs_streaminfo(connection_struct *conn,
                        struct files_struct *fsp,
-                       const char *fname,
+                       const struct smb_filename *smb_fname,
                        TALLOC_CTX *mem_ctx,
                        unsigned int *num_streams,
                        struct stream_struct **streams)
 {
        *num_streams = 0;
        *streams = NULL;
-       return SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams);
+       return SMB_VFS_STREAMINFO(conn,
+                       fsp,
+                       smb_fname,
+                       mem_ctx,
+                       num_streams,
+                       streams);
 }
 
 /*
@@ -1397,19 +1482,24 @@ void smb_vfs_call_disconnect(struct vfs_handle_struct *handle)
 }
 
 uint64_t smb_vfs_call_disk_free(struct vfs_handle_struct *handle,
-                               const char *path, uint64_t *bsize,
-                               uint64_t *dfree, uint64_t *dsize)
+                               const struct smb_filename *smb_fname,
+                               uint64_t *bsize,
+                               uint64_t *dfree,
+                               uint64_t *dsize)
 {
        VFS_FIND(disk_free);
-       return handle->fns->disk_free_fn(handle, path, bsize, dfree, dsize);
+       return handle->fns->disk_free_fn(handle, smb_fname,
+                       bsize, dfree, dsize);
 }
 
-int smb_vfs_call_get_quota(struct vfs_handle_struct *handle, const char *path,
-                          enum SMB_QUOTA_TYPE qtype, unid_t id,
-                          SMB_DISK_QUOTA *qt)
+int smb_vfs_call_get_quota(struct vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *qt)
 {
        VFS_FIND(get_quota);
-       return handle->fns->get_quota_fn(handle, path, qtype, id, qt);
+       return handle->fns->get_quota_fn(handle, smb_fname, qtype, id, qt);
 }
 
 int smb_vfs_call_set_quota(struct vfs_handle_struct *handle,
@@ -1430,11 +1520,12 @@ int smb_vfs_call_get_shadow_copy_data(struct vfs_handle_struct *handle,
                                                    shadow_copy_data,
                                                    labels);
 }
-int smb_vfs_call_statvfs(struct vfs_handle_struct *handle, const char *path,
-                        struct vfs_statvfs_struct *statbuf)
+int smb_vfs_call_statvfs(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       struct vfs_statvfs_struct *statbuf)
 {
        VFS_FIND(statvfs);
-       return handle->fns->statvfs_fn(handle, path, statbuf);
+       return handle->fns->statvfs_fn(handle, smb_fname, statbuf);
 }
 
 uint32_t smb_vfs_call_fs_capabilities(struct vfs_handle_struct *handle,
@@ -1882,11 +1973,13 @@ int smb_vfs_call_fchmod(struct vfs_handle_struct *handle,
        return handle->fns->fchmod_fn(handle, fsp, mode);
 }
 
-int smb_vfs_call_chown(struct vfs_handle_struct *handle, const char *path,
-                      uid_t uid, gid_t gid)
+int smb_vfs_call_chown(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       uid_t uid,
+                       gid_t gid)
 {
        VFS_FIND(chown);
-       return handle->fns->chown_fn(handle, path, uid, gid);
+       return handle->fns->chown_fn(handle, smb_fname, uid, gid);
 }
 
 int smb_vfs_call_fchown(struct vfs_handle_struct *handle,
@@ -1896,20 +1989,19 @@ int smb_vfs_call_fchown(struct vfs_handle_struct *handle,
        return handle->fns->fchown_fn(handle, fsp, uid, gid);
 }
 
-int smb_vfs_call_lchown(struct vfs_handle_struct *handle, const char *path,
-                       uid_t uid, gid_t gid)
+int smb_vfs_call_lchown(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       uid_t uid,
+                       gid_t gid)
 {
        VFS_FIND(lchown);
-       return handle->fns->lchown_fn(handle, path, uid, gid);
+       return handle->fns->lchown_fn(handle, smb_fname, uid, gid);
 }
 
 NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
 {
        int ret;
        bool as_root = false;
-       const char *path;
-       char *saved_dir = NULL;
-       char *parent_dir = NULL;
        NTSTATUS status;
 
        if (fsp->fh->fd != -1) {
@@ -1932,8 +2024,12 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
                 * and always act using lchown to ensure we
                 * don't deref any symbolic links.
                 */
+               char *saved_dir = NULL;
+               char *parent_dir = NULL;
                const char *final_component = NULL;
-               struct smb_filename local_fname;
+               struct smb_filename *local_smb_fname = NULL;
+               struct smb_filename parent_dir_fname = {0};
+               struct smb_filename saved_dir_fname = {0};
 
                saved_dir = vfs_GetWd(talloc_tos(),fsp->conn);
                if (!saved_dir) {
@@ -1944,6 +2040,10 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
                        return status;
                }
 
+               saved_dir_fname = (struct smb_filename) {
+                       .base_name = saved_dir
+               };
+
                if (!parent_dirname(talloc_tos(),
                                fsp->fsp_name->base_name,
                                &parent_dir,
@@ -1951,39 +2051,68 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
                        return NT_STATUS_NO_MEMORY;
                }
 
+               parent_dir_fname = (struct smb_filename) {
+                       .base_name = parent_dir,
+                       .flags = fsp->fsp_name->flags
+               };
+
                /* cd into the parent dir to pin it. */
-               ret = vfs_ChDir(fsp->conn, parent_dir);
+               ret = vfs_ChDir(fsp->conn, &parent_dir_fname);
                if (ret == -1) {
                        return map_nt_error_from_unix(errno);
                }
 
-               ZERO_STRUCT(local_fname);
-               local_fname.base_name = discard_const_p(char, final_component);
+               local_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       final_component,
+                                       NULL,
+                                       NULL,
+                                       fsp->fsp_name->flags);
+               if (local_smb_fname == NULL) {
+                       status = NT_STATUS_NO_MEMORY;
+                       goto out;
+               }
 
                /* Must use lstat here. */
-               ret = SMB_VFS_LSTAT(fsp->conn, &local_fname);
+               ret = SMB_VFS_LSTAT(fsp->conn, local_smb_fname);
                if (ret == -1) {
                        status = map_nt_error_from_unix(errno);
                        goto out;
                }
 
                /* Ensure it matches the fsp stat. */
-               if (!check_same_stat(&local_fname.st, &fsp->fsp_name->st)) {
+               if (!check_same_stat(&local_smb_fname->st,
+                               &fsp->fsp_name->st)) {
                         status = NT_STATUS_ACCESS_DENIED;
                        goto out;
                 }
-                path = final_component;
-        } else {
-                path = fsp->fsp_name->base_name;
-        }
 
-       if ((fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) || as_root) {
                ret = SMB_VFS_LCHOWN(fsp->conn,
-                       path,
+                       local_smb_fname,
+                       uid, gid);
+
+               if (ret == 0) {
+                       status = NT_STATUS_OK;
+               } else {
+                       status = map_nt_error_from_unix(errno);
+               }
+
+  out:
+
+               vfs_ChDir(fsp->conn, &saved_dir_fname);
+               TALLOC_FREE(local_smb_fname);
+               TALLOC_FREE(saved_dir);
+               TALLOC_FREE(parent_dir);
+
+               return status;
+       }
+
+       if (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) {
+               ret = SMB_VFS_LCHOWN(fsp->conn,
+                       fsp->fsp_name,
                        uid, gid);
        } else {
                ret = SMB_VFS_CHOWN(fsp->conn,
-                       path,
+                       fsp->fsp_name,
                        uid, gid);
        }
 
@@ -1992,21 +2121,14 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
        } else {
                status = map_nt_error_from_unix(errno);
        }
-
-  out:
-
-       if (as_root) {
-               vfs_ChDir(fsp->conn,saved_dir);
-               TALLOC_FREE(saved_dir);
-               TALLOC_FREE(parent_dir);
-       }
        return status;
 }
 
-int smb_vfs_call_chdir(struct vfs_handle_struct *handle, const char *path)
+int smb_vfs_call_chdir(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname)
 {
        VFS_FIND(chdir);
-       return handle->fns->chdir_fn(handle, path);
+       return handle->fns->chdir_fn(handle, smb_fname);
 }
 
 char *smb_vfs_call_getwd(struct vfs_handle_struct *handle)
@@ -2056,32 +2178,38 @@ int smb_vfs_call_linux_setlease(struct vfs_handle_struct *handle,
        return handle->fns->linux_setlease_fn(handle, fsp, leasetype);
 }
 
-int smb_vfs_call_symlink(struct vfs_handle_struct *handle, const char *oldpath,
-                        const char *newpath)
+int smb_vfs_call_symlink(struct vfs_handle_struct *handle,
+                       const char *link_target,
+                       const struct smb_filename *new_smb_fname)
 {
        VFS_FIND(symlink);
-       return handle->fns->symlink_fn(handle, oldpath, newpath);
+       return handle->fns->symlink_fn(handle, link_target, new_smb_fname);
 }
 
 int smb_vfs_call_readlink(struct vfs_handle_struct *handle,
-                             const char *path, char *buf, size_t bufsiz)
+                       const struct smb_filename *smb_fname,
+                       char *buf,
+                       size_t bufsiz)
 {
        VFS_FIND(readlink);
-       return handle->fns->readlink_fn(handle, path, buf, bufsiz);
+       return handle->fns->readlink_fn(handle, smb_fname, buf, bufsiz);
 }
 
-int smb_vfs_call_link(struct vfs_handle_struct *handle, const char *oldpath,
-                     const char *newpath)
+int smb_vfs_call_link(struct vfs_handle_struct *handle,
+                       const struct smb_filename *old_smb_fname,
+                       const struct smb_filename *new_smb_fname)
 {
        VFS_FIND(link);
-       return handle->fns->link_fn(handle, oldpath, newpath);
+       return handle->fns->link_fn(handle, old_smb_fname, new_smb_fname);
 }
 
-int smb_vfs_call_mknod(struct vfs_handle_struct *handle, const char *path,
-                      mode_t mode, SMB_DEV_T dev)
+int smb_vfs_call_mknod(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode,
+                       SMB_DEV_T dev)
 {
        VFS_FIND(mknod);
-       return handle->fns->mknod_fn(handle, path, mode, dev);
+       return handle->fns->mknod_fn(handle, smb_fname, mode, dev);
 }
 
 char *smb_vfs_call_realpath(struct vfs_handle_struct *handle, const char *path)
@@ -2090,11 +2218,12 @@ char *smb_vfs_call_realpath(struct vfs_handle_struct *handle, const char *path)
        return handle->fns->realpath_fn(handle, path);
 }
 
-int smb_vfs_call_chflags(struct vfs_handle_struct *handle, const char *path,
-                        unsigned int flags)
+int smb_vfs_call_chflags(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       unsigned int flags)
 {
        VFS_FIND(chflags);
-       return handle->fns->chflags_fn(handle, path, flags);
+       return handle->fns->chflags_fn(handle, smb_fname, flags);
 }
 
 struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle,
@@ -2106,13 +2235,13 @@ struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle,
 
 NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
                                 struct files_struct *fsp,
-                                const char *fname,
+                                const struct smb_filename *smb_fname,
                                 TALLOC_CTX *mem_ctx,
                                 unsigned int *num_streams,
                                 struct stream_struct **streams)
 {
        VFS_FIND(streaminfo);
-       return handle->fns->streaminfo_fn(handle, fsp, fname, mem_ctx,
+       return handle->fns->streaminfo_fn(handle, fsp, smb_fname, mem_ctx,
                                          num_streams, streams);
 }
 
@@ -2176,6 +2305,38 @@ NTSTATUS smb_vfs_call_fsctl(struct vfs_handle_struct *handle,
                                     out_len);
 }
 
+NTSTATUS smb_vfs_call_get_dos_attributes(struct vfs_handle_struct *handle,
+                                        struct smb_filename *smb_fname,
+                                        uint32_t *dosmode)
+{
+       VFS_FIND(get_dos_attributes);
+       return handle->fns->get_dos_attributes_fn(handle, smb_fname, dosmode);
+}
+
+NTSTATUS smb_vfs_call_fget_dos_attributes(struct vfs_handle_struct *handle,
+                                         struct files_struct *fsp,
+                                         uint32_t *dosmode)
+{
+       VFS_FIND(fget_dos_attributes);
+       return handle->fns->fget_dos_attributes_fn(handle, fsp, dosmode);
+}
+
+NTSTATUS smb_vfs_call_set_dos_attributes(struct vfs_handle_struct *handle,
+                                        const struct smb_filename *smb_fname,
+                                        uint32_t dosmode)
+{
+       VFS_FIND(set_dos_attributes);
+       return handle->fns->set_dos_attributes_fn(handle, smb_fname, dosmode);
+}
+
+NTSTATUS smb_vfs_call_fset_dos_attributes(struct vfs_handle_struct *handle,
+                                         struct files_struct *fsp,
+                                         uint32_t dosmode)
+{
+       VFS_FIND(set_dos_attributes);
+       return handle->fns->fset_dos_attributes_fn(handle, fsp, dosmode);
+}
+
 struct tevent_req *smb_vfs_call_copy_chunk_send(struct vfs_handle_struct *handle,
                                                TALLOC_CTX *mem_ctx,
                                                struct tevent_context *ev,
@@ -2183,11 +2344,13 @@ struct tevent_req *smb_vfs_call_copy_chunk_send(struct vfs_handle_struct *handle
                                                off_t src_off,
                                                struct files_struct *dest_fsp,
                                                off_t dest_off,
-                                               off_t num)
+                                               off_t num,
+                                               uint32_t flags)
 {
        VFS_FIND(copy_chunk_send);
        return handle->fns->copy_chunk_send_fn(handle, mem_ctx, ev, src_fsp,
-                                              src_off, dest_fsp, dest_off, num);
+                                              src_off, dest_fsp, dest_off, num,
+                                              flags);
 }
 
 NTSTATUS smb_vfs_call_copy_chunk_recv(struct vfs_handle_struct *handle,
@@ -2301,11 +2464,12 @@ NTSTATUS smb_vfs_call_audit_file(struct vfs_handle_struct *handle,
                                          access_denied);
 }
 
-int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle, const char *name,
-                          mode_t mode)
+int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle,
+               const struct smb_filename *smb_fname,
+               mode_t mode)
 {
        VFS_FIND(chmod_acl);
-       return handle->fns->chmod_acl_fn(handle, name, mode);
+       return handle->fns->chmod_acl_fn(handle, smb_fname, mode);
 }
 
 int smb_vfs_call_fchmod_acl(struct vfs_handle_struct *handle,
@@ -2316,12 +2480,12 @@ int smb_vfs_call_fchmod_acl(struct vfs_handle_struct *handle,
 }
 
 SMB_ACL_T smb_vfs_call_sys_acl_get_file(struct vfs_handle_struct *handle,
-                                       const char *path_p,
+                                       const struct smb_filename *smb_fname,
                                        SMB_ACL_TYPE_T type,
                                        TALLOC_CTX *mem_ctx)
 {
        VFS_FIND(sys_acl_get_file);
-       return handle->fns->sys_acl_get_file_fn(handle, path_p, type, mem_ctx);
+       return handle->fns->sys_acl_get_file_fn(handle, smb_fname, type, mem_ctx);
 }
 
 SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle,
@@ -2333,13 +2497,14 @@ SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle,
 }
 
 int smb_vfs_call_sys_acl_blob_get_file(struct vfs_handle_struct *handle,
-                                      const char *path_p,
-                                      TALLOC_CTX *mem_ctx, 
-                                      char **blob_description,
-                                      DATA_BLOB *blob)
+                               const struct smb_filename *smb_fname,
+                               TALLOC_CTX *mem_ctx,
+                               char **blob_description,
+                               DATA_BLOB *blob)
 {
        VFS_FIND(sys_acl_blob_get_file);
-       return handle->fns->sys_acl_blob_get_file_fn(handle, path_p, mem_ctx, blob_description, blob);
+       return handle->fns->sys_acl_blob_get_file_fn(handle, smb_fname,
+                       mem_ctx, blob_description, blob);
 }
 
 int smb_vfs_call_sys_acl_blob_get_fd(struct vfs_handle_struct *handle,
@@ -2353,11 +2518,13 @@ int smb_vfs_call_sys_acl_blob_get_fd(struct vfs_handle_struct *handle,
 }
 
 int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
-                                 const char *name, SMB_ACL_TYPE_T acltype,
-                                 SMB_ACL_T theacl)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T acltype,
+                               SMB_ACL_T theacl)
 {
        VFS_FIND(sys_acl_set_file);
-       return handle->fns->sys_acl_set_file_fn(handle, name, acltype, theacl);
+       return handle->fns->sys_acl_set_file_fn(handle, smb_fname,
+                               acltype, theacl);
 }
 
 int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
@@ -2368,18 +2535,20 @@ int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
 }
 
 int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
-                                        const char *path)
+                               const struct smb_filename *smb_fname)
 {
        VFS_FIND(sys_acl_delete_def_file);
-       return handle->fns->sys_acl_delete_def_file_fn(handle, path);
+       return handle->fns->sys_acl_delete_def_file_fn(handle, smb_fname);
 }
 
 ssize_t smb_vfs_call_getxattr(struct vfs_handle_struct *handle,
-                             const char *path, const char *name, void *value,
-                             size_t size)
+                               const struct smb_filename *smb_fname,
+                               const char *name,
+                               void *value,
+                               size_t size)
 {
        VFS_FIND(getxattr);
-       return handle->fns->getxattr_fn(handle, path, name, value, size);
+       return handle->fns->getxattr_fn(handle, smb_fname, name, value, size);
 }
 
 ssize_t smb_vfs_call_fgetxattr(struct vfs_handle_struct *handle,
@@ -2391,10 +2560,12 @@ ssize_t smb_vfs_call_fgetxattr(struct vfs_handle_struct *handle,
 }
 
 ssize_t smb_vfs_call_listxattr(struct vfs_handle_struct *handle,
-                              const char *path, char *list, size_t size)
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
        VFS_FIND(listxattr);
-       return handle->fns->listxattr_fn(handle, path, list, size);
+       return handle->fns->listxattr_fn(handle, smb_fname, list, size);
 }
 
 ssize_t smb_vfs_call_flistxattr(struct vfs_handle_struct *handle,
@@ -2406,10 +2577,11 @@ ssize_t smb_vfs_call_flistxattr(struct vfs_handle_struct *handle,
 }
 
 int smb_vfs_call_removexattr(struct vfs_handle_struct *handle,
-                            const char *path, const char *name)
+                               const struct smb_filename *smb_fname,
+                               const char *name)
 {
        VFS_FIND(removexattr);
-       return handle->fns->removexattr_fn(handle, path, name);
+       return handle->fns->removexattr_fn(handle, smb_fname, name);
 }
 
 int smb_vfs_call_fremovexattr(struct vfs_handle_struct *handle,
@@ -2419,12 +2591,16 @@ int smb_vfs_call_fremovexattr(struct vfs_handle_struct *handle,
        return handle->fns->fremovexattr_fn(handle, fsp, name);
 }
 
-int smb_vfs_call_setxattr(struct vfs_handle_struct *handle, const char *path,
-                         const char *name, const void *value, size_t size,
-                         int flags)
+int smb_vfs_call_setxattr(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *name,
+                       const void *value,
+                       size_t size,
+                       int flags)
 {
        VFS_FIND(setxattr);
-       return handle->fns->setxattr_fn(handle, path, name, value, size, flags);
+       return handle->fns->setxattr_fn(handle, smb_fname,
+                       name, value, size, flags);
 }
 
 int smb_vfs_call_fsetxattr(struct vfs_handle_struct *handle,
@@ -2442,21 +2618,6 @@ bool smb_vfs_call_aio_force(struct vfs_handle_struct *handle,
        return handle->fns->aio_force_fn(handle, fsp);
 }
 
-bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle,
-                            const struct smb_filename *fname,
-                            SMB_STRUCT_STAT *sbuf)
-{
-       VFS_FIND(is_offline);
-       return handle->fns->is_offline_fn(handle, fname, sbuf);
-}
-
-int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
-                             const struct smb_filename *fname)
-{
-       VFS_FIND(set_offline);
-       return handle->fns->set_offline_fn(handle, fname);
-}
-
 NTSTATUS smb_vfs_call_durable_cookie(struct vfs_handle_struct *handle,
                                     struct files_struct *fsp,
                                     TALLOC_CTX *mem_ctx,