selftest/Samba4: make use of get_cmd_env_vars() to setup all relevant env variables
[samba.git] / source3 / modules / vfs_catia.c
index 22b0696e73d1ad13ee9d5cf2835a1e0e4fdbfe65..36aa43123fd4c510a0ba511ae6e9a36442115803 100644 (file)
@@ -166,7 +166,7 @@ static int catia_connect(struct vfs_handle_struct *handle,
         * Unless we have an async implementation of get_dos_attributes turn
         * this off.
         */
-       lp_do_parameter(SNUM(handle->conn), "smbd:async dosmode", "false");
+       lp_do_parameter(SNUM(handle->conn), "smbd async dosmode", "false");
 
        return SMB_VFS_NEXT_CONNECT(handle, service, user);
 }
@@ -286,7 +286,7 @@ static struct catia_cache *catia_validate_and_apply_cc(
 
                if ((cc->fname != fsp->fsp_name->base_name)
                    ||
-                   ((fsp->base_fsp != NULL) &&
+                   (fsp_is_alternate_stream(fsp) &&
                     (cc->base_fname != fsp->base_fsp->fsp_name->base_name)))
                {
                        CATIA_DEBUG_CC(10, cc, fsp);
@@ -312,7 +312,7 @@ static struct catia_cache *catia_validate_and_apply_cc(
 
        if ((cc->orig_fname != fsp->fsp_name->base_name)
            ||
-           ((fsp->base_fsp != NULL) &&
+           (fsp_is_alternate_stream(fsp) &&
             (cc->orig_base_fname != fsp->base_fsp->fsp_name->base_name)))
        {
                /*
@@ -331,7 +331,7 @@ static struct catia_cache *catia_validate_and_apply_cc(
         * names from the cache and mark the cc as busy.
         */
        fsp->fsp_name->base_name = cc->fname;
-       if (fsp->base_fsp != NULL) {
+       if (fsp_is_alternate_stream(fsp)) {
                fsp->base_fsp->fsp_name->base_name = cc->base_fname;
        }
 
@@ -407,7 +407,7 @@ static int catia_fetch_fsp_pre_next(TALLOC_CTX *mem_ctx,
        }
        talloc_steal(mem_ctx, cc->fname);
 
-       if (fsp->base_fsp != NULL) {
+       if (fsp_is_alternate_stream(fsp)) {
                status = catia_string_replace_allocate(
                        handle->conn,
                        fsp->base_fsp->fsp_name->base_name,
@@ -424,7 +424,7 @@ static int catia_fetch_fsp_pre_next(TALLOC_CTX *mem_ctx,
        cc->orig_fname = fsp->fsp_name->base_name;
        fsp->fsp_name->base_name = cc->fname;
 
-       if (fsp->base_fsp != NULL) {
+       if (fsp_is_alternate_stream(fsp)) {
                cc->orig_base_fname = fsp->base_fsp->fsp_name->base_name;
                fsp->base_fsp->fsp_name->base_name = cc->base_fname;
        }
@@ -472,7 +472,7 @@ static void catia_fetch_fsp_post_next(struct catia_cache **_cc,
        *_cc = NULL;
 
        fsp->fsp_name->base_name = cc->orig_fname;
-       if (fsp->base_fsp != NULL) {
+       if (fsp_is_alternate_stream(fsp)) {
                fsp->base_fsp->fsp_name->base_name = cc->orig_base_fname;
        }
 
@@ -489,8 +489,7 @@ static int catia_openat(vfs_handle_struct *handle,
                        const struct files_struct *dirfsp,
                        const struct smb_filename *smb_fname_in,
                        files_struct *fsp,
-                       int flags,
-                       mode_t mode)
+                       const struct vfs_open_how *how)
 {
        struct smb_filename *smb_fname = NULL;
        struct catia_cache *cc = NULL;
@@ -525,9 +524,7 @@ static int catia_openat(vfs_handle_struct *handle,
                                  dirfsp,
                                  smb_fname,
                                  fsp,
-                                 flags,
-                                 mode);
-
+                                 how);
        if (ret == -1) {
                saved_errno = errno;
        }
@@ -972,65 +969,6 @@ catia_fstreaminfo(struct vfs_handle_struct *handle,
        return NT_STATUS_OK;
 }
 
-static ssize_t
-catia_getxattr(vfs_handle_struct *handle,
-                       const struct smb_filename *smb_fname,
-                       const char *name,
-                       void *value,
-                       size_t size)
-{
-       struct smb_filename *mapped_smb_fname = NULL;
-       char *mapped_name = NULL;
-       char *mapped_ea_name = NULL;
-       NTSTATUS status;
-       ssize_t ret;
-       int saved_errno = 0;
-
-       status = catia_string_replace_allocate(handle->conn,
-                               smb_fname->base_name,
-                               &mapped_name,
-                               vfs_translate_to_unix);
-       if (!NT_STATUS_IS_OK(status)) {
-               errno = map_errno_from_nt_status(status);
-               return -1;
-       }
-
-       status = catia_string_replace_allocate(handle->conn,
-                               name, &mapped_ea_name, vfs_translate_to_unix);
-       if (!NT_STATUS_IS_OK(status)) {
-               TALLOC_FREE(mapped_name);
-               errno = map_errno_from_nt_status(status);
-               return -1;
-       }
-
-       mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
-                                       mapped_name,
-                                       NULL,
-                                       &smb_fname->st,
-                                       smb_fname->twrp,
-                                       smb_fname->flags);
-       if (mapped_smb_fname == NULL) {
-               TALLOC_FREE(mapped_name);
-               TALLOC_FREE(mapped_ea_name);
-               errno = ENOMEM;
-               return -1;
-       }
-
-       ret = SMB_VFS_NEXT_GETXATTR(handle, mapped_smb_fname,
-                               mapped_ea_name, value, size);
-       if (ret == -1) {
-               saved_errno = errno;
-       }
-       TALLOC_FREE(mapped_name);
-       TALLOC_FREE(mapped_ea_name);
-       TALLOC_FREE(mapped_smb_fname);
-       if (saved_errno != 0) {
-               errno = saved_errno;
-       }
-
-       return ret;
-}
-
 static int catia_fstat(vfs_handle_struct *handle,
                       files_struct *fsp,
                       SMB_STRUCT_STAT *sbuf)
@@ -1670,10 +1608,10 @@ static bool catia_lock(vfs_handle_struct *handle,
        return ok;
 }
 
-static int catia_kernel_flock(struct vfs_handle_struct *handle,
-                             struct files_struct *fsp,
-                             uint32_t share_access,
-                             uint32_t access_mask)
+static int catia_filesystem_sharemode(struct vfs_handle_struct *handle,
+                                     struct files_struct *fsp,
+                                     uint32_t share_access,
+                                     uint32_t access_mask)
 {
        struct catia_cache *cc = NULL;
        int ret;
@@ -1683,7 +1621,10 @@ static int catia_kernel_flock(struct vfs_handle_struct *handle,
                return -1;
        }
 
-       ret = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_access, access_mask);
+       ret = SMB_VFS_NEXT_FILESYSTEM_SHAREMODE(handle,
+                                               fsp,
+                                               share_access,
+                                               access_mask);
 
        CATIA_FETCH_FSP_POST_NEXT(&cc, fsp);
 
@@ -1951,7 +1892,7 @@ static struct vfs_fn_pointers vfs_catia_fns = {
        .ftruncate_fn = catia_ftruncate,
        .fallocate_fn = catia_fallocate,
        .lock_fn = catia_lock,
-       .kernel_flock_fn = catia_kernel_flock,
+       .filesystem_sharemode_fn = catia_filesystem_sharemode,
        .linux_setlease_fn = catia_linux_setlease,
        .getlock_fn = catia_getlock,
        .realpath_fn = catia_realpath,
@@ -1978,7 +1919,6 @@ static struct vfs_fn_pointers vfs_catia_fns = {
        .sys_acl_set_fd_fn = catia_sys_acl_set_fd,
 
        /* EA operations. */
-       .getxattr_fn = catia_getxattr,
        .getxattrat_send_fn = vfs_not_implemented_getxattrat_send,
        .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
        .fgetxattr_fn = catia_fgetxattr,