[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Sat Aug 6 02:40:01 UTC 2022


The branch, master has been updated
       via  7cd87156761 vfs: Add struct vfs_open_how.resolve
       via  8693a0416b9 smbd: Hand vfs_open_how to openat_pathref_fullname
       via  c3c5e6c3dd2 smbd: Pass vfs_open_how through fd_openat
       via  ccc26364a9e smbd: Pass vfs_open_how through non_widelink_open
       via  5fc016f2685 vfs: change openat propotype to match linux openat2
       via  5aaf38949ab vfs_glusterfs: add missing END_PROFILE(syscall_openat) to vfs_gluster_openat()
      from  0fdd7e16a1d samba-tool gpo: clean up tmpdir after create

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


- Log -----------------------------------------------------------------
commit 7cd871567615cb54cbefd66dd6a39206191473cc
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jun 3 16:45:41 2022 +0200

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

commit 8693a0416b9d8562878e68969d9564661189148b
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jun 17 10:54:14 2022 +0200

    smbd: Hand vfs_open_how to openat_pathref_fullname
    
    Pair-programmed-with: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c3c5e6c3dd2bc1b9b817b308f83e8c24824865e1
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jun 17 10:39:20 2022 +0200

    smbd: Pass vfs_open_how through fd_openat
    
    Pair-programmed-with: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ccc26364a9e707c396d16ec1389dcad8ccaf4546
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jun 16 17:09:55 2022 +0200

    smbd: Pass vfs_open_how through non_widelink_open
    
    process_symlink_open goes with it
    
    Pair-programmed-with: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5fc016f26852a1cc1d7809919ff00cc0404e23e3
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jun 3 15:53:29 2022 +0200

    vfs: change openat propotype to match linux openat2
    
    The Linux prototype for openat2 looks like this:
    
           long openat2(int dirfd, const char *pathname,
                       struct open_how *how, size_t size);
    
    where "struct open_how" is defined in "linux/openat2.h". It is
    designed to be extensible with further flags.
    
    The "size" parameter is required because there is no type checking
    between userland and kernelspace, so the way for Linux to find which
    version of open_how is being passed in is looking at the size:
    "open_how" is expected to only every grow with additional fields,
    should a change be necessary in the future.
    
    Samba does not have this problem, we can typecheck the struct and
    pointers, we expect all VFS modules to be compiled against the current
    vfs.h.
    
    For now this adds no functionality, but it will make further patches
    much smaller.
    
    Pair-programmed-with: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5aaf38949aba3176f43719c4c0ec29ae1398f962
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 5 11:17:50 2022 +0000

    vfs_glusterfs: add missing END_PROFILE(syscall_openat) to vfs_gluster_openat()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 examples/VFS/skel_opaque.c            |  8 +++-
 examples/VFS/skel_transparent.c       |  5 +--
 source3/include/vfs.h                 | 16 +++++---
 source3/include/vfs_macros.h          | 10 +++--
 source3/lib/adouble.c                 | 15 ++++----
 source3/modules/vfs_aio_pthread.c     | 26 +++++++------
 source3/modules/vfs_audit.c           |  8 ++--
 source3/modules/vfs_cap.c             |  7 +---
 source3/modules/vfs_catia.c           |  7 +---
 source3/modules/vfs_ceph.c            | 10 ++++-
 source3/modules/vfs_ceph_snapshots.c  |  9 ++---
 source3/modules/vfs_commit.c          | 10 ++---
 source3/modules/vfs_default.c         | 11 +++++-
 source3/modules/vfs_error_inject.c    |  7 ++--
 source3/modules/vfs_extd_audit.c      |  7 ++--
 source3/modules/vfs_fruit.c           | 45 +++++++++++++---------
 source3/modules/vfs_full_audit.c      |  7 ++--
 source3/modules/vfs_glusterfs.c       | 24 ++++++++----
 source3/modules/vfs_gpfs.c            |  8 ++--
 source3/modules/vfs_media_harmony.c   |  8 ++--
 source3/modules/vfs_not_implemented.c |  3 +-
 source3/modules/vfs_prealloc.c        | 11 +++---
 source3/modules/vfs_preopen.c         | 10 ++---
 source3/modules/vfs_shadow_copy2.c    | 28 ++++++++------
 source3/modules/vfs_snapper.c         |  8 ++--
 source3/modules/vfs_streams_depot.c   | 16 ++++----
 source3/modules/vfs_streams_xattr.c   | 19 +++++----
 source3/modules/vfs_syncops.c         |  7 ++--
 source3/modules/vfs_time_audit.c      |  6 +--
 source3/modules/vfs_unityed_media.c   |  9 ++---
 source3/modules/vfs_virusfilter.c     |  7 ++--
 source3/modules/vfs_widelinks.c       |  9 ++---
 source3/modules/vfs_xattr_tdb.c       |  9 ++---
 source3/smbd/durable.c                | 10 ++---
 source3/smbd/files.c                  | 43 ++++++++++++---------
 source3/smbd/open.c                   | 72 +++++++++++++++++------------------
 source3/smbd/proto.h                  |  2 +-
 source3/smbd/pysmbd.c                 |  4 +-
 source3/smbd/smb2_query_directory.c   |  7 ++--
 source3/smbd/vfs.c                    |  6 +--
 source3/torture/cmd_vfs.c             | 57 ++++++++++++---------------
 41 files changed, 302 insertions(+), 289 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 23614b660d9..a72ba57e1a7 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -197,9 +197,13 @@ static int skel_openat(struct vfs_handle_struct *handle,
 		       const struct files_struct *dirfsp,
 		       const struct smb_filename *smb_fname,
 		       struct files_struct *fsp,
-		       int flags,
-		       mode_t mode)
+		       const struct vfs_open_how *how)
 {
+	if (how->resolve != 0) {
+		errno = ENOSYS;
+		return -1;
+	}
+
 	errno = ENOSYS;
 	return -1;
 }
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 9fc211c5e2e..8fb8644ad09 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -206,10 +206,9 @@ static int skel_openat(struct vfs_handle_struct *handle,
 		       const struct files_struct *dirfsp,
 		       const struct smb_filename *smb_fname,
 		       struct files_struct *fsp,
-		       int flags,
-		       mode_t mode)
+		       const struct vfs_open_how *how)
 {
-	return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+	return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how);
 }
 
 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index be4712689eb..866d2a5f4a8 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -373,6 +373,7 @@
  * Version 47 - Replace SMB_VFS_GET_REAL_FILENAME with SMB_VFS_GET_REAL_FILENAME_AT
  * Version 47 - Re-add dirfsp to CREATE_FILE
  * Version 47 - Add fsp flag fstat_before_close
+ * Version 47 - Change SMB_VFS_OPENAT() to match the Linux openat2 prototype, add vfs_open_how
  */
 
 #define SMB_VFS_INTERFACE_VERSION 47
@@ -904,6 +905,12 @@ struct vfs_aio_state {
 	uint64_t duration;
 };
 
+struct vfs_open_how {
+	int flags;
+	mode_t mode;
+	uint64_t resolve;
+};
+
 /*
     Available VFS operations. These values must be in sync with vfs_ops struct
     (struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops).
@@ -974,8 +981,7 @@ struct vfs_fn_pointers {
 			 const struct files_struct *dirfsp,
 			 const struct smb_filename *smb_fname,
 			 struct files_struct *fsp,
-			 int flags,
-			 mode_t mode);
+			 const struct vfs_open_how *how);
 	NTSTATUS (*create_file_fn)(struct vfs_handle_struct *handle,
 				   struct smb_request *req,
 				   struct files_struct *dirfsp,
@@ -1460,8 +1466,7 @@ int smb_vfs_call_openat(struct vfs_handle_struct *handle,
 			const struct files_struct *dirfsp,
 			const struct smb_filename *smb_fname,
 			struct files_struct *fsp,
-			int flags,
-			mode_t mode);
+			const struct vfs_open_how *how);
 NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
 				  struct smb_request *req,
 				  struct files_struct *dirfsp,
@@ -1905,8 +1910,7 @@ int vfs_not_implemented_openat(vfs_handle_struct *handle,
 			       const struct files_struct *dirfsp,
 			       const struct smb_filename *smb_fname,
 			       struct files_struct *fsp,
-			       int flags,
-			       mode_t mode);
+			       const struct vfs_open_how *how);
 NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle,
 				struct smb_request *req,
 				struct files_struct *dirfsp,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 840e77cf1b0..c7089b62964 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -142,10 +142,12 @@
 	smb_vfs_call_closedir((handle)->next, (dir))
 
 /* File operations */
-#define SMB_VFS_OPENAT(conn, dirfsp, smb_fname, fsp, flags, mode) \
-	smb_vfs_call_openat((conn)->vfs_handles, (dirfsp), (smb_fname), (fsp), (flags), (mode))
-#define SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode) \
-	smb_vfs_call_openat((handle)->next, (dirfsp), (smb_fname), (fsp), (flags), (mode))
+#define SMB_VFS_OPENAT(conn, dirfsp, smb_fname, fsp, how) \
+	smb_vfs_call_openat( \
+		(conn)->vfs_handles, (dirfsp), (smb_fname), (fsp), (how))
+#define SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how) \
+	smb_vfs_call_openat( \
+		(handle)->next, (dirfsp), (smb_fname), (fsp), (how))
 
 #define SMB_VFS_CREATE_FILE(conn, req, dirfsp, smb_fname, access_mask, share_access, create_disposition, \
         create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \
diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c
index b831464f5a9..062c73ec758 100644
--- a/source3/lib/adouble.c
+++ b/source3/lib/adouble.c
@@ -2199,7 +2199,7 @@ static NTSTATUS adouble_open_rsrc_fsp(const struct files_struct *dirfsp,
 	struct smb_filename *adp_smb_fname = NULL;
 	struct files_struct *ad_fsp = NULL;
 	NTSTATUS status;
-	int flags = in_flags;
+	struct vfs_open_how how = { .flags = in_flags, .mode = mode, };
 
 	rc = adouble_path(talloc_tos(),
 			  smb_base_fname,
@@ -2216,25 +2216,24 @@ static NTSTATUS adouble_open_rsrc_fsp(const struct files_struct *dirfsp,
 	}
 
 #ifdef O_PATH
-	flags &= ~(O_PATH);
+	how.flags &= ~(O_PATH);
 #endif
-	if (flags & (O_CREAT | O_TRUNC | O_WRONLY)) {
+	if (how.flags & (O_CREAT | O_TRUNC | O_WRONLY)) {
 		/* We always need read/write access for the metadata header too */
-		flags &= ~(O_WRONLY);
-		flags |= O_RDWR;
+		how.flags &= ~(O_WRONLY);
+		how.flags |= O_RDWR;
 	}
 
 	status = fd_openat(dirfsp,
 			   adp_smb_fname,
 			   ad_fsp,
-			   flags,
-			   mode);
+			   &how);
 	if (!NT_STATUS_IS_OK(status)) {
 		file_free(NULL, ad_fsp);
 		return status;
 	}
 
-	if (flags & (O_CREAT | O_TRUNC)) {
+	if (how.flags & (O_CREAT | O_TRUNC)) {
 		ad = ad_init(talloc_tos(), ADOUBLE_RSRC);
 		if (ad == NULL) {
 			file_free(NULL, ad_fsp);
diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c
index d58e990a666..5d051b4f7da 100644
--- a/source3/modules/vfs_aio_pthread.c
+++ b/source3/modules/vfs_aio_pthread.c
@@ -450,14 +450,18 @@ static int aio_pthread_openat_fn(vfs_handle_struct *handle,
 				 const struct files_struct *dirfsp,
 				 const struct smb_filename *smb_fname,
 				 struct files_struct *fsp,
-				 int flags,
-				 mode_t mode)
+				 const struct vfs_open_how *how)
 {
 	int my_errno = 0;
 	int fd = -1;
 	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;
@@ -475,24 +479,24 @@ static int aio_pthread_openat_fn(vfs_handle_struct *handle,
 		/* aio opens turned off. */
 		return openat(fsp_get_pathref_fd(dirfsp),
 			      smb_fname->base_name,
-			      flags,
-			      mode);
+			      how->flags,
+			      how->mode);
 	}
 
-	if (!(flags & O_CREAT)) {
+	if (!(how->flags & O_CREAT)) {
 		/* Only creates matter. */
 		return openat(fsp_get_pathref_fd(dirfsp),
 			      smb_fname->base_name,
-			      flags,
-			      mode);
+			      how->flags,
+			      how->mode);
 	}
 
-	if (!(flags & O_EXCL)) {
+	if (!(how->flags & O_EXCL)) {
 		/* Only creates with O_EXCL matter. */
 		return openat(fsp_get_pathref_fd(dirfsp),
 			      smb_fname->base_name,
-			      flags,
-			      mode);
+			      how->flags,
+			      how->mode);
 	}
 
 	/*
@@ -508,7 +512,7 @@ static int aio_pthread_openat_fn(vfs_handle_struct *handle,
 	}
 
 	/* Ok, it's a create exclusive call - pass it to a thread helper. */
-	return open_async(dirfsp, smb_fname, fsp, flags, mode);
+	return open_async(dirfsp, smb_fname, fsp, how->flags, how->mode);
 }
 #endif
 
diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c
index 91fbd8c19ba..2b01a6a8d91 100644
--- a/source3/modules/vfs_audit.c
+++ b/source3/modules/vfs_audit.c
@@ -211,17 +211,17 @@ static int audit_openat(vfs_handle_struct *handle,
 			const struct files_struct *dirfsp,
 			const struct smb_filename *smb_fname,
 			struct files_struct *fsp,
-			int flags,
-			mode_t mode)
+			const struct vfs_open_how *how)
 {
 	int result;
 
-	result = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+	result = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how);
 
 	syslog(audit_syslog_priority(handle),
 	       "openat %s (fd %d) %s%s%s\n",
 	       fsp_str_dbg(fsp), result,
-	       ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "",
+	       ((how->flags & O_WRONLY) || (how->flags & O_RDWR)) ?
+	       "for writing " : "",
 	       (result < 0) ? "failed: " : "",
 	       (result < 0) ? strerror(errno) : "");
 
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 43c8edb8932..ac2c1b0410d 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -152,8 +152,7 @@ static int cap_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)
 {
 	char *cappath = NULL;
 	struct smb_filename *smb_fname = NULL;
@@ -179,9 +178,7 @@ static int cap_openat(vfs_handle_struct *handle,
 				  dirfsp,
 				  smb_fname,
 				  fsp,
-				  flags,
-				  mode);
-
+				  how);
 	if (ret == -1) {
 		saved_errno = errno;
 	}
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index f40bec3b74c..36aa43123fd 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -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;
 	}
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 14582905212..2186bfdb2ce 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -400,14 +400,20 @@ static int cephwrap_openat(struct vfs_handle_struct *handle,
 			   const struct files_struct *dirfsp,
 			   const struct smb_filename *smb_fname,
 			   files_struct *fsp,
-			   int flags,
-			   mode_t mode)
+			   const struct vfs_open_how *how)
 {
+	int flags = how->flags;
+	mode_t mode = how->mode;
 	struct smb_filename *name = NULL;
 	bool have_opath = false;
 	bool became_root = false;
 	int result = -ENOENT;
 
+	if (how->resolve != 0) {
+		errno = ENOSYS;
+		return -1;
+	}
+
 	/*
 	 * ceph doesn't have openat().
 	 */
diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c
index 06ef5538450..c981cebd8a2 100644
--- a/source3/modules/vfs_ceph_snapshots.c
+++ b/source3/modules/vfs_ceph_snapshots.c
@@ -939,8 +939,7 @@ static int ceph_snap_gmt_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)
 {
 	time_t timestamp = 0;
 	struct smb_filename *smb_fname = NULL;
@@ -963,8 +962,7 @@ static int ceph_snap_gmt_openat(vfs_handle_struct *handle,
 					   dirfsp,
 					   smb_fname_in,
 					   fsp,
-					   flags,
-					   mode);
+					   how);
 	}
 
 	ret = ceph_snap_gmt_convert(handle,
@@ -986,8 +984,7 @@ static int ceph_snap_gmt_openat(vfs_handle_struct *handle,
 				  dirfsp,
 				  smb_fname,
 				  fsp,
-				  flags,
-				  mode);
+				  how);
 	if (ret == -1) {
 		saved_errno = errno;
 	}
diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c
index 6d64896c7e0..c7625b0837c 100644
--- a/source3/modules/vfs_commit.c
+++ b/source3/modules/vfs_commit.c
@@ -181,8 +181,7 @@ static int commit_openat(struct vfs_handle_struct *handle,
 			 const struct files_struct *dirfsp,
 			 const struct smb_filename *smb_fname,
 			 files_struct *fsp,
-			 int flags,
-			 mode_t mode)
+			 const struct vfs_open_how *how)
 {
         off_t dthresh;
 	const char *eof_mode;
@@ -190,13 +189,12 @@ static int commit_openat(struct vfs_handle_struct *handle,
         int fd;
 
         /* Don't bother with read-only files. */
-        if ((flags & O_ACCMODE) == O_RDONLY) {
+        if ((how->flags & O_ACCMODE) == O_RDONLY) {
                 return SMB_VFS_NEXT_OPENAT(handle,
 					   dirfsp,
 					   smb_fname,
 					   fsp,
-					   flags,
-					   mode);
+					   how);
         }
 
         /* Read and check module configuration */
@@ -226,7 +224,7 @@ static int commit_openat(struct vfs_handle_struct *handle,
                 }
         }
 
-        fd = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+	fd = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how);
 	if (fd == -1) {
 		VFS_REMOVE_FSP_EXTENSION(handle, fsp);
 		return fd;
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index ef68a96282e..9cf70fd84ce 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -691,15 +691,22 @@ static int vfswrap_openat(vfs_handle_struct *handle,
 			  const struct files_struct *dirfsp,
 			  const struct smb_filename *smb_fname,
 			  files_struct *fsp,
-			  int flags,
-			  mode_t mode)
+			  const struct vfs_open_how *how)
 {
+	int flags = how->flags;
+	mode_t mode = how->mode;
 	bool have_opath = false;
 	bool became_root = false;
 	int result;
 
 	START_PROFILE(syscall_openat);
 
+	if (how->resolve != 0) {
+		errno = ENOSYS;
+		result = -1;
+		goto out;
+	}
+
 	if (is_named_stream(smb_fname)) {
 		errno = ENOENT;
 		result = -1;
diff --git a/source3/modules/vfs_error_inject.c b/source3/modules/vfs_error_inject.c
index 9ead2c26727..1a327097b30 100644
--- a/source3/modules/vfs_error_inject.c
+++ b/source3/modules/vfs_error_inject.c
@@ -112,8 +112,7 @@ static int vfs_error_inject_openat(struct vfs_handle_struct *handle,
 				   const struct files_struct *dirfsp,
 				   const struct smb_filename *smb_fname,
 				   files_struct *fsp,
-				   int flags,
-				   mode_t mode)
+				   const struct vfs_open_how *how)
 {
 	int error = inject_unix_error("openat", handle);
 	int dirfsp_flags = (O_NOFOLLOW|O_DIRECTORY);
@@ -129,13 +128,13 @@ static int vfs_error_inject_openat(struct vfs_handle_struct *handle,
 
 	return_error = (error != 0);
 	return_error &= !fsp->fsp_flags.is_pathref;
-	return_error &= ((flags & dirfsp_flags) != dirfsp_flags);
+	return_error &= ((how->flags & dirfsp_flags) != dirfsp_flags);
 
 	if (return_error) {
 		errno = error;
 		return -1;
 	}
-	return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+	return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how);
 }
 
 static int vfs_error_inject_unlinkat(struct vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c
index 3ac75fb890e..91dce6c7dc5 100644
--- a/source3/modules/vfs_extd_audit.c
+++ b/source3/modules/vfs_extd_audit.c
@@ -227,12 +227,11 @@ static int audit_openat(vfs_handle_struct *handle,
 			const struct files_struct *dirfsp,
 			const struct smb_filename *smb_fname,
 			files_struct *fsp,
-			int flags,
-			mode_t mode)
+			const struct vfs_open_how *how)
 {
 	int ret;
 
-	ret = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+	ret = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how);
 
 	if (lp_syslog() > 0) {
 		syslog(audit_syslog_priority(handle),
@@ -240,7 +239,7 @@ static int audit_openat(vfs_handle_struct *handle,
 		       smb_fname_str_dbg(fsp->fsp_name),
 		       smb_fname->base_name,
 		       ret,
-		       ((flags & O_WRONLY) || (flags & O_RDWR)) ?
+		       ((how->flags & O_WRONLY) || (how->flags & O_RDWR)) ?
 		       "for writing " : "",
 		       (ret < 0) ? "failed: " : "",
 		       (ret < 0) ? strerror(errno) : "");
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 685c15bcaa7..13033096dc9 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -1413,7 +1413,10 @@ static int fruit_open_meta_stream(vfs_handle_struct *handle,
 {
 	struct fruit_config_data *config = NULL;
 	struct fio *fio = NULL;
-	int open_flags = flags & ~O_CREAT;
+	struct vfs_open_how how = {
+		.flags = flags & ~O_CREAT,
+		.mode = mode,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list