summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_acl_common.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-04-01 16:50:28 -0700
committerJeremy Allison <jra@samba.org>2011-04-02 02:40:43 +0200
commit00224d06c389e9744b83bcec09a9d002086058fc (patch)
treeec6753ac658a450d3ed354a31c3345a901e29e73 /source3/modules/vfs_acl_common.c
parentac216c130e5d1f1c86d7e481838748208bb68f73 (diff)
downloadsamba-00224d06c389e9744b83bcec09a9d002086058fc.tar.gz
samba-00224d06c389e9744b83bcec09a9d002086058fc.tar.bz2
samba-00224d06c389e9744b83bcec09a9d002086058fc.zip
Fix bug #7987 - ACL can get lost when files are being renamed.
There is no reason for smbd with Windows ACLs to use chmod or fchmod unless it's a file opened with UNIX extensions or with posix pathnames. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Apr 2 02:40:43 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/modules/vfs_acl_common.c')
-rw-r--r--source3/modules/vfs_acl_common.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index b3e9973fda..827c954b1d 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -1020,3 +1020,43 @@ static int unlink_acl_common(struct vfs_handle_struct *handle,
smb_fname->base_name,
false);
}
+
+static int chmod_acl_module_common(struct vfs_handle_struct *handle,
+ const char *path, mode_t mode)
+{
+ if (lp_posix_pathnames()) {
+ /* Only allow this on POSIX pathnames. */
+ return SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ }
+ return 0;
+}
+
+static int fchmod_acl_module_common(struct vfs_handle_struct *handle,
+ struct files_struct *fsp, mode_t mode)
+{
+ if (fsp->posix_open) {
+ /* Only allow this on POSIX opens. */
+ return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
+ }
+ return 0;
+}
+
+static int chmod_acl_acl_module_common(struct vfs_handle_struct *handle,
+ const char *name, mode_t mode)
+{
+ if (lp_posix_pathnames()) {
+ /* Only allow this on POSIX pathnames. */
+ return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
+ }
+ return 0;
+}
+
+static int fchmod_acl_acl_module_common(struct vfs_handle_struct *handle,
+ struct files_struct *fsp, mode_t mode)
+{
+ if (fsp->posix_open) {
+ /* Only allow this on POSIX opens. */
+ return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
+ }
+ return 0;
+}