vfs: add rw flag to snap_create_send
[ddiss/samba.git] / source3 / smbd / vfs.c
index 93c268f6fad792a9fede6bafbd6d9047ad7b198b..097dd8dfd38bb6d56bd8346d7391ea4f91303ad1 100644 (file)
 #include "memcache.h"
 #include "transfer_file.h"
 #include "ntioctl.h"
+#include "lib/util/tevent_unix.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
 
 static_decl_vfs;
 
+struct vfs_fsp_data {
+    struct vfs_fsp_data *next;
+    struct vfs_handle_struct *owner;
+    void (*destroy)(void *p_data);
+    void *_dummy_;
+    /* NOTE: This structure contains four pointers so that we can guarantee
+     * that the end of the structure is always both 4-byte and 8-byte aligned.
+     */
+};
+
 struct vfs_init_function_entry {
        char *name;
        struct vfs_init_function_entry *prev, *next;
@@ -261,6 +272,23 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
        }
 }
 
+void vfs_remove_all_fsp_extensions(files_struct *fsp)
+{
+       struct vfs_fsp_data *curr;
+       struct vfs_fsp_data *next;
+
+       for (curr = fsp->vfs_extension; curr; curr = next) {
+
+               next = curr->next;
+               fsp->vfs_extension = next;
+
+               if (curr->destroy) {
+                       curr->destroy(EXT_DATA_AREA(curr));
+               }
+               TALLOC_FREE(curr);
+       }
+}
+
 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
 {
        struct vfs_fsp_data *head;
@@ -300,6 +328,12 @@ bool smbd_vfs_init(connection_struct *conn)
 
        /* Normal share - initialise with disk access functions */
        vfs_init_default(conn);
+
+       /* No need to load vfs modules for printer connections */
+       if (conn->printer) {
+               return True;
+       }
+
        vfs_objects = lp_vfs_objects(SNUM(conn));
 
        /* Override VFS functions if 'vfs object' was not specified*/
@@ -360,7 +394,7 @@ ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count)
 }
 
 ssize_t vfs_pread_data(files_struct *fsp, char *buf,
-                size_t byte_count, SMB_OFF_T offset)
+                size_t byte_count, off_t offset)
 {
        size_t total=0;
 
@@ -400,7 +434,7 @@ ssize_t vfs_write_data(struct smb_request *req,
                req->unread_bytes = 0;
                return SMB_VFS_RECVFILE(req->sconn->sock,
                                        fsp,
-                                       (SMB_OFF_T)-1,
+                                       (off_t)-1,
                                        N);
        }
 
@@ -421,7 +455,7 @@ ssize_t vfs_pwrite_data(struct smb_request *req,
                        files_struct *fsp,
                        const char *buffer,
                        size_t N,
-                       SMB_OFF_T offset)
+                       off_t offset)
 {
        size_t total=0;
        ssize_t ret;
@@ -471,7 +505,7 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
        DEBUG(10,("vfs_allocate_file_space: file %s, len %.0f\n",
                  fsp_str_dbg(fsp), (double)len));
 
-       if (((SMB_OFF_T)len) < 0) {
+       if (((off_t)len) < 0) {
                DEBUG(0,("vfs_allocate_file_space: %s negative len "
                         "requested.\n", fsp_str_dbg(fsp)));
                errno = EINVAL;
@@ -496,7 +530,7 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
                contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_ALLOC_SHRINK);
 
                flush_write_cache(fsp, SIZECHANGE_FLUSH);
-               if ((ret = SMB_VFS_FTRUNCATE(fsp, (SMB_OFF_T)len)) != -1) {
+               if ((ret = SMB_VFS_FTRUNCATE(fsp, (off_t)len)) != -1) {
                        set_filelen_write_cache(fsp, len);
                }
 
@@ -551,7 +585,7 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
  Returns 0 on success, -1 on failure.
 ****************************************************************************/
 
-int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len)
+int vfs_set_filelen(files_struct *fsp, off_t len)
 {
        int ret;
 
@@ -583,7 +617,7 @@ int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len)
 
 #define SPARSE_BUF_WRITE_SIZE (32*1024)
 
-int vfs_slow_fallocate(files_struct *fsp, SMB_OFF_T offset, SMB_OFF_T len)
+int vfs_slow_fallocate(files_struct *fsp, off_t offset, off_t len)
 {
        ssize_t pwrite_ret;
        size_t total = 0;
@@ -619,11 +653,11 @@ int vfs_slow_fallocate(files_struct *fsp, SMB_OFF_T offset, SMB_OFF_T len)
  Returns 0 on success, -1 on failure.
 ****************************************************************************/
 
-int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
+int vfs_fill_sparse(files_struct *fsp, off_t len)
 {
        int ret;
        NTSTATUS status;
-       SMB_OFF_T offset;
+       off_t offset;
        size_t num_to_write;
 
        status = vfs_stat_fsp(fsp);
@@ -708,7 +742,7 @@ static ssize_t vfs_write_fn(void *file, const void *buf, size_t len)
        return SMB_VFS_WRITE(fsp, buf, len);
 }
 
-SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n)
+off_t vfs_transfer_file(files_struct *in, files_struct *out, off_t n)
 {
        return transfer_file_internal((void *)in, (void *)out, n,
                                      vfs_read_fn, vfs_write_fn);
@@ -765,26 +799,34 @@ const char *vfs_readdirname(connection_struct *conn, void *p,
 
 int vfs_ChDir(connection_struct *conn, const char *path)
 {
-       int res;
+       int ret;
 
        if (!LastDir) {
                LastDir = SMB_STRDUP("");
        }
 
-       if (strcsequal(path,"."))
-               return(0);
+       if (strcsequal(path,".")) {
+               return 0;
+       }
 
-       if (*path == '/' && strcsequal(LastDir,path))
-               return(0);
+       if (*path == '/' && strcsequal(LastDir,path)) {
+               return 0;
+       }
 
        DEBUG(4,("vfs_ChDir to %s\n",path));
 
-       res = SMB_VFS_CHDIR(conn,path);
-       if (!res) {
+       ret = SMB_VFS_CHDIR(conn,path);
+       if (ret == 0) {
+               /* Global cache. */
                SAFE_FREE(LastDir);
                LastDir = SMB_STRDUP(path);
+
+               /* conn cache. */
+               TALLOC_FREE(conn->cwd);
+               conn->cwd = vfs_GetWd(conn, conn);
+               DEBUG(4,("vfs_ChDir got %s\n",conn->cwd));
        }
-       return(res);
+       return ret;
 }
 
 /*******************************************************************
@@ -1058,6 +1100,7 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(priv_paths);
        }
+       TALLOC_FREE(dir_name);
        return status;
 }
 
@@ -1089,6 +1132,7 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
                                char *dir_name = NULL;
                                const char *last_component = NULL;
                                char *new_name = NULL;
+                               int ret;
 
                                /* Last component didn't exist.
                                   Remove it and try and canonicalise
@@ -1114,18 +1158,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
                                                nt_errstr(status)));
                                        return status;
                                }
-                               new_name = talloc_asprintf(ctx,
-                                               "%s/%s",
-                                               resolved_name,
-                                               last_component);
-                               if (!new_name) {
-                                       return NT_STATUS_NO_MEMORY;
-                               }
+                               ret = asprintf(&new_name, "%s/%s",
+                                              resolved_name, last_component);
                                SAFE_FREE(resolved_name);
-                               resolved_name = SMB_STRDUP(new_name);
-                               if (!resolved_name) {
+                               if (ret == -1) {
                                        return NT_STATUS_NO_MEMORY;
                                }
+                               resolved_name = new_name;
                                break;
                        }
                        default:
@@ -1195,8 +1234,8 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
                        p++;
                        if (strcmp(fname, p)!=0) {
                                DEBUG(2, ("check_reduced_name: Bad access "
-                                       "attempt: %s is a symlink\n",
-                                       fname));
+                                       "attempt: %s is a symlink to %s\n",
+                                         fname, p));
                                SAFE_FREE(resolved_name);
                                return NT_STATUS_ACCESS_DENIED;
                        }
@@ -1511,12 +1550,76 @@ ssize_t smb_vfs_call_read(struct vfs_handle_struct *handle,
 
 ssize_t smb_vfs_call_pread(struct vfs_handle_struct *handle,
                           struct files_struct *fsp, void *data, size_t n,
-                          SMB_OFF_T offset)
+                          off_t offset)
 {
        VFS_FIND(pread);
        return handle->fns->pread_fn(handle, fsp, data, n, offset);
 }
 
+struct smb_vfs_call_pread_state {
+       ssize_t (*recv_fn)(struct tevent_req *req, int *err);
+       ssize_t retval;
+};
+
+static void smb_vfs_call_pread_done(struct tevent_req *subreq);
+
+struct tevent_req *smb_vfs_call_pread_send(struct vfs_handle_struct *handle,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct tevent_context *ev,
+                                          struct files_struct *fsp,
+                                          void *data,
+                                          size_t n, off_t offset)
+{
+       struct tevent_req *req, *subreq;
+       struct smb_vfs_call_pread_state *state;
+
+       req = tevent_req_create(mem_ctx, &state,
+                               struct smb_vfs_call_pread_state);
+       if (req == NULL) {
+               return NULL;
+       }
+       VFS_FIND(pread_send);
+       state->recv_fn = handle->fns->pread_recv_fn;
+
+       subreq = handle->fns->pread_send_fn(handle, state, ev, fsp, data, n,
+                                           offset);
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+       tevent_req_set_callback(subreq, smb_vfs_call_pread_done, req);
+       return req;
+}
+
+static void smb_vfs_call_pread_done(struct tevent_req *subreq)
+{
+       struct tevent_req *req = tevent_req_callback_data(
+               subreq, struct tevent_req);
+       struct smb_vfs_call_pread_state *state = tevent_req_data(
+               req, struct smb_vfs_call_pread_state);
+       int err;
+
+       state->retval = state->recv_fn(subreq, &err);
+       TALLOC_FREE(subreq);
+       if (state->retval == -1) {
+               tevent_req_error(req, err);
+               return;
+       }
+       tevent_req_done(req);
+}
+
+ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req, int *perrno)
+{
+       struct smb_vfs_call_pread_state *state = tevent_req_data(
+               req, struct smb_vfs_call_pread_state);
+       int err;
+
+       if (tevent_req_is_unix_error(req, &err)) {
+               *perrno = err;
+               return -1;
+       }
+       return state->retval;
+}
+
 ssize_t smb_vfs_call_write(struct vfs_handle_struct *handle,
                           struct files_struct *fsp, const void *data,
                           size_t n)
@@ -1527,14 +1630,78 @@ ssize_t smb_vfs_call_write(struct vfs_handle_struct *handle,
 
 ssize_t smb_vfs_call_pwrite(struct vfs_handle_struct *handle,
                            struct files_struct *fsp, const void *data,
-                           size_t n, SMB_OFF_T offset)
+                           size_t n, off_t offset)
 {
        VFS_FIND(pwrite);
        return handle->fns->pwrite_fn(handle, fsp, data, n, offset);
 }
 
-SMB_OFF_T smb_vfs_call_lseek(struct vfs_handle_struct *handle,
-                            struct files_struct *fsp, SMB_OFF_T offset,
+struct smb_vfs_call_pwrite_state {
+       ssize_t (*recv_fn)(struct tevent_req *req, int *err);
+       ssize_t retval;
+};
+
+static void smb_vfs_call_pwrite_done(struct tevent_req *subreq);
+
+struct tevent_req *smb_vfs_call_pwrite_send(struct vfs_handle_struct *handle,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct tevent_context *ev,
+                                           struct files_struct *fsp,
+                                           const void *data,
+                                           size_t n, off_t offset)
+{
+       struct tevent_req *req, *subreq;
+       struct smb_vfs_call_pwrite_state *state;
+
+       req = tevent_req_create(mem_ctx, &state,
+                               struct smb_vfs_call_pwrite_state);
+       if (req == NULL) {
+               return NULL;
+       }
+       VFS_FIND(pwrite_send);
+       state->recv_fn = handle->fns->pwrite_recv_fn;
+
+       subreq = handle->fns->pwrite_send_fn(handle, state, ev, fsp, data, n,
+                                            offset);
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+       tevent_req_set_callback(subreq, smb_vfs_call_pwrite_done, req);
+       return req;
+}
+
+static void smb_vfs_call_pwrite_done(struct tevent_req *subreq)
+{
+       struct tevent_req *req = tevent_req_callback_data(
+               subreq, struct tevent_req);
+       struct smb_vfs_call_pwrite_state *state = tevent_req_data(
+               req, struct smb_vfs_call_pwrite_state);
+       int err;
+
+       state->retval = state->recv_fn(subreq, &err);
+       TALLOC_FREE(subreq);
+       if (state->retval == -1) {
+               tevent_req_error(req, err);
+               return;
+       }
+       tevent_req_done(req);
+}
+
+ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req, int *perrno)
+{
+       struct smb_vfs_call_pwrite_state *state = tevent_req_data(
+               req, struct smb_vfs_call_pwrite_state);
+       int err;
+
+       if (tevent_req_is_unix_error(req, &err)) {
+               *perrno = err;
+               return -1;
+       }
+       return state->retval;
+}
+
+off_t smb_vfs_call_lseek(struct vfs_handle_struct *handle,
+                            struct files_struct *fsp, off_t offset,
                             int whence)
 {
        VFS_FIND(lseek);
@@ -1543,7 +1710,7 @@ SMB_OFF_T smb_vfs_call_lseek(struct vfs_handle_struct *handle,
 
 ssize_t smb_vfs_call_sendfile(struct vfs_handle_struct *handle, int tofd,
                              files_struct *fromfsp, const DATA_BLOB *header,
-                             SMB_OFF_T offset, size_t count)
+                             off_t offset, size_t count)
 {
        VFS_FIND(sendfile);
        return handle->fns->sendfile_fn(handle, tofd, fromfsp, header, offset,
@@ -1551,7 +1718,7 @@ ssize_t smb_vfs_call_sendfile(struct vfs_handle_struct *handle, int tofd,
 }
 
 ssize_t smb_vfs_call_recvfile(struct vfs_handle_struct *handle, int fromfd,
-                             files_struct *tofsp, SMB_OFF_T offset,
+                             files_struct *tofsp, off_t offset,
                              size_t count)
 {
        VFS_FIND(recvfile);
@@ -1573,6 +1740,68 @@ int smb_vfs_call_fsync(struct vfs_handle_struct *handle,
        return handle->fns->fsync_fn(handle, fsp);
 }
 
+struct smb_vfs_call_fsync_state {
+       int (*recv_fn)(struct tevent_req *req, int *err);
+       int retval;
+};
+
+static void smb_vfs_call_fsync_done(struct tevent_req *subreq);
+
+struct tevent_req *smb_vfs_call_fsync_send(struct vfs_handle_struct *handle,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct tevent_context *ev,
+                                          struct files_struct *fsp)
+{
+       struct tevent_req *req, *subreq;
+       struct smb_vfs_call_fsync_state *state;
+
+       req = tevent_req_create(mem_ctx, &state,
+                               struct smb_vfs_call_fsync_state);
+       if (req == NULL) {
+               return NULL;
+       }
+       VFS_FIND(fsync_send);
+       state->recv_fn = handle->fns->fsync_recv_fn;
+
+       subreq = handle->fns->fsync_send_fn(handle, state, ev, fsp);
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+       tevent_req_set_callback(subreq, smb_vfs_call_fsync_done, req);
+       return req;
+}
+
+static void smb_vfs_call_fsync_done(struct tevent_req *subreq)
+{
+       struct tevent_req *req = tevent_req_callback_data(
+               subreq, struct tevent_req);
+       struct smb_vfs_call_fsync_state *state = tevent_req_data(
+               req, struct smb_vfs_call_fsync_state);
+       int err;
+
+       state->retval = state->recv_fn(subreq, &err);
+       TALLOC_FREE(subreq);
+       if (state->retval == -1) {
+               tevent_req_error(req, err);
+               return;
+       }
+       tevent_req_done(req);
+}
+
+int SMB_VFS_FSYNC_RECV(struct tevent_req *req, int *perrno)
+{
+       struct smb_vfs_call_fsync_state *state = tevent_req_data(
+               req, struct smb_vfs_call_fsync_state);
+       int err;
+
+       if (tevent_req_is_unix_error(req, &err)) {
+               *perrno = err;
+               return -1;
+       }
+       return state->retval;
+}
+
+
 int smb_vfs_call_stat(struct vfs_handle_struct *handle,
                      struct smb_filename *smb_fname)
 {
@@ -1765,7 +1994,7 @@ int smb_vfs_call_ntimes(struct vfs_handle_struct *handle,
 }
 
 int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle,
-                          struct files_struct *fsp, SMB_OFF_T offset)
+                          struct files_struct *fsp, off_t offset)
 {
        VFS_FIND(ftruncate);
        return handle->fns->ftruncate_fn(handle, fsp, offset);
@@ -1774,8 +2003,8 @@ int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle,
 int smb_vfs_call_fallocate(struct vfs_handle_struct *handle,
                                struct files_struct *fsp,
                                enum vfs_fallocate_mode mode,
-                               SMB_OFF_T offset,
-                               SMB_OFF_T len)
+                               off_t offset,
+                               off_t len)
 {
        VFS_FIND(fallocate);
        return handle->fns->fallocate_fn(handle, fsp, mode, offset, len);
@@ -1928,11 +2157,81 @@ NTSTATUS smb_vfs_call_fsctl(struct vfs_handle_struct *handle,
                            uint32_t *out_len)
 {
        VFS_FIND(fsctl);
-       return handle->fns->fsctl_fn(handle, fsp, ctx, function, req_flags, 
-                                    in_data, in_len, out_data, max_out_len, 
+       return handle->fns->fsctl_fn(handle, fsp, ctx, function, req_flags,
+                                    in_data, in_len, out_data, max_out_len,
                                     out_len);
 }
 
+struct tevent_req *smb_vfs_call_copy_chunk_send(struct vfs_handle_struct *handle,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct tevent_context *ev,
+                                               struct files_struct *src_fsp,
+                                               off_t src_off,
+                                               struct files_struct *dest_fsp,
+                                               off_t dest_off,
+                                               off_t num)
+{
+       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);
+}
+
+NTSTATUS smb_vfs_call_copy_chunk_recv(struct vfs_handle_struct *handle,
+                                     struct tevent_req *req,
+                                     off_t *copied)
+{
+       VFS_FIND(copy_chunk_recv);
+       return handle->fns->copy_chunk_recv_fn(handle, req, copied);
+}
+
+NTSTATUS smb_vfs_call_snap_check_path(vfs_handle_struct *handle,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *service_path,
+                                     char **base_volume)
+{
+       VFS_FIND(snap_check_path);
+       return handle->fns->snap_check_path_fn(handle, mem_ctx, service_path,
+                                              base_volume);
+}
+
+struct tevent_req *smb_vfs_call_snap_create_send(struct vfs_handle_struct *handle,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct tevent_context *ev,
+                                                const char *base_volume,
+                                                time_t *tstamp,
+                                                bool rw)
+{
+       VFS_FIND(snap_create_send);
+       return handle->fns->snap_create_send_fn(handle, mem_ctx, ev,
+                                               base_volume, tstamp, rw);
+}
+
+NTSTATUS smb_vfs_call_snap_create_recv(struct vfs_handle_struct *handle,
+                                      struct tevent_req *req,
+                                      TALLOC_CTX *mem_ctx,
+                                      char **base_path, char **snap_path)
+{
+       VFS_FIND(snap_create_recv);
+       return handle->fns->snap_create_recv_fn(handle, req, mem_ctx,
+                                               base_path, snap_path);
+}
+
+struct tevent_req *smb_vfs_call_snap_delete_send(struct vfs_handle_struct *handle,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct tevent_context *ev,
+                                                char *snap_path)
+{
+       VFS_FIND(snap_delete_send);
+       return handle->fns->snap_delete_send_fn(handle, mem_ctx, ev, snap_path);
+}
+
+NTSTATUS smb_vfs_call_snap_delete_recv(struct vfs_handle_struct *handle,
+                                      struct tevent_req *req)
+{
+       VFS_FIND(snap_delete_recv);
+       return handle->fns->snap_delete_recv_fn(handle, req);
+}
+
 NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle,
                                  struct files_struct *fsp,
                                  uint32 security_info,
@@ -1962,6 +2261,20 @@ NTSTATUS smb_vfs_call_fset_nt_acl(struct vfs_handle_struct *handle,
                                           psd);
 }
 
+NTSTATUS smb_vfs_call_audit_file(struct vfs_handle_struct *handle,
+                                struct smb_filename *file,
+                                struct security_acl *sacl,
+                                uint32_t access_requested,
+                                uint32_t access_denied)
+{
+       VFS_FIND(audit_file);
+       return handle->fns->audit_file_fn(handle, 
+                                         file, 
+                                         sacl, 
+                                         access_requested, 
+                                         access_denied);
+}
+
 int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle, const char *name,
                           mode_t mode)
 {
@@ -1976,39 +2289,6 @@ int smb_vfs_call_fchmod_acl(struct vfs_handle_struct *handle,
        return handle->fns->fchmod_acl_fn(handle, fsp, mode);
 }
 
-int smb_vfs_call_sys_acl_get_entry(struct vfs_handle_struct *handle,
-                                  SMB_ACL_T theacl, int entry_id,
-                                  SMB_ACL_ENTRY_T *entry_p)
-{
-       VFS_FIND(sys_acl_get_entry);
-       return handle->fns->sys_acl_get_entry_fn(handle, theacl, entry_id,
-                                                entry_p);
-}
-
-int smb_vfs_call_sys_acl_get_tag_type(struct vfs_handle_struct *handle,
-                                     SMB_ACL_ENTRY_T entry_d,
-                                     SMB_ACL_TAG_T *tag_type_p)
-{
-       VFS_FIND(sys_acl_get_tag_type);
-       return handle->fns->sys_acl_get_tag_type_fn(handle, entry_d, 
-                                                   tag_type_p);
-}
-
-int smb_vfs_call_sys_acl_get_permset(struct vfs_handle_struct *handle,
-                                    SMB_ACL_ENTRY_T entry_d,
-                                    SMB_ACL_PERMSET_T *permset_p)
-{
-       VFS_FIND(sys_acl_get_permset);
-       return handle->fns->sys_acl_get_permset_fn(handle, entry_d, permset_p);
-}
-
-void * smb_vfs_call_sys_acl_get_qualifier(struct vfs_handle_struct *handle,
-                                         SMB_ACL_ENTRY_T entry_d)
-{
-       VFS_FIND(sys_acl_get_qualifier);
-       return handle->fns->sys_acl_get_qualifier_fn(handle, entry_d);
-}
-
 SMB_ACL_T smb_vfs_call_sys_acl_get_file(struct vfs_handle_struct *handle,
                                        const char *path_p,
                                        SMB_ACL_TYPE_T type)
@@ -2024,70 +2304,25 @@ SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle,
        return handle->fns->sys_acl_get_fd_fn(handle, fsp);
 }
 
-int smb_vfs_call_sys_acl_clear_perms(struct vfs_handle_struct *handle,
-                                    SMB_ACL_PERMSET_T permset)
-{
-       VFS_FIND(sys_acl_clear_perms);
-       return handle->fns->sys_acl_clear_perms_fn(handle, permset);
-}
-
-int smb_vfs_call_sys_acl_add_perm(struct vfs_handle_struct *handle,
-                                 SMB_ACL_PERMSET_T permset,
-                                 SMB_ACL_PERM_T perm)
-{
-       VFS_FIND(sys_acl_add_perm);
-       return handle->fns->sys_acl_add_perm_fn(handle, permset, perm);
-}
-
-char * smb_vfs_call_sys_acl_to_text(struct vfs_handle_struct *handle,
-                                   SMB_ACL_T theacl, ssize_t *plen)
-{
-       VFS_FIND(sys_acl_to_text);
-       return handle->fns->sys_acl_to_text_fn(handle, theacl, plen);
-}
-
-SMB_ACL_T smb_vfs_call_sys_acl_init(struct vfs_handle_struct *handle,
-                                   int count)
-{
-       VFS_FIND(sys_acl_init);
-       return handle->fns->sys_acl_init_fn(handle, count);
-}
-
-int smb_vfs_call_sys_acl_create_entry(struct vfs_handle_struct *handle,
-                                     SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
+int smb_vfs_call_sys_acl_blob_get_file(struct vfs_handle_struct *handle,
+                                      const char *path_p,
+                                      SMB_ACL_TYPE_T type,
+                                      TALLOC_CTX *mem_ctx, 
+                                      char **blob_description,
+                                      DATA_BLOB *blob)
 {
-       VFS_FIND(sys_acl_create_entry);
-       return handle->fns->sys_acl_create_entry_fn(handle, pacl, pentry);
+       VFS_FIND(sys_acl_blob_get_file);
+       return handle->fns->sys_acl_blob_get_file_fn(handle, path_p, type, mem_ctx, blob_description, blob);
 }
 
-int smb_vfs_call_sys_acl_set_tag_type(struct vfs_handle_struct *handle,
-                                     SMB_ACL_ENTRY_T entry,
-                                     SMB_ACL_TAG_T tagtype)
-{
-       VFS_FIND(sys_acl_set_tag_type);
-       return handle->fns->sys_acl_set_tag_type_fn(handle, entry, tagtype);
-}
-
-int smb_vfs_call_sys_acl_set_qualifier(struct vfs_handle_struct *handle,
-                                      SMB_ACL_ENTRY_T entry, void *qual)
-{
-       VFS_FIND(sys_acl_set_qualifier);
-       return handle->fns->sys_acl_set_qualifier_fn(handle, entry, qual);
-}
-
-int smb_vfs_call_sys_acl_set_permset(struct vfs_handle_struct *handle,
-                                    SMB_ACL_ENTRY_T entry,
-                                    SMB_ACL_PERMSET_T permset)
-{
-       VFS_FIND(sys_acl_set_permset);
-       return handle->fns->sys_acl_set_permset_fn(handle, entry, permset);
-}
-
-int smb_vfs_call_sys_acl_valid(struct vfs_handle_struct *handle,
-                              SMB_ACL_T theacl)
+int smb_vfs_call_sys_acl_blob_get_fd(struct vfs_handle_struct *handle,
+                                    struct files_struct *fsp,
+                                    TALLOC_CTX *mem_ctx, 
+                                    char **blob_description,
+                                    DATA_BLOB *blob)
 {
-       VFS_FIND(sys_acl_valid);
-       return handle->fns->sys_acl_valid_fn(handle, theacl);
+       VFS_FIND(sys_acl_blob_get_fd);
+       return handle->fns->sys_acl_blob_get_fd_fn(handle, fsp, mem_ctx, blob_description, blob);
 }
 
 int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
@@ -2112,36 +2347,6 @@ int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
        return handle->fns->sys_acl_delete_def_file_fn(handle, path);
 }
 
-int smb_vfs_call_sys_acl_get_perm(struct vfs_handle_struct *handle,
-                                 SMB_ACL_PERMSET_T permset,
-                                 SMB_ACL_PERM_T perm)
-{
-       VFS_FIND(sys_acl_get_perm);
-       return handle->fns->sys_acl_get_perm_fn(handle, permset, perm);
-}
-
-int smb_vfs_call_sys_acl_free_text(struct vfs_handle_struct *handle,
-                                  char *text)
-{
-       VFS_FIND(sys_acl_free_text);
-       return handle->fns->sys_acl_free_text_fn(handle, text);
-}
-
-int smb_vfs_call_sys_acl_free_acl(struct vfs_handle_struct *handle,
-                                 SMB_ACL_T posix_acl)
-{
-       VFS_FIND(sys_acl_free_acl);
-       return handle->fns->sys_acl_free_acl_fn(handle, posix_acl);
-}
-
-int smb_vfs_call_sys_acl_free_qualifier(struct vfs_handle_struct *handle,
-                                       void *qualifier, SMB_ACL_TAG_T tagtype)
-{
-       VFS_FIND(sys_acl_free_qualifier);
-       return handle->fns->sys_acl_free_qualifier_fn(handle, qualifier, 
-                                                     tagtype);
-}
-
 ssize_t smb_vfs_call_getxattr(struct vfs_handle_struct *handle,
                              const char *path, const char *name, void *value,
                              size_t size)
@@ -2165,13 +2370,6 @@ ssize_t smb_vfs_call_listxattr(struct vfs_handle_struct *handle,
        return handle->fns->listxattr_fn(handle, path, list, size);
 }
 
-ssize_t smb_vfs_call_llistxattr(struct vfs_handle_struct *handle,
-                               const char *path, char *list, size_t size)
-{
-       VFS_FIND(llistxattr);
-       return handle->fns->llistxattr_fn(handle, path, list, size);
-}
-
 ssize_t smb_vfs_call_flistxattr(struct vfs_handle_struct *handle,
                                struct files_struct *fsp, char *list,
                                size_t size)
@@ -2187,13 +2385,6 @@ int smb_vfs_call_removexattr(struct vfs_handle_struct *handle,
        return handle->fns->removexattr_fn(handle, path, name);
 }
 
-int smb_vfs_call_lremovexattr(struct vfs_handle_struct *handle,
-                             const char *path, const char *name)
-{
-       VFS_FIND(lremovexattr);
-       return handle->fns->lremovexattr_fn(handle, path, name);
-}
-
 int smb_vfs_call_fremovexattr(struct vfs_handle_struct *handle,
                              struct files_struct *fsp, const char *name)
 {
@@ -2209,15 +2400,6 @@ int smb_vfs_call_setxattr(struct vfs_handle_struct *handle, const char *path,
        return handle->fns->setxattr_fn(handle, path, name, value, size, flags);
 }
 
-int smb_vfs_call_lsetxattr(struct vfs_handle_struct *handle, const char *path,
-                          const char *name, const void *value, size_t size,
-                          int flags)
-{
-       VFS_FIND(lsetxattr);
-       return handle->fns->lsetxattr_fn(handle, path, name, value, size, 
-                                        flags);
-}
-
 int smb_vfs_call_fsetxattr(struct vfs_handle_struct *handle,
                           struct files_struct *fsp, const char *name,
                           const void *value, size_t size, int flags)
@@ -2226,60 +2408,6 @@ int smb_vfs_call_fsetxattr(struct vfs_handle_struct *handle,
        return handle->fns->fsetxattr_fn(handle, fsp, name, value, size, flags);
 }
 
-int smb_vfs_call_aio_read(struct vfs_handle_struct *handle,
-                         struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
-{
-       VFS_FIND(aio_read);
-       return handle->fns->aio_read_fn(handle, fsp, aiocb);
-}
-
-int smb_vfs_call_aio_write(struct vfs_handle_struct *handle,
-                          struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
-{
-       VFS_FIND(aio_write);
-       return handle->fns->aio_write_fn(handle, fsp, aiocb);
-}
-
-ssize_t smb_vfs_call_aio_return(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp,
-                               SMB_STRUCT_AIOCB *aiocb)
-{
-       VFS_FIND(aio_return);
-       return handle->fns->aio_return_fn(handle, fsp, aiocb);
-}
-
-int smb_vfs_call_aio_cancel(struct vfs_handle_struct *handle,
-                           struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
-{
-       VFS_FIND(aio_cancel);
-       return handle->fns->aio_cancel_fn(handle, fsp, aiocb);
-}
-
-int smb_vfs_call_aio_error(struct vfs_handle_struct *handle,
-                          struct files_struct *fsp,
-                          SMB_STRUCT_AIOCB *aiocb)
-{
-       VFS_FIND(aio_error);
-       return handle->fns->aio_error_fn(handle, fsp, aiocb);
-}
-
-int smb_vfs_call_aio_fsync(struct vfs_handle_struct *handle,
-                          struct files_struct *fsp, int op,
-                          SMB_STRUCT_AIOCB *aiocb)
-{
-       VFS_FIND(aio_fsync);
-       return handle->fns->aio_fsync_fn(handle, fsp, op, aiocb);
-}
-
-int smb_vfs_call_aio_suspend(struct vfs_handle_struct *handle,
-                            struct files_struct *fsp,
-                            const SMB_STRUCT_AIOCB * const aiocb[], int n,
-                            const struct timespec *timeout)
-{
-       VFS_FIND(aio_suspend);
-       return handle->fns->aio_suspend_fn(handle, fsp, aiocb, n, timeout);
-}
-
 bool smb_vfs_call_aio_force(struct vfs_handle_struct *handle,
                            struct files_struct *fsp)
 {
@@ -2301,3 +2429,37 @@ int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
        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,
+                                    DATA_BLOB *cookie)
+{
+       VFS_FIND(durable_cookie);
+       return handle->fns->durable_cookie_fn(handle, fsp, mem_ctx, cookie);
+}
+
+NTSTATUS smb_vfs_call_durable_disconnect(struct vfs_handle_struct *handle,
+                                        struct files_struct *fsp,
+                                        const DATA_BLOB old_cookie,
+                                        TALLOC_CTX *mem_ctx,
+                                        DATA_BLOB *new_cookie)
+{
+       VFS_FIND(durable_disconnect);
+       return handle->fns->durable_disconnect_fn(handle, fsp, old_cookie,
+                                                 mem_ctx, new_cookie);
+}
+
+NTSTATUS smb_vfs_call_durable_reconnect(struct vfs_handle_struct *handle,
+                                       struct smb_request *smb1req,
+                                       struct smbXsrv_open *op,
+                                       const DATA_BLOB old_cookie,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct files_struct **fsp,
+                                       DATA_BLOB *new_cookie)
+{
+       VFS_FIND(durable_reconnect);
+       return handle->fns->durable_reconnect_fn(handle, smb1req, op,
+                                                old_cookie, mem_ctx, fsp,
+                                                new_cookie);
+}