[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Mar 10 19:20:01 UTC 2022


The branch, master has been updated
       via  688604a423b smbd: Simplify non_widelink_open()
       via  854e8091b78 vfs: Convert get_real_filename() to NTSTATUS
       via  812cb602e3b vfs: Add SMB_VFS_FSTATAT
       via  c51f9ab233e vfs: Don't mask shadow_copy2_convert()'s errno
      from  db94eefdd54 s3: smbd: Plumb in and use smbd_smb2_server_connection_read_handler() when server min protocol > NT1 (i.e. SMB2-only).

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 688604a423bb4dbb36ea6bc86e629d6ab0c4082d
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Mar 4 14:56:24 2022 +0100

    smbd: Simplify non_widelink_open()
    
    Don't depend on fsp->fsp_flags.is_directory: We can always take the
    parent directory fname, chdir into it and openat(O_PATH|O_NOFOLLOW)
    the relative file name. To properly handle the symlink case without
    having O_PATH, upon failure we need the call to
    fstatat(AT_SYMLINK_NOFOLLOW) as a replacement for the fstat-call that
    we can do when we successfully opened the relative file name with
    O_NOFOLLOW.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Mar 10 19:19:06 UTC 2022 on sn-devel-184

commit 854e8091b78dfcfb909dc34f5d1943fa0dd7deb1
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Mar 7 18:00:20 2022 +0100

    vfs: Convert get_real_filename() to NTSTATUS
    
    This makes it possible to more easily handle STOPPED_ON_SYMLINK vs
    OBJECT_PATH_NOT_FOUND vs OBJECT_NAME_NOT_FOUND and so on. The next
    patch needs this to properly handle symlinks.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 812cb602e3be3ffc4400cff1df63295cf2f4cd21
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 6 15:59:05 2022 +0100

    vfs: Add SMB_VFS_FSTATAT
    
    Useful if you want to stat/fstat/lstat relative to a directory without
    doing chdir first.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c51f9ab233e548010816f9774784880340fa8c79
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Mar 4 16:38:34 2022 +0100

    vfs: Don't mask shadow_copy2_convert()'s errno
    
    If it's really ENOMEM, shadow_copy2_convert() did set this itself. It
    might also return ENOENT for example. Found this while working on
    other patches.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 examples/VFS/skel_opaque.c            |  24 +++--
 examples/VFS/skel_transparent.c       |  20 ++++-
 source3/include/smbprofile.h          |   1 +
 source3/include/vfs.h                 |  51 +++++++----
 source3/include/vfs_macros.h          |   7 ++
 source3/modules/vfs_ceph.c            |  14 +--
 source3/modules/vfs_ceph_snapshots.c  |  24 ++---
 source3/modules/vfs_default.c         |  41 +++++++--
 source3/modules/vfs_full_audit.c      |  44 +++++++--
 source3/modules/vfs_glusterfs.c       |  21 +++--
 source3/modules/vfs_glusterfs_fuse.c  |  21 +++--
 source3/modules/vfs_gpfs.c            |  25 +++---
 source3/modules/vfs_not_implemented.c |  27 ++++--
 source3/modules/vfs_shadow_copy2.c    | 164 +++++++++++++++++++++++++++-------
 source3/modules/vfs_snapper.c         |  31 +++----
 source3/modules/vfs_time_audit.c      |  37 ++++++--
 source3/smbd/dir.c                    |  16 ++--
 source3/smbd/filename.c               | 110 +++++++++++------------
 source3/smbd/open.c                   |  84 +++++++++++------
 source3/smbd/proto.h                  |  12 +--
 source3/smbd/vfs.c                    |  21 +++--
 21 files changed, 535 insertions(+), 260 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index cc7bb880d5c..4719a45e7bb 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -345,6 +345,17 @@ static int skel_lstat(vfs_handle_struct *handle,
 	return -1;
 }
 
+static int skel_fstatat(
+	struct vfs_handle_struct *handle,
+	const struct files_struct *dirfsp,
+	const struct smb_filename *smb_fname,
+	SMB_STRUCT_STAT *sbuf,
+	int flags)
+{
+	errno = ENOSYS;
+	return -1;
+}
+
 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
 				    struct files_struct *fsp,
 				    const SMB_STRUCT_STAT *sbuf)
@@ -640,13 +651,13 @@ static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
 	return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-static int skel_get_real_filename(struct vfs_handle_struct *handle,
-				  const struct smb_filename *path,
-				  const char *name,
-				  TALLOC_CTX *mem_ctx, char **found_name)
+static NTSTATUS skel_get_real_filename(struct vfs_handle_struct *handle,
+				       const struct smb_filename *path,
+				       const char *name,
+				       TALLOC_CTX *mem_ctx,
+				       char **found_name)
 {
-	errno = ENOSYS;
-	return -1;
+	return NT_STATUS_NOT_IMPLEMENTED;
 }
 
 static const char *skel_connectpath(struct vfs_handle_struct *handle,
@@ -1001,6 +1012,7 @@ static struct vfs_fn_pointers skel_opaque_fns = {
 	.stat_fn = skel_stat,
 	.fstat_fn = skel_fstat,
 	.lstat_fn = skel_lstat,
+	.fstatat_fn = skel_fstatat,
 	.get_alloc_size_fn = skel_get_alloc_size,
 	.unlinkat_fn = skel_unlinkat,
 	.fchmod_fn = skel_fchmod,
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index e145881b704..ecd3c282240 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -473,6 +473,16 @@ static int skel_lstat(vfs_handle_struct *handle,
 	return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
 }
 
+static int skel_fstatat(
+	struct vfs_handle_struct *handle,
+	const struct files_struct *dirfsp,
+	const struct smb_filename *smb_fname,
+	SMB_STRUCT_STAT *sbuf,
+	int flags)
+{
+	return SMB_VFS_NEXT_FSTATAT(handle, dirfsp, smb_fname, sbuf, flags);
+}
+
 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
 				    struct files_struct *fsp,
 				    const SMB_STRUCT_STAT *sbuf)
@@ -865,10 +875,11 @@ static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
 				streams);
 }
 
-static int skel_get_real_filename(struct vfs_handle_struct *handle,
-				  const struct smb_filename *path,
-				  const char *name,
-				  TALLOC_CTX *mem_ctx, char **found_name)
+static NTSTATUS skel_get_real_filename(struct vfs_handle_struct *handle,
+				       const struct smb_filename *path,
+				       const char *name,
+				       TALLOC_CTX *mem_ctx,
+				       char **found_name)
 {
 	return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
 					      path, name, mem_ctx, found_name);
@@ -1316,6 +1327,7 @@ static struct vfs_fn_pointers skel_transparent_fns = {
 	.stat_fn = skel_stat,
 	.fstat_fn = skel_fstat,
 	.lstat_fn = skel_lstat,
+	.fstatat_fn = skel_fstatat,
 	.get_alloc_size_fn = skel_get_alloc_size,
 	.unlinkat_fn = skel_unlinkat,
 	.fchmod_fn = skel_fchmod,
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 3ddd4eb6f5d..ce7a7405bf4 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -66,6 +66,7 @@ struct tevent_context;
 	SMBPROFILE_STATS_BASIC(syscall_stat) \
 	SMBPROFILE_STATS_BASIC(syscall_fstat) \
 	SMBPROFILE_STATS_BASIC(syscall_lstat) \
+	SMBPROFILE_STATS_BASIC(syscall_fstatat) \
 	SMBPROFILE_STATS_BASIC(syscall_get_alloc_size) \
 	SMBPROFILE_STATS_BASIC(syscall_unlinkat) \
 	SMBPROFILE_STATS_BASIC(syscall_chmod) \
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 695ba0aebd0..333fdba1548 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -362,6 +362,8 @@
  * Version 45 - Remove SMB_VFS_GETXATTR
  * Version 46 - Rename SMB_VFS_KERNEL_FLOCK to SMB_VFS_FILESYSTEM_SHAREMODE
  * Version 46 - Add flags and xferlen args to SMB_VFS_OFFLOAD_READ_RECV
+ * Version 46 - Add SMB_VFS_FSTATAT
+ * Version 46 - Change SMB_VFS_GET_REAL_FILENAME to return NTSTATUS
  */
 
 #define SMB_VFS_INTERFACE_VERSION 46
@@ -1016,6 +1018,12 @@ struct vfs_fn_pointers {
 	int (*stat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_fname);
 	int (*fstat_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
 	int (*lstat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_filename);
+	int (*fstatat_fn)(
+		struct vfs_handle_struct *handle,
+		const struct files_struct *dirfsp,
+		const struct smb_filename *smb_fname,
+		SMB_STRUCT_STAT *sbuf,
+		int flags);
 	uint64_t (*get_alloc_size_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
 	int (*unlinkat_fn)(struct vfs_handle_struct *handle,
 			struct files_struct *srcdir_fsp,
@@ -1135,11 +1143,11 @@ struct vfs_fn_pointers {
 				   unsigned int *num_streams,
 				   struct stream_struct **streams);
 
-	int (*get_real_filename_fn)(struct vfs_handle_struct *handle,
-				    const struct smb_filename *path,
-				    const char *name,
-				    TALLOC_CTX *mem_ctx,
-				    char **found_name);
+	NTSTATUS (*get_real_filename_fn)(struct vfs_handle_struct *handle,
+					 const struct smb_filename *path,
+					 const char *name,
+					 TALLOC_CTX *mem_ctx,
+					 char **found_name);
 
 	const char *(*connectpath_fn)(struct vfs_handle_struct *handle,
 				      const struct smb_filename *smb_fname);
@@ -1514,6 +1522,12 @@ int smb_vfs_call_fstat(struct vfs_handle_struct *handle,
 		       struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
 int smb_vfs_call_lstat(struct vfs_handle_struct *handle,
 		       struct smb_filename *smb_filename);
+int smb_vfs_call_fstatat(
+	struct vfs_handle_struct *handle,
+	const struct files_struct *dirfsp,
+	const struct smb_filename *smb_fname,
+	SMB_STRUCT_STAT *sbuf,
+	int flags);
 uint64_t smb_vfs_call_get_alloc_size(struct vfs_handle_struct *handle,
 				     struct files_struct *fsp,
 				     const SMB_STRUCT_STAT *sbuf);
@@ -1598,11 +1612,11 @@ NTSTATUS smb_vfs_call_fstreaminfo(struct vfs_handle_struct *handle,
 				  TALLOC_CTX *mem_ctx,
 				  unsigned int *num_streams,
 				  struct stream_struct **streams);
-int smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
-				   const struct smb_filename *path,
-				   const char *name,
-				   TALLOC_CTX *mem_ctx,
-				   char **found_name);
+NTSTATUS smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
+					const struct smb_filename *path,
+					const char *name,
+					TALLOC_CTX *mem_ctx,
+					char **found_name);
 const char *smb_vfs_call_connectpath(struct vfs_handle_struct *handle,
 				     const struct smb_filename *smb_fname);
 NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle,
@@ -1942,6 +1956,12 @@ int vfs_not_implemented_fstat(vfs_handle_struct *handle, files_struct *fsp,
 			SMB_STRUCT_STAT *sbuf);
 int vfs_not_implemented_lstat(vfs_handle_struct *handle,
 			      struct smb_filename *smb_fname);
+int vfs_not_implemented_fstatat(
+	struct vfs_handle_struct *handle,
+	const struct files_struct *dirfsp,
+	const struct smb_filename *smb_fname,
+	SMB_STRUCT_STAT *sbuf,
+	int flags);
 uint64_t vfs_not_implemented_get_alloc_size(struct vfs_handle_struct *handle,
 					    struct files_struct *fsp,
 					    const SMB_STRUCT_STAT *sbuf);
@@ -2058,11 +2078,12 @@ NTSTATUS vfs_not_implemented_fstreaminfo(struct vfs_handle_struct *handle,
 					 TALLOC_CTX *mem_ctx,
 					 unsigned int *num_streams,
 					 struct stream_struct **streams);
-int vfs_not_implemented_get_real_filename(struct vfs_handle_struct *handle,
-					  const struct smb_filename *path,
-					  const char *name,
-					  TALLOC_CTX *mem_ctx,
-					  char **found_name);
+NTSTATUS vfs_not_implemented_get_real_filename(
+	struct vfs_handle_struct *handle,
+	const struct smb_filename *path,
+	const char *name,
+	TALLOC_CTX *mem_ctx,
+	char **found_name);
 const char *vfs_not_implemented_connectpath(struct vfs_handle_struct *handle,
 					    const struct smb_filename *smb_fname);
 NTSTATUS vfs_not_implemented_brl_lock_windows(struct vfs_handle_struct *handle,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 49654f59ff2..99619320df4 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -228,6 +228,13 @@
 #define SMB_VFS_NEXT_LSTAT(handle, smb_fname) \
 	smb_vfs_call_lstat((handle)->next, (smb_fname))
 
+#define SMB_VFS_FSTATAT(conn, dirfsp, smb_fname, sbuf, flags) \
+	smb_vfs_call_fstatat((conn)->vfs_handles, (dirfsp), (smb_fname), \
+			     (sbuf), (flags))
+#define SMB_VFS_NEXT_FSTATAT(conn, dirfsp, smb_fname, sbuf, flags) \
+	smb_vfs_call_fstatat((handle)->next, (dirfsp), (smb_fname), \
+			     (sbuf), (flags))
+
 #define SMB_VFS_GET_ALLOC_SIZE(conn, fsp, sbuf) \
 	smb_vfs_call_get_alloc_size((conn)->vfs_handles, (fsp), (sbuf))
 #define SMB_VFS_NEXT_GET_ALLOC_SIZE(conn, fsp, sbuf) \
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 4e1fa6a2df4..9188b7991d4 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -1276,18 +1276,18 @@ static int cephwrap_fchflags(struct vfs_handle_struct *handle,
 	return -1;
 }
 
-static int cephwrap_get_real_filename(struct vfs_handle_struct *handle,
-				     const struct smb_filename *path,
-				     const char *name,
-				     TALLOC_CTX *mem_ctx,
-				     char **found_name)
+static NTSTATUS cephwrap_get_real_filename(
+	struct vfs_handle_struct *handle,
+	const struct smb_filename *path,
+	const char *name,
+	TALLOC_CTX *mem_ctx,
+	char **found_name)
 {
 	/*
 	 * Don't fall back to get_real_filename so callers can differentiate
 	 * between a full directory scan and an actual case-insensitive stat.
 	 */
-	errno = EOPNOTSUPP;
-	return -1;
+	return NT_STATUS_NOT_SUPPORTED;
 }
 
 static const char *cephwrap_connectpath(struct vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c
index d533b9479a3..ad4c8f1dd94 100644
--- a/source3/modules/vfs_ceph_snapshots.c
+++ b/source3/modules/vfs_ceph_snapshots.c
@@ -1313,23 +1313,24 @@ static int ceph_snap_gmt_fsetxattr(struct vfs_handle_struct *handle,
 				aname, value, size, flags);
 }
 
-static int ceph_snap_gmt_get_real_filename(struct vfs_handle_struct *handle,
-					 const struct smb_filename *path,
-					 const char *name,
-					 TALLOC_CTX *mem_ctx,
-					 char **found_name)
+static NTSTATUS ceph_snap_gmt_get_real_filename(
+	struct vfs_handle_struct *handle,
+	const struct smb_filename *path,
+	const char *name,
+	TALLOC_CTX *mem_ctx,
+	char **found_name)
 {
 	time_t timestamp = 0;
 	char stripped[PATH_MAX + 1];
 	char conv[PATH_MAX + 1];
 	struct smb_filename conv_fname;
 	int ret;
+	NTSTATUS status;
 
 	ret = ceph_snap_gmt_strip_snapshot(handle, path,
 					&timestamp, stripped, sizeof(stripped));
 	if (ret < 0) {
-		errno = -ret;
-		return -1;
+		return map_nt_error_from_unix(-ret);
 	}
 	if (timestamp == 0) {
 		return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name,
@@ -1338,17 +1339,16 @@ static int ceph_snap_gmt_get_real_filename(struct vfs_handle_struct *handle,
 	ret = ceph_snap_gmt_convert_dir(handle, stripped,
 					timestamp, conv, sizeof(conv));
 	if (ret < 0) {
-		errno = -ret;
-		return -1;
+		return map_nt_error_from_unix(-ret);
 	}
 
 	conv_fname = (struct smb_filename) {
 		.base_name = conv,
 	};
 
-	ret = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, &conv_fname, name,
-					     mem_ctx, found_name);
-	return ret;
+	status = SMB_VFS_NEXT_GET_REAL_FILENAME(
+		handle, &conv_fname, name, mem_ctx, found_name);
+	return status;
 }
 
 static uint64_t ceph_snap_gmt_disk_free(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 64760874792..6c4f15ba39f 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1314,6 +1314,33 @@ static int vfswrap_lstat(vfs_handle_struct *handle,
 	return result;
 }
 
+static int vfswrap_fstatat(
+	struct vfs_handle_struct *handle,
+	const struct files_struct *dirfsp,
+	const struct smb_filename *smb_fname,
+	SMB_STRUCT_STAT *sbuf,
+	int flags)
+{
+	int result = -1;
+
+	START_PROFILE(syscall_fstatat);
+
+	if (is_named_stream(smb_fname)) {
+		errno = ENOENT;
+		goto out;
+	}
+
+	result = sys_fstatat(
+		fsp_get_pathref_fd(dirfsp),
+		smb_fname->base_name,
+		sbuf,
+		flags,
+		lp_fake_directory_create_times(SNUM(handle->conn)));
+ out:
+	END_PROFILE(syscall_fstatat);
+	return result;
+}
+
 static NTSTATUS vfswrap_translate_name(struct vfs_handle_struct *handle,
 				       const char *name,
 				       enum vfs_translate_direction direction,
@@ -3335,18 +3362,17 @@ static NTSTATUS vfswrap_fstreaminfo(vfs_handle_struct *handle,
 	return NT_STATUS_OK;
 }
 
-static int vfswrap_get_real_filename(struct vfs_handle_struct *handle,
-				     const struct smb_filename *path,
-				     const char *name,
-				     TALLOC_CTX *mem_ctx,
-				     char **found_name)
+static NTSTATUS vfswrap_get_real_filename(struct vfs_handle_struct *handle,
+					  const struct smb_filename *path,
+					  const char *name,
+					  TALLOC_CTX *mem_ctx,
+					  char **found_name)
 {
 	/*
 	 * Don't fall back to get_real_filename so callers can differentiate
 	 * between a full directory scan and an actual case-insensitive stat.
 	 */
-	errno = EOPNOTSUPP;
-	return -1;
+	return NT_STATUS_NOT_SUPPORTED;
 }
 
 static const char *vfswrap_connectpath(struct vfs_handle_struct *handle,
@@ -3968,6 +3994,7 @@ static struct vfs_fn_pointers vfs_default_fns = {
 	.stat_fn = vfswrap_stat,
 	.fstat_fn = vfswrap_fstat,
 	.lstat_fn = vfswrap_lstat,
+	.fstatat_fn = vfswrap_fstatat,
 	.get_alloc_size_fn = vfswrap_get_alloc_size,
 	.unlinkat_fn = vfswrap_unlinkat,
 	.fchmod_fn = vfswrap_fchmod,
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 5903849931e..a905971c1b9 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -140,6 +140,7 @@ typedef enum _vfs_op_type {
 	SMB_VFS_OP_STAT,
 	SMB_VFS_OP_FSTAT,
 	SMB_VFS_OP_LSTAT,
+	SMB_VFS_OP_FSTATAT,
 	SMB_VFS_OP_GET_ALLOC_SIZE,
 	SMB_VFS_OP_UNLINKAT,
 	SMB_VFS_OP_FCHMOD,
@@ -276,6 +277,7 @@ static struct {
 	{ SMB_VFS_OP_STAT,	"stat" },
 	{ SMB_VFS_OP_FSTAT,	"fstat" },
 	{ SMB_VFS_OP_LSTAT,	"lstat" },
+	{ SMB_VFS_OP_FSTATAT,	"fstatat" },
 	{ SMB_VFS_OP_GET_ALLOC_SIZE,	"get_alloc_size" },
 	{ SMB_VFS_OP_UNLINKAT,	"unlinkat" },
 	{ SMB_VFS_OP_FCHMOD,	"fchmod" },
@@ -1568,6 +1570,26 @@ static int smb_full_audit_lstat(vfs_handle_struct *handle,
 	return result;    
 }
 
+static int smb_full_audit_fstatat(
+	struct vfs_handle_struct *handle,
+	const struct files_struct *dirfsp,
+	const struct smb_filename *smb_fname,
+	SMB_STRUCT_STAT *sbuf,
+	int flags)
+{
+	int result;
+
+	result = SMB_VFS_NEXT_FSTATAT(handle, dirfsp, smb_fname, sbuf, flags);
+
+	do_log(SMB_VFS_OP_FSTATAT,
+	       (result >= 0),
+	       handle,
+	       "%s/%s",
+	       fsp_str_do_log(dirfsp),
+	       smb_fname_str_do_log(handle->conn, smb_fname));
+
+	return result;
+}
 static uint64_t smb_full_audit_get_alloc_size(vfs_handle_struct *handle,
 		       files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
 {
@@ -2058,20 +2080,25 @@ static NTSTATUS smb_full_audit_fstreaminfo(vfs_handle_struct *handle,
         return result;
 }
 
-static int smb_full_audit_get_real_filename(struct vfs_handle_struct *handle,
-					    const struct smb_filename *path,
-					    const char *name,
-					    TALLOC_CTX *mem_ctx,
-					    char **found_name)
+static NTSTATUS smb_full_audit_get_real_filename(
+	struct vfs_handle_struct *handle,
+	const struct smb_filename *path,
+	const char *name,
+	TALLOC_CTX *mem_ctx,
+	char **found_name)
 {
-	int result;
+	NTSTATUS result;
 
 	result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
 						found_name);
 
-	do_log(SMB_VFS_OP_GET_REAL_FILENAME, (result == 0), handle,
+	do_log(SMB_VFS_OP_GET_REAL_FILENAME,
+	       NT_STATUS_IS_OK(result),
+	       handle,
 	       "%s/%s->%s",
-	       path->base_name, name, (result == 0) ? *found_name : "");
+	       path->base_name,
+	       name,
+	       NT_STATUS_IS_OK(result) ? *found_name : "");
 
 	return result;
 }
@@ -2930,6 +2957,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
 	.stat_fn = smb_full_audit_stat,
 	.fstat_fn = smb_full_audit_fstat,
 	.lstat_fn = smb_full_audit_lstat,
+	.fstatat_fn = smb_full_audit_fstatat,
 	.get_alloc_size_fn = smb_full_audit_get_alloc_size,
 	.unlinkat_fn = smb_full_audit_unlinkat,
 	.fchmod_fn = smb_full_audit_fchmod,
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 25b82bdd471..bce73094c54 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -2003,19 +2003,19 @@ static int vfs_gluster_fchflags(struct vfs_handle_struct *handle,
 	return -1;
 }
 
-static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle,
-					 const struct smb_filename *path,
-					 const char *name,
-					 TALLOC_CTX *mem_ctx,
-					 char **found_name)
+static NTSTATUS vfs_gluster_get_real_filename(
+	struct vfs_handle_struct *handle,
+	const struct smb_filename *path,
+	const char *name,
+	TALLOC_CTX *mem_ctx,
+	char **found_name)
 {
 	int ret;
 	char key_buf[GLUSTER_NAME_MAX + 64];
 	char val_buf[GLUSTER_NAME_MAX + 1];


-- 
Samba Shared Repository



More information about the samba-cvs mailing list