summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-01-10 12:52:01 -0800
committerJeremy Allison <jra@samba.org>2012-01-11 08:54:08 -0800
commit6aafd8684b92eede3c83f1af49c23cef2deb7e03 (patch)
treef5bbc26cd556c4c0b1e5ce87222c5975b0b852ed /source3/modules
parentd7dcbcc42d9a8424ec2204a220b3b912b7be2f70 (diff)
downloadsamba-6aafd8684b92eede3c83f1af49c23cef2deb7e03.tar.gz
samba-6aafd8684b92eede3c83f1af49c23cef2deb7e03.tar.bz2
samba-6aafd8684b92eede3c83f1af49c23cef2deb7e03.zip
First part of fix for bug #8673 - NT ACL issue.
Simplify the logic in the unlink/rmdir calls - makes it readable (and correct).
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_acl_common.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index bf535c557b..e162bb9823 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -647,17 +647,23 @@ static int rmdir_acl_common(struct vfs_handle_struct *handle,
{
int ret;
+ /* Try the normal rmdir first. */
ret = SMB_VFS_NEXT_RMDIR(handle, path);
- if (!(ret == -1 && (errno == EACCES || errno == EPERM))) {
- DEBUG(10,("rmdir_acl_common: unlink of %s failed %s\n",
- path,
- strerror(errno) ));
- return ret;
+ if (ret == 0) {
+ return 0;
+ }
+ if (errno == EACCES || errno == EPERM) {
+ /* Failed due to access denied,
+ see if we need to root override. */
+ return acl_common_remove_object(handle,
+ path,
+ true);
}
- return acl_common_remove_object(handle,
- path,
- true);
+ DEBUG(10,("rmdir_acl_common: unlink of %s failed %s\n",
+ path,
+ strerror(errno) ));
+ return -1;
}
static int unlink_acl_common(struct vfs_handle_struct *handle,
@@ -665,21 +671,28 @@ static int unlink_acl_common(struct vfs_handle_struct *handle,
{
int ret;
+ /* Try the normal unlink first. */
ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
- if (!(ret == -1 && (errno == EACCES || errno == EPERM))) {
- DEBUG(10,("unlink_acl_common: unlink of %s failed %s\n",
- smb_fname->base_name,
- strerror(errno) ));
- return ret;
- }
- /* Don't do anything fancy for streams. */
- if (smb_fname->stream_name) {
- return ret;
+ if (ret == 0) {
+ return 0;
}
+ if (errno == EACCES || errno == EPERM) {
+ /* Failed due to access denied,
+ see if we need to root override. */
- return acl_common_remove_object(handle,
+ /* Don't do anything fancy for streams. */
+ if (smb_fname->stream_name) {
+ return -1;
+ }
+ return acl_common_remove_object(handle,
smb_fname->base_name,
false);
+ }
+
+ DEBUG(10,("unlink_acl_common: unlink of %s failed %s\n",
+ smb_fname->base_name,
+ strerror(errno) ));
+ return -1;
}
static int chmod_acl_module_common(struct vfs_handle_struct *handle,