summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-08-19 00:01:57 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-08-20 21:57:47 +1000
commitcbe758cfbb8febd02c0a80bf8f813fd464c71ce5 (patch)
treece0dd1559fe4fd0d5e4f98f4e75da1638ee511dd
parent6c0bef17569d650c32ab82396f43d435ab9ef831 (diff)
downloadsamba-cbe758cfbb8febd02c0a80bf8f813fd464c71ce5.tar.gz
samba-cbe758cfbb8febd02c0a80bf8f813fd464c71ce5.tar.bz2
samba-cbe758cfbb8febd02c0a80bf8f813fd464c71ce5.zip
s3-vfs: Correct the implementation of fake_acls_sys_acl_delete_def_file()
-rw-r--r--source3/modules/vfs_fake_acls.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c
index 1962158693..d7398a2ebf 100644
--- a/source3/modules/vfs_fake_acls.c
+++ b/source3/modules/vfs_fake_acls.c
@@ -306,8 +306,38 @@ static int fake_acls_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp
static int fake_acls_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
{
+ int ret;
const char *name = FAKE_ACL_DEFAULT_XATTR;
- return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct smb_filename *smb_fname = NULL;
+ NTSTATUS status = create_synthetic_smb_fname_split(frame, path, NULL,
+ &smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
+ TALLOC_FREE(frame);
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
+ if (ret == -1) {
+ TALLOC_FREE(frame);
+ return -1;
+ }
+
+ if (!S_ISDIR(smb_fname->st.st_ex_mode)) {
+ errno = EINVAL;
+ TALLOC_FREE(frame);
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
+ if (ret == -1 && errno == ENOATTR) {
+ ret = 0;
+ errno = 0;
+ }
+
+ TALLOC_FREE(frame);
+ return ret;
}
static int fake_acls_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)