[SCM] Samba Shared Repository - branch master updated

Noel Power npower at samba.org
Tue Jun 29 09:10:02 UTC 2021


The branch, master has been updated
       via  d1ca3137809 s3: VFS: Update status of SMB_VFS_CHFLAGS
       via  f3008db0c3f VFS: Remove SMB_VFS_CHFLAGS, not used anymore
       via  ceb1403d04b VFS: unityed_media: Remove SMB_VFS_CHFLAGS
       via  8f243bb8c24 VFS: snapper: Remove SMB_VFS_CHFLAGS
       via  3d71465b46a VFS: shadow_copy2: Remove SMB_VFS_CHFLAGS
       via  205532f38a4 VFS: media_harmony: Remove SMB_VFS_CHFLAGS
       via  a7eb3a7125e VFS: glusterfs Remove SMB_VFS_CHFLAGS
       via  f60235f2bdc VFS: catia: Remove SMB_VFS_CHFLAGS
       via  11e1deaf91f VFS: ceph_snapshot Remove SMB_VFS_CHFLAGS
       via  2e24d9c5343 VFS: ceph: Remove SMB_VFS_CHFLAGS
       via  4b98fc6914d s3/smbd: smb_set_file_unix_info2: SMB_VFS_CHFLAGS -> SMB_VFS_FCHFLAGS
       via  a346647edd2 VFS: snapper: Add SMB_VFS_FCHFLAGS implementation
       via  d8e5ffa94e9 VFS: shadow_copy2: Add SMB_VFS_FCHFLAGS implementation
       via  a6c45ba03e8 VFS: glusterfs: Add SMB_VFS_FCHFLAGS implementation
       via  afad1ce9485 VFS: ceph_snapshots: Add SMB_VFS_FCHFLAGS implementation
       via  69ef500b8d5 VFS: ceph: Add SMB_VFS_FCHFLAGS implementation
       via  9ca41e197f3 VFS: Add initial implemenataion for SMB_VFS_FCHFLAGS
      from  5f70396e62d idl: secrets_domain_info1_change is not a recursive structure

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


- Log -----------------------------------------------------------------
commit d1ca3137809800fe1014a06aa3912241d540d1b2
Author: Noel Power <noel.power at suse.com>
Date:   Thu Jun 17 10:03:05 2021 +0100

    s3: VFS: Update status of SMB_VFS_CHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Tue Jun 29 09:10:00 UTC 2021 on sn-devel-184

commit f3008db0c3f3ae277ee38dcedea094b78cc53487
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 16:58:24 2021 +0100

    VFS: Remove SMB_VFS_CHFLAGS, not used anymore
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ceb1403d04ba67d0ea92c58a05a457f1bd47acf4
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 16:34:01 2021 +0100

    VFS: unityed_media: Remove SMB_VFS_CHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8f243bb8c248fe48f4fd2cd87366fddb7f3e06c3
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 16:33:30 2021 +0100

    VFS: snapper: Remove SMB_VFS_CHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3d71465b46ac3bec1db46347a5d9945df96b46a8
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 16:33:02 2021 +0100

    VFS: shadow_copy2: Remove SMB_VFS_CHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 205532f38a468fad72f5a153baece9fab4ac4f09
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 16:32:41 2021 +0100

    VFS: media_harmony: Remove SMB_VFS_CHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a7eb3a7125e3b56c6400af09ec01c882dcad70dd
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 16:32:04 2021 +0100

    VFS: glusterfs Remove SMB_VFS_CHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f60235f2bdc673464d62bad262837b8c6bc828b3
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 16:30:04 2021 +0100

    VFS: catia: Remove SMB_VFS_CHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 11e1deaf91fd56dc4d3f18fe42e653de379eda5f
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 16:31:38 2021 +0100

    VFS: ceph_snapshot Remove SMB_VFS_CHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2e24d9c53438935f0544b8f05335f0142b225c58
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 16:31:13 2021 +0100

    VFS: ceph: Remove SMB_VFS_CHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4b98fc6914d3b292d958a5aa55614949aa069f52
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 16:23:12 2021 +0100

    s3/smbd: smb_set_file_unix_info2: SMB_VFS_CHFLAGS -> SMB_VFS_FCHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a346647edd2e0b9b81dc75067b584a92fcd1eb56
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 15:46:56 2021 +0100

    VFS: snapper: Add SMB_VFS_FCHFLAGS implementation
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d8e5ffa94e9caf0a43864be6eadd36da4dec680e
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 15:46:30 2021 +0100

    VFS: shadow_copy2: Add SMB_VFS_FCHFLAGS implementation
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a6c45ba03e897bd9c97fa718ff29f0986214207e
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 15:46:07 2021 +0100

    VFS: glusterfs: Add SMB_VFS_FCHFLAGS implementation
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit afad1ce94855f11621e4bea02395ff6067a14eea
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 15:45:51 2021 +0100

    VFS: ceph_snapshots: Add SMB_VFS_FCHFLAGS implementation
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 69ef500b8d5fbcc55daf0b006ee3666e18d513b0
Author: Noel Power <noel.power at suse.com>
Date:   Fri Jun 11 15:45:38 2021 +0100

    VFS: ceph: Add SMB_VFS_FCHFLAGS implementation
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9ca41e197f3f9a012531e5502734f8df46a2d7a4
Author: Noel Power <noel.power at suse.com>
Date:   Thu Jun 10 16:31:40 2021 +0100

    VFS: Add initial implemenataion for SMB_VFS_FCHFLAGS
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 examples/VFS/skel_opaque.c            |  6 +++---
 examples/VFS/skel_transparent.c       |  8 ++++----
 source3/include/vfs.h                 | 11 +++++++++--
 source3/include/vfs_macros.h          |  8 ++++----
 source3/modules/The_New_VFS.org       |  2 +-
 source3/modules/The_New_VFS.txt       |  2 +-
 source3/modules/vfs_catia.c           | 37 -----------------------------------
 source3/modules/vfs_ceph.c            |  7 ++++---
 source3/modules/vfs_ceph_snapshots.c  | 10 +++++-----
 source3/modules/vfs_default.c         | 31 ++++++++++++++++++++++++-----
 source3/modules/vfs_full_audit.c      | 16 +++++++--------
 source3/modules/vfs_glusterfs.c       |  6 +++---
 source3/modules/vfs_media_harmony.c   | 34 --------------------------------
 source3/modules/vfs_not_implemented.c |  6 +++---
 source3/modules/vfs_shadow_copy2.c    | 10 +++++-----
 source3/modules/vfs_snapper.c         | 10 +++++-----
 source3/modules/vfs_time_audit.c      | 12 +++++++-----
 source3/modules/vfs_unityed_media.c   | 26 ------------------------
 source3/smbd/trans2.c                 | 18 +++++++----------
 source3/smbd/vfs.c                    |  8 ++++----
 source3/wscript                       |  3 ++-
 21 files changed, 101 insertions(+), 170 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 2fad722de04..a65deaf3204 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -506,8 +506,8 @@ static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
 	return NULL;
 }
 
-static int skel_chflags(vfs_handle_struct *handle,
-			const struct smb_filename *smb_fname,
+static int skel_fchflags(vfs_handle_struct *handle,
+			struct files_struct *fsp,
 			uint flags)
 {
 	errno = ENOSYS;
@@ -1028,7 +1028,7 @@ static struct vfs_fn_pointers skel_opaque_fns = {
 	.linkat_fn = skel_linkat,
 	.mknodat_fn = skel_mknodat,
 	.realpath_fn = skel_realpath,
-	.chflags_fn = skel_chflags,
+	.fchflags_fn = skel_fchflags,
 	.file_id_create_fn = skel_file_id_create,
 	.fs_file_id_fn = skel_fs_file_id,
 	.offload_read_send_fn = skel_offload_read_send,
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 6783996a5e0..87f974c214b 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -642,11 +642,11 @@ static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
 	return SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname);
 }
 
-static int skel_chflags(vfs_handle_struct *handle,
-			const struct smb_filename *smb_fname,
+static int skel_fchflags(vfs_handle_struct *handle,
+			struct files_struct *fsp,
 			uint flags)
 {
-	return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
+	return SMB_VFS_NEXT_FCHFLAGS(handle, fsp, flags);
 }
 
 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
@@ -1333,7 +1333,7 @@ static struct vfs_fn_pointers skel_transparent_fns = {
 	.linkat_fn = skel_linkat,
 	.mknodat_fn = skel_mknodat,
 	.realpath_fn = skel_realpath,
-	.chflags_fn = skel_chflags,
+	.fchflags_fn = skel_fchflags,
 	.file_id_create_fn = skel_file_id_create,
 	.fs_file_id_fn = skel_fs_file_id,
 	.offload_read_send_fn = skel_offload_read_send,
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 5bc9f18ad57..aa2801054b2 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -358,6 +358,7 @@
  * Version 45 - Remove SMB_VFS_GET_NT_ACL_AT
  * Version 45 - Remove SYS_ACL_GET_FILE
  * Version 45 - Remove SYS_ACL_BLOB_GET_FILE
+ * Version 45 - Add SMB_VFS_FCHFLAGS
  */
 
 #define SMB_VFS_INTERFACE_VERSION 45
@@ -1066,8 +1067,8 @@ struct vfs_fn_pointers {
 	struct smb_filename *(*realpath_fn)(struct vfs_handle_struct *handle,
 				TALLOC_CTX *ctx,
 				const struct smb_filename *smb_fname);
-	int (*chflags_fn)(struct vfs_handle_struct *handle,
-				const struct smb_filename *smb_fname,
+	int (*fchflags_fn)(struct vfs_handle_struct *handle,
+				struct files_struct *fsp,
 				unsigned int flags);
 	struct file_id (*file_id_create_fn)(struct vfs_handle_struct *handle,
 					    const SMB_STRUCT_STAT *sbuf);
@@ -1582,6 +1583,9 @@ struct smb_filename *smb_vfs_call_realpath(struct vfs_handle_struct *handle,
 int smb_vfs_call_chflags(struct vfs_handle_struct *handle,
 			const struct smb_filename *smb_fname,
 			unsigned int flags);
+int smb_vfs_call_fchflags(struct vfs_handle_struct *handle,
+			struct files_struct *fsp,
+			unsigned int flags);
 struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle,
 					   const SMB_STRUCT_STAT *sbuf);
 uint64_t smb_vfs_call_fs_file_id(struct vfs_handle_struct *handle,
@@ -2005,6 +2009,9 @@ struct smb_filename *vfs_not_implemented_realpath(vfs_handle_struct *handle,
 int vfs_not_implemented_chflags(vfs_handle_struct *handle,
 				const struct smb_filename *smb_fname,
 				uint flags);
+int vfs_not_implemented_fchflags(vfs_handle_struct *handle,
+				struct files_struct *fst,
+				uint flags);
 struct file_id vfs_not_implemented_file_id_create(vfs_handle_struct *handle,
 						  const SMB_STRUCT_STAT *sbuf);
 uint64_t vfs_not_implemented_fs_file_id(vfs_handle_struct *handle,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 2d2aa206c2e..0c7ce1c5d61 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -328,10 +328,10 @@
 #define SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname) \
 	smb_vfs_call_realpath((handle)->next, (ctx), (smb_fname))
 
-#define SMB_VFS_CHFLAGS(conn, smb_fname, flags) \
-	smb_vfs_call_chflags((conn)->vfs_handles, (smb_fname), (flags))
-#define SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags) \
-	smb_vfs_call_chflags((handle)->next, (smb_fname), (flags))
+#define SMB_VFS_FCHFLAGS(fsp, flags) \
+	smb_vfs_call_fchflags((fsp)->conn->vfs_handles, (fsp), (flags))
+#define SMB_VFS_NEXT_FCHFLAGS(handle, fsp, flags) \
+	smb_vfs_call_fchflags((handle)->next, (fsp), (flags))
 
 #define SMB_VFS_FILE_ID_CREATE(conn, sbuf) \
 	smb_vfs_call_file_id_create((conn)->vfs_handles, (sbuf))
diff --git a/source3/modules/The_New_VFS.org b/source3/modules/The_New_VFS.org
index 12eed5ba9a0..f85e005232d 100644
--- a/source3/modules/The_New_VFS.org
+++ b/source3/modules/The_New_VFS.org
@@ -202,7 +202,7 @@ whenever VFS access is done in a piecemeal fashion.
 | SMB_VFS_BRL_LOCK_WINDOWS()        | [[fsp][fsp]]      | -      |
 | SMB_VFS_BRL_UNLOCK_WINDOWS()      | [[fsp][fsp]]      | -      |
 | SMB_VFS_CHDIR()                   | [[Path][Path]]     | Todo   |
-| SMB_VFS_CHFLAGS()                 | [[Path][Path]]     | Todo   |
+| SMB_VFS_CHFLAGS()                 | [[Path][Path]]     | -      |
 | SMB_VFS_CHMOD()                   | [[Path][Path]]     | -      |
 | SMB_VFS_CLOSE()                   | [[fsp][fsp]]      | -      |
 | SMB_VFS_CLOSEDIR()                | [[fsp][fsp]]      | -      |
diff --git a/source3/modules/The_New_VFS.txt b/source3/modules/The_New_VFS.txt
index b3da1a3c97e..6405371c816 100644
--- a/source3/modules/The_New_VFS.txt
+++ b/source3/modules/The_New_VFS.txt
@@ -270,7 +270,7 @@ Table of Contents
    SMB_VFS_BRL_LOCK_WINDOWS()         [fsp]       -
    SMB_VFS_BRL_UNLOCK_WINDOWS()       [fsp]       -
    SMB_VFS_CHDIR()                    [Path]      Todo
-   SMB_VFS_CHFLAGS()                  [Path]      Todo
+   SMB_VFS_CHFLAGS()                  [Path]      -
    SMB_VFS_CHMOD()                    [Path]      -
    SMB_VFS_CLOSE()                    [fsp]       -
    SMB_VFS_CLOSEDIR()                 [fsp]       -
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index c1bda1759b3..22b0696e73d 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -871,42 +871,6 @@ catia_realpath(vfs_handle_struct *handle,
 	return return_fname;
 }
 
-static int catia_chflags(struct vfs_handle_struct *handle,
-			const struct smb_filename *smb_fname,
-			unsigned int flags)
-{
-	char *name = NULL;
-	struct smb_filename *catia_smb_fname = NULL;
-	NTSTATUS status;
-	int ret;
-
-	status = catia_string_replace_allocate(handle->conn,
-				smb_fname->base_name,
-				&name,
-				vfs_translate_to_unix);
-	if (!NT_STATUS_IS_OK(status)) {
-		errno = map_errno_from_nt_status(status);
-		return -1;
-	}
-	catia_smb_fname = synthetic_smb_fname(talloc_tos(),
-					name,
-					NULL,
-					&smb_fname->st,
-					smb_fname->twrp,
-					smb_fname->flags);
-	if (catia_smb_fname == NULL) {
-		TALLOC_FREE(name);
-		errno = ENOMEM;
-		return -1;
-	}
-
-	ret = SMB_VFS_NEXT_CHFLAGS(handle, catia_smb_fname, flags);
-	TALLOC_FREE(name);
-	TALLOC_FREE(catia_smb_fname);
-
-	return ret;
-}
-
 static NTSTATUS
 catia_fstreaminfo(struct vfs_handle_struct *handle,
 		 struct files_struct *fsp,
@@ -1991,7 +1955,6 @@ static struct vfs_fn_pointers vfs_catia_fns = {
 	.linux_setlease_fn = catia_linux_setlease,
 	.getlock_fn = catia_getlock,
 	.realpath_fn = catia_realpath,
-	.chflags_fn = catia_chflags,
 	.fstreaminfo_fn = catia_fstreaminfo,
 	.strict_lock_check_fn = catia_strict_lock_check,
 	.translate_name_fn = catia_translate_name,
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 0e7f2d89c88..5cb69e3e3c8 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -1257,8 +1257,9 @@ static struct smb_filename *cephwrap_realpath(struct vfs_handle_struct *handle,
 	return result_fname;
 }
 
-static int cephwrap_chflags(struct vfs_handle_struct *handle,
-			const struct smb_filename *smb_fname,
+
+static int cephwrap_fchflags(struct vfs_handle_struct *handle,
+			struct files_struct *fsp,
 			unsigned int flags)
 {
 	errno = ENOSYS;
@@ -1635,7 +1636,7 @@ static struct vfs_fn_pointers ceph_fns = {
 	.linkat_fn = cephwrap_linkat,
 	.mknodat_fn = cephwrap_mknodat,
 	.realpath_fn = cephwrap_realpath,
-	.chflags_fn = cephwrap_chflags,
+	.fchflags_fn = cephwrap_fchflags,
 	.get_real_filename_fn = cephwrap_get_real_filename,
 	.connectpath_fn = cephwrap_connectpath,
 
diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c
index 26844e50187..4e226b1d8a1 100644
--- a/source3/modules/vfs_ceph_snapshots.c
+++ b/source3/modules/vfs_ceph_snapshots.c
@@ -1257,15 +1257,15 @@ static int ceph_snap_gmt_mkdirat(vfs_handle_struct *handle,
 			mode);
 }
 
-static int ceph_snap_gmt_chflags(vfs_handle_struct *handle,
-				const struct smb_filename *csmb_fname,
+static int ceph_snap_gmt_fchflags(vfs_handle_struct *handle,
+				struct files_struct *fsp,
 				unsigned int flags)
 {
 	time_t timestamp = 0;
 	int ret;
 
 	ret = ceph_snap_gmt_strip_snapshot(handle,
-					csmb_fname,
+					fsp->fsp_name,
 					&timestamp, NULL, 0);
 	if (ret < 0) {
 		errno = -ret;
@@ -1275,7 +1275,7 @@ static int ceph_snap_gmt_chflags(vfs_handle_struct *handle,
 		errno = EROFS;
 		return -1;
 	}
-	return SMB_VFS_NEXT_CHFLAGS(handle, csmb_fname, flags);
+	return SMB_VFS_NEXT_FCHFLAGS(handle, fsp, flags);
 }
 
 static ssize_t ceph_snap_gmt_getxattr(vfs_handle_struct *handle,
@@ -1495,7 +1495,7 @@ static struct vfs_fn_pointers ceph_snap_fns = {
 	.getxattrat_send_fn = vfs_not_implemented_getxattrat_send,
 	.getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
 	.fsetxattr_fn = ceph_snap_gmt_fsetxattr,
-	.chflags_fn = ceph_snap_gmt_chflags,
+	.fchflags_fn = ceph_snap_gmt_fchflags,
 	.get_real_filename_fn = ceph_snap_gmt_get_real_filename,
 };
 
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 9acc5bda0ad..648950bf730 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -3065,12 +3065,33 @@ static struct smb_filename *vfswrap_realpath(vfs_handle_struct *handle,
 	return result_fname;
 }
 
-static int vfswrap_chflags(vfs_handle_struct *handle,
-			const struct smb_filename *smb_fname,
+static int vfswrap_fchflags(vfs_handle_struct *handle,
+			struct files_struct *fsp,
 			unsigned int flags)
 {
-#ifdef HAVE_CHFLAGS
-	return chflags(smb_fname->base_name, flags);
+#ifdef HAVE_FCHFLAGS
+	int fd = fsp_get_pathref_fd(fsp);
+
+	if (!fsp->fsp_flags.is_pathref) {
+		return fchflags(fd, flags);
+	}
+
+	if (fsp->fsp_flags.have_proc_fds) {
+		const char *p = NULL;
+		char buf[PATH_MAX];
+
+		p = sys_proc_fd_path(fd, buf, sizeof(buf));
+		if (p == NULL) {
+			return -1;
+		}
+
+		return chflags(p, flags);
+	}
+
+	/*
+	 * This is no longer a handle based call.
+	 */
+	return chflags(fsp->fsp_name->base_name, flags);
 #else
 	errno = ENOSYS;
 	return -1;
@@ -3847,7 +3868,7 @@ static struct vfs_fn_pointers vfs_default_fns = {
 	.linkat_fn = vfswrap_linkat,
 	.mknodat_fn = vfswrap_mknodat,
 	.realpath_fn = vfswrap_realpath,
-	.chflags_fn = vfswrap_chflags,
+	.fchflags_fn = vfswrap_fchflags,
 	.file_id_create_fn = vfswrap_file_id_create,
 	.fs_file_id_fn = vfswrap_fs_file_id,
 	.fstreaminfo_fn = vfswrap_fstreaminfo,
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index bac60117eea..1c11737964e 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -160,7 +160,7 @@ typedef enum _vfs_op_type {
 	SMB_VFS_OP_LINKAT,
 	SMB_VFS_OP_MKNODAT,
 	SMB_VFS_OP_REALPATH,
-	SMB_VFS_OP_CHFLAGS,
+	SMB_VFS_OP_FCHFLAGS,
 	SMB_VFS_OP_FILE_ID_CREATE,
 	SMB_VFS_OP_FS_FILE_ID,
 	SMB_VFS_OP_FSTREAMINFO,
@@ -297,7 +297,7 @@ static struct {
 	{ SMB_VFS_OP_LINKAT,	"linkat" },
 	{ SMB_VFS_OP_MKNODAT,	"mknodat" },
 	{ SMB_VFS_OP_REALPATH,	"realpath" },
-	{ SMB_VFS_OP_CHFLAGS,	"chflags" },
+	{ SMB_VFS_OP_FCHFLAGS,	"fchflags" },
 	{ SMB_VFS_OP_FILE_ID_CREATE,	"file_id_create" },
 	{ SMB_VFS_OP_FS_FILE_ID,	"fs_file_id" },
 	{ SMB_VFS_OP_FSTREAMINFO,	"fstreaminfo" },
@@ -1981,19 +1981,19 @@ static struct smb_filename *smb_full_audit_realpath(vfs_handle_struct *handle,
 	return result_fname;
 }
 
-static int smb_full_audit_chflags(vfs_handle_struct *handle,
-			const struct smb_filename *smb_fname,
+static int smb_full_audit_fchflags(vfs_handle_struct *handle,
+			struct files_struct *fsp,
 			unsigned int flags)
 {
 	int result;
 
-	result = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
+	result = SMB_VFS_NEXT_FCHFLAGS(handle, fsp, flags);
 
-	do_log(SMB_VFS_OP_CHFLAGS,
+	do_log(SMB_VFS_OP_FCHFLAGS,
 	       (result != 0),
 	       handle,
 	       "%s",
-	       smb_fname_str_do_log(handle->conn, smb_fname));
+	       smb_fname_str_do_log(handle->conn, fsp->fsp_name));
 
 	return result;
 }
@@ -2958,7 +2958,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
 	.linkat_fn = smb_full_audit_linkat,
 	.mknodat_fn = smb_full_audit_mknodat,
 	.realpath_fn = smb_full_audit_realpath,
-	.chflags_fn = smb_full_audit_chflags,
+	.fchflags_fn = smb_full_audit_fchflags,
 	.file_id_create_fn = smb_full_audit_file_id_create,
 	.fs_file_id_fn = smb_full_audit_fs_file_id,
 	.offload_read_send_fn = smb_full_audit_offload_read_send,
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index ff19de53eea..83076fc5d97 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -1994,8 +1994,8 @@ static int vfs_gluster_mknodat(struct vfs_handle_struct *handle,
 	return ret;
 }
 
-static int vfs_gluster_chflags(struct vfs_handle_struct *handle,
-				const struct smb_filename *smb_fname,
+static int vfs_gluster_fchflags(struct vfs_handle_struct *handle,
+				struct files_struct *fsp,
 				unsigned int flags)
 {
 	errno = ENOSYS;
@@ -2372,7 +2372,7 @@ static struct vfs_fn_pointers glusterfs_fns = {
 	.linkat_fn = vfs_gluster_linkat,
 	.mknodat_fn = vfs_gluster_mknodat,
 	.realpath_fn = vfs_gluster_realpath,
-	.chflags_fn = vfs_gluster_chflags,
+	.fchflags_fn = vfs_gluster_fchflags,
 	.file_id_create_fn = NULL,
 	.fstreaminfo_fn = NULL,
 	.get_real_filename_fn = vfs_gluster_get_real_filename,
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index 800be5443b2..38966ec65d8 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -1823,39 +1823,6 @@ err:
 	return result_fname;
 }
 
-/*
- * Success: return 0
- * Failure: set errno, return -1
- */
-static int mh_chflags(vfs_handle_struct *handle,
-		const struct smb_filename *smb_fname,
-		unsigned int flags)
-{
-	int status;
-	struct smb_filename *clientFname = NULL;
-	TALLOC_CTX *ctx;
-
-	DEBUG(MH_INFO_DEBUG, ("Entering mh_chflags\n"));
-	if (!is_in_media_files(smb_fname->base_name)) {
-		status = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
-		goto out;
-	}
-
-	ctx = talloc_tos();
-
-	if ((status = alloc_get_client_smb_fname(handle, ctx,
-				smb_fname,
-				&clientFname))) {
-		goto err;
-	}
-
-	status = SMB_VFS_NEXT_CHFLAGS(handle, clientFname, flags);
-err:
-	TALLOC_FREE(clientFname);
-out:
-	return status;
-}
-
 /* Ignoring get_real_filename function because the default
  * doesn't do anything.
  */
@@ -1936,7 +1903,6 @@ static struct vfs_fn_pointers vfs_mh_fns = {
 	.linkat_fn = mh_linkat,
 	.mknodat_fn = mh_mknodat,
 	.realpath_fn = mh_realpath,
-	.chflags_fn = mh_chflags,
 
 	/* EA operations. */
 	.getxattr_fn = mh_getxattr,
diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c
index 2dfac2338c6..8e1d9af3870 100644
--- a/source3/modules/vfs_not_implemented.c
+++ b/source3/modules/vfs_not_implemented.c
@@ -504,8 +504,8 @@ struct smb_filename *vfs_not_implemented_realpath(vfs_handle_struct *handle,
 	return NULL;
 }
 
-int vfs_not_implemented_chflags(vfs_handle_struct *handle,
-				const struct smb_filename *smb_fname,
+int vfs_not_implemented_fchflags(vfs_handle_struct *handle,
+				struct files_struct *fsp,
 				uint flags)
 {
 	errno = ENOSYS;
@@ -1032,7 +1032,7 @@ static struct vfs_fn_pointers vfs_not_implemented_fns = {
 	.linkat_fn = vfs_not_implemented_linkat,
 	.mknodat_fn = vfs_not_implemented_mknodat,
 	.realpath_fn = vfs_not_implemented_realpath,
-	.chflags_fn = vfs_not_implemented_chflags,
+	.fchflags_fn = vfs_not_implemented_fchflags,
 	.file_id_create_fn = vfs_not_implemented_file_id_create,
 	.fs_file_id_fn = vfs_not_implemented_fs_file_id,
 	.offload_read_send_fn = vfs_not_implemented_offload_read_send,
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index d45b76950d1..680b8325428 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -2165,15 +2165,15 @@ static int shadow_copy2_mkdirat(vfs_handle_struct *handle,
 			mode);
 }
 
-static int shadow_copy2_chflags(vfs_handle_struct *handle,
-				const struct smb_filename *smb_fname,
+static int shadow_copy2_fchflags(vfs_handle_struct *handle,
+				struct files_struct *fsp,
 				unsigned int flags)
 {
 	time_t timestamp = 0;
 
 	if (!shadow_copy2_strip_snapshot(talloc_tos(),
 					handle,
-					smb_fname,
+					fsp->fsp_name,
 					&timestamp,
 					NULL)) {
 		return -1;
@@ -2182,7 +2182,7 @@ static int shadow_copy2_chflags(vfs_handle_struct *handle,
 		errno = EROFS;
 		return -1;
 	}
-	return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
+	return SMB_VFS_NEXT_FCHFLAGS(handle, fsp, flags);
 }
 
 static ssize_t shadow_copy2_getxattr(vfs_handle_struct *handle,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list