summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_acl_common.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-01-16 17:03:06 -0800
committerJeremy Allison <jra@samba.org>2010-01-16 17:03:06 -0800
commit98a495f1e674b7562a3d8b5dfc958ee95d256896 (patch)
tree826e62dba4fdbfda8d33d8b0dbf47f705e20599e /source3/modules/vfs_acl_common.c
parentdde836adbdb5c04cb43774c65fa1af713d9cdb7a (diff)
downloadsamba-98a495f1e674b7562a3d8b5dfc958ee95d256896.tar.gz
samba-98a495f1e674b7562a3d8b5dfc958ee95d256896.tar.bz2
samba-98a495f1e674b7562a3d8b5dfc958ee95d256896.zip
Modification of fix for bug 6876 - Delete of an object whose parent folder does not have delete rights fails even if the delete right is set on the object
Suggested by Volker. Reduce the surface area of the become_root() unbecome_root() code to reduce the chance of errors. Jeremy.
Diffstat (limited to 'source3/modules/vfs_acl_common.c')
-rw-r--r--source3/modules/vfs_acl_common.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index aeb9ce37ea..30a59e2024 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -821,11 +821,14 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
goto out;
}
+ become_root();
if (is_directory) {
ret = SMB_VFS_NEXT_RMDIR(handle, final_component);
} else {
ret = SMB_VFS_NEXT_UNLINK(handle, &local_fname);
}
+ unbecome_root();
+
if (ret == -1) {
saved_errno = errno;
}
@@ -854,12 +857,9 @@ static int rmdir_acl_common(struct vfs_handle_struct *handle,
return ret;
}
- become_root();
- ret = acl_common_remove_object(handle,
+ return acl_common_remove_object(handle,
path,
true);
- unbecome_root();
- return ret;
}
static NTSTATUS create_file_acl_common(struct vfs_handle_struct *handle,
@@ -977,10 +977,7 @@ static int unlink_acl_common(struct vfs_handle_struct *handle,
return ret;
}
- become_root();
- ret = acl_common_remove_object(handle,
+ return acl_common_remove_object(handle,
smb_fname->base_name,
false);
- unbecome_root();
- return ret;
}