1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

vfs: Add struct vfs_open_how.resolve

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
This commit is contained in:
Volker Lendecke 2022-06-03 16:45:41 +02:00 committed by Jeremy Allison
parent 8693a0416b
commit 7cd8715676
10 changed files with 48 additions and 0 deletions

View 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;
}

View File

@ -908,6 +908,7 @@ struct vfs_aio_state {
struct vfs_open_how {
int flags;
mode_t mode;
uint64_t resolve;
};
/*

View 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;

View 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().
*/

View 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;

View 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)) {

View 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().
*/

View 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) {

View 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));

View 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);