[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Sun Jan 17 05:49:01 UTC 2021
The branch, master has been updated
via 009b52650d0 vfs: update status of SMB_VFS_SYMLINKAT()
via f09ea26e658 s3: smbd: Change smb_set_file_unix_link() to use a real directory fsp for SMB_VFS_SYMLINKAT().
via 35f2c7641e6 s3: VFS: glusterfs: Fix vfs_gluster_symlinkat() to cope with a real dirfsp.
via c8e8ea23097 s3: VFS: ceph: Fix cephwrap_symlinkat() to cope with real directory fsps.
from b96c2cf0199 vfs: directory enumeration is now handle based
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 009b52650d0f7e0bb2d840eb004c335f88b30cf8
Author: Jeremy Allison <jra at samba.org>
Date: Fri Jan 15 14:50:23 2021 -0800
vfs: update status of SMB_VFS_SYMLINKAT()
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sun Jan 17 05:48:14 UTC 2021 on sn-devel-184
commit f09ea26e6580b2c339c4de9374e024182fa9ca82
Author: Jeremy Allison <jra at samba.org>
Date: Fri Jan 15 14:29:08 2021 -0800
s3: smbd: Change smb_set_file_unix_link() to use a real directory fsp for SMB_VFS_SYMLINKAT().
New VFS change.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 35f2c7641e6235fdad492f47b0685e89016a9cb1
Author: Jeremy Allison <jra at samba.org>
Date: Fri Jan 15 14:35:58 2021 -0800
s3: VFS: glusterfs: Fix vfs_gluster_symlinkat() to cope with a real dirfsp.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit c8e8ea23097df7b1c1c596f8dd99ab2a59afe3a4
Author: Jeremy Allison <jra at samba.org>
Date: Fri Jan 15 14:33:17 2021 -0800
s3: VFS: ceph: Fix cephwrap_symlinkat() to cope with real directory fsps.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/modules/The_New_VFS.org | 2 +-
source3/modules/The_New_VFS.txt | 2 +-
source3/modules/vfs_ceph.c | 16 ++++++++++++----
source3/modules/vfs_glusterfs.c | 16 ++++++++++++++--
source3/smbd/trans2.c | 31 +++++++++++++++++++++++++++++--
5 files changed, 57 insertions(+), 10 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/The_New_VFS.org b/source3/modules/The_New_VFS.org
index d034acaa661..f5dcec8db62 100644
--- a/source3/modules/The_New_VFS.org
+++ b/source3/modules/The_New_VFS.org
@@ -292,7 +292,7 @@ whenever VFS access is done in a piecemeal fashion.
| SMB_VFS_STATVFS() | [[Disk][Disk]] | - |
| SMB_VFS_STREAMINFO() | [[Path][Path]] | Todo |
| SMB_VFS_STRICT_LOCK_CHECK() | [[fsp][fsp]] | - |
-| SMB_VFS_SYMLINKAT() | [[NsC][NsC]] | Todo |
+| SMB_VFS_SYMLINKAT() | [[NsC][NsC]] | - |
| SMB_VFS_SYS_ACL_BLOB_GET_FD() | [[xpathref][xpathref]] | - |
| SMB_VFS_SYS_ACL_BLOB_GET_FILE() | [[Path][Path]] | Todo |
| SMB_VFS_SYS_ACL_DELETE_DEF_FILE() | [[Path][Path]] | Todo |
diff --git a/source3/modules/The_New_VFS.txt b/source3/modules/The_New_VFS.txt
index 6d94cfdc6a2..a42985b5eaf 100644
--- a/source3/modules/The_New_VFS.txt
+++ b/source3/modules/The_New_VFS.txt
@@ -360,7 +360,7 @@ Table of Contents
SMB_VFS_STATVFS() [Disk] -
SMB_VFS_STREAMINFO() [Path] Todo
SMB_VFS_STRICT_LOCK_CHECK() [fsp] -
- SMB_VFS_SYMLINKAT() [NsC] Todo
+ SMB_VFS_SYMLINKAT() [NsC] -
SMB_VFS_SYS_ACL_BLOB_GET_FD() [xpathref] -
SMB_VFS_SYS_ACL_BLOB_GET_FILE() [Path] Todo
SMB_VFS_SYS_ACL_DELETE_DEF_FILE() [Path] Todo
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index b2d9ead1db5..cacc725310a 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -1052,16 +1052,24 @@ static int cephwrap_symlinkat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
+ struct smb_filename *full_fname = NULL;
int result = -1;
+
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ new_smb_fname);
+ if (full_fname == NULL) {
+ return -1;
+ }
+
DBG_DEBUG("[CEPH] symlink(%p, %s, %s)\n", handle,
link_target->base_name,
- new_smb_fname->base_name);
-
- SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
+ full_fname->base_name);
result = ceph_symlink(handle->data,
link_target->base_name,
- new_smb_fname->base_name);
+ full_fname->base_name);
+ TALLOC_FREE(full_fname);
DBG_DEBUG("[CEPH] symlink(...) = %d\n", result);
WRAP_RETURN(result);
}
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 59b76546112..9cc27b5c352 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -1844,13 +1844,25 @@ static int vfs_gluster_symlinkat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
+ struct smb_filename *full_fname = NULL;
int ret;
START_PROFILE(syscall_symlinkat);
- SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
+
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ new_smb_fname);
+ if (full_fname == NULL) {
+ END_PROFILE(syscall_symlinkat);
+ return -1;
+ }
+
ret = glfs_symlink(handle->data,
link_target->base_name,
- new_smb_fname->base_name);
+ full_fname->base_name);
+
+ TALLOC_FREE(full_fname);
+
END_PROFILE(syscall_symlinkat);
return ret;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 3c1df4ca3ac..f3a0d7da75f 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -7009,6 +7009,9 @@ static NTSTATUS smb_set_file_unix_link(connection_struct *conn,
TALLOC_CTX *ctx = talloc_tos();
NTSTATUS status;
int ret;
+ struct smb_filename *parent_fname = NULL;
+ struct smb_filename *base_name = NULL;
+ bool ok;
/* Set a symbolic link. */
/* Don't allow this if follow links is false. */
@@ -7041,14 +7044,38 @@ static NTSTATUS smb_set_file_unix_link(connection_struct *conn,
DEBUG(10,("smb_set_file_unix_link: SMB_SET_FILE_UNIX_LINK doing symlink %s -> %s\n",
new_smb_fname->base_name, link_target ));
+ ok = parent_smb_fname(ctx,
+ new_smb_fname,
+ &parent_fname,
+ &base_name);
+ if (!ok) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ret = vfs_stat(conn, parent_fname);
+ if (ret == -1) {
+ TALLOC_FREE(parent_fname);
+ return map_nt_error_from_unix(errno);
+ }
+ status = openat_pathref_fsp(conn->cwd_fsp, parent_fname);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) {
+ status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(parent_fname);
+ return status;
+ }
+
ret = SMB_VFS_SYMLINKAT(conn,
&target_fname,
- conn->cwd_fsp,
- new_smb_fname);
+ parent_fname->fsp,
+ base_name);
if (ret != 0) {
+ TALLOC_FREE(parent_fname);
return map_nt_error_from_unix(errno);
}
+ TALLOC_FREE(parent_fname);
return NT_STATUS_OK;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list