]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs: Add struct vfs_open_how.resolve
authorVolker Lendecke <vl@samba.org>
Fri, 3 Jun 2022 14:45:41 +0000 (16:45 +0200)
committerJeremy Allison <jra@samba.org>
Sat, 6 Aug 2022 02:39:11 +0000 (02:39 +0000)
This prepares the later introduction of VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS,
which will be used to make use of RESOLVE_NO_SYMLINKS on linux with openat2().

Right now all terminal VFS objects reject any resolve bits with ENOSYS.
So we only prepare the vfs layer for now without any real change.
But this will make backports to 4.17 much easier.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Aug  6 02:39:11 UTC 2022 on sn-devel-184

examples/VFS/skel_opaque.c
source3/include/vfs.h
source3/modules/vfs_aio_pthread.c
source3/modules/vfs_ceph.c
source3/modules/vfs_default.c
source3/modules/vfs_fruit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_shadow_copy2.c
source3/modules/vfs_streams_depot.c
source3/modules/vfs_streams_xattr.c

index 61c343f543448401a49b5df95d87aff818a80367..a72ba57e1a7550db07ee124cd5a6237bab49e6c3 100644 (file)
@@ -199,6 +199,11 @@ static int skel_openat(struct vfs_handle_struct *handle,
                       struct files_struct *fsp,
                       const struct vfs_open_how *how)
 {
+       if (how->resolve != 0) {
+               errno = ENOSYS;
+               return -1;
+       }
+
        errno = ENOSYS;
        return -1;
 }
index e65d857d220bb5f6c460ec94411ebffc55f7e043..866d2a5f4a8ddb06273f229cccdb04fcda465d34 100644 (file)
@@ -908,6 +908,7 @@ struct vfs_aio_state {
 struct vfs_open_how {
        int flags;
        mode_t mode;
+       uint64_t resolve;
 };
 
 /*
index b4245ee89dcee4569514ac1c00c90a50542bb800..5d051b4f7da67c9abd406131aff74eeeba4f8466 100644 (file)
@@ -457,6 +457,11 @@ static int aio_pthread_openat_fn(vfs_handle_struct *handle,
        bool aio_allow_open = lp_parm_bool(
                SNUM(handle->conn), "aio_pthread", "aio open", false);
 
+       if (how->resolve != 0) {
+               errno = ENOSYS;
+               return -1;
+       }
+
        if (is_named_stream(smb_fname)) {
                /* Don't handle stream opens. */
                errno = ENOENT;
index 59747db16c356f71dad1fe1b52dd564d888f193e..2186bfdb2ce6cb898a5a974ffe881717107d19be 100644 (file)
@@ -409,6 +409,11 @@ static int cephwrap_openat(struct vfs_handle_struct *handle,
        bool became_root = false;
        int result = -ENOENT;
 
+       if (how->resolve != 0) {
+               errno = ENOSYS;
+               return -1;
+       }
+
        /*
         * ceph doesn't have openat().
         */
index 6bfda596d8aa8d5ce9cd86f7a57410438ff4f4ad..9cf70fd84ce9d3dd92790b0b44869b7d0e441d41 100644 (file)
@@ -701,6 +701,12 @@ static int vfswrap_openat(vfs_handle_struct *handle,
 
        START_PROFILE(syscall_openat);
 
+       if (how->resolve != 0) {
+               errno = ENOSYS;
+               result = -1;
+               goto out;
+       }
+
        if (is_named_stream(smb_fname)) {
                errno = ENOENT;
                result = -1;
index 737f44eb03f448f6fecfeee6272d72b65777dbc9..13033096dc92161fd6be5f615e086c03971325bb 100644 (file)
@@ -1758,6 +1758,11 @@ static int fruit_openat(vfs_handle_struct *handle,
                                           how);
        }
 
+       if (how->resolve != 0) {
+               errno = ENOSYS;
+               return -1;
+       }
+
        SMB_ASSERT(fsp_is_alternate_stream(fsp));
 
        if (is_afpinfo_stream(smb_fname->stream_name)) {
index 081bc0c7c07a19248025d04db72bb44922dcdc39..dd05da0f9bb9f5edbc36414ea4df98e9122192ad 100644 (file)
@@ -772,6 +772,12 @@ static int vfs_gluster_openat(struct vfs_handle_struct *handle,
 
        START_PROFILE(syscall_openat);
 
+       if (how->resolve != 0) {
+               END_PROFILE(syscall_openat);
+               errno = ENOSYS;
+               return -1;
+       }
+
        /*
         * Looks like glfs API doesn't have openat().
         */
index 0e849d7cc418622e2b7a9d0d33299199e23a484f..a3a6afbc3ace037292ce1f985aba629ab54c4e7f 100644 (file)
@@ -1553,6 +1553,11 @@ static int shadow_copy2_openat(vfs_handle_struct *handle,
        int ret;
        bool ok;
 
+       if (how.resolve != 0) {
+               errno = ENOSYS;
+               return -1;
+       }
+
        smb_fname = shadow_copy2_openat_name(
                talloc_tos(), dirfsp, fsp, smb_fname_in);
        if (smb_fname == NULL) {
index 47e3b3605e6308c48ba32ca20ba9ef79870bb14b..f92e9c8c5fac9c9ec5bcd26d360b32105c8a4406 100644 (file)
@@ -681,6 +681,11 @@ static int streams_depot_openat(struct vfs_handle_struct *handle,
                                           how);
        }
 
+       if (how->resolve != 0) {
+               errno = ENOSYS;
+               return -1;
+       }
+
        SMB_ASSERT(fsp_is_alternate_stream(fsp));
        SMB_ASSERT(dirfsp == NULL);
        SMB_ASSERT(VALID_STAT(fsp->base_fsp->fsp_name->st));
index ed03aa3b4549f64c2622b8b17ebf95dfca961052..3dfb894a8004e990161e3a29d551b685dba98cc6 100644 (file)
@@ -341,6 +341,11 @@ static int streams_xattr_openat(struct vfs_handle_struct *handle,
                                           how);
        }
 
+       if (how->resolve != 0) {
+               errno = ENOSYS;
+               return -1;
+       }
+
        SMB_ASSERT(fsp_is_alternate_stream(fsp));
        SMB_ASSERT(dirfsp == NULL);