summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-03-12 10:57:31 -0700
committerJeremy Allison <jra@samba.org>2009-03-12 10:57:31 -0700
commit5c63388f63028af9bac2acb2ef0a38736278823b (patch)
tree4b24a01245685b1f5555f54e12b70725595735af /source3/smbd
parent4b57f6dd34d1ddbdc7b011de1ea7041ec8215dec (diff)
downloadsamba-5c63388f63028af9bac2acb2ef0a38736278823b.tar.gz
samba-5c63388f63028af9bac2acb2ef0a38736278823b.tar.bz2
samba-5c63388f63028af9bac2acb2ef0a38736278823b.zip
Fix bug #6186 - map readonly does not work
Jeremy.
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/open.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index c8cc2e64a3..d529b009d5 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -454,8 +454,26 @@ static NTSTATUS open_file(files_struct *fsp,
&access_granted);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
+ /*
+ * On NT_STATUS_ACCESS_DENIED, access_granted
+ * contains the denied bits.
+ */
+
+ if ((access_mask & FILE_WRITE_ATTRIBUTES) &&
+ (access_granted & FILE_WRITE_ATTRIBUTES) &&
+ (lp_map_readonly(SNUM(conn)) ||
+ lp_map_archive(SNUM(conn)) ||
+ lp_map_hidden(SNUM(conn)) ||
+ lp_map_system(SNUM(conn)))) {
+ access_granted &= ~FILE_WRITE_ATTRIBUTES;
+
+ DEBUG(10,("open_file: overrode FILE_WRITE_ATTRIBUTES "
+ "on file %s\n",
+ path ));
+ }
+
if ((access_mask & DELETE_ACCESS) &&
- (access_granted == DELETE_ACCESS) &&
+ (access_granted & DELETE_ACCESS) &&
can_delete_file_in_directory(conn, path)) {
/* Were we trying to do a stat open
* for delete and didn't get DELETE
@@ -465,10 +483,14 @@ static NTSTATUS open_file(files_struct *fsp,
* http://blogs.msdn.com/oldnewthing/archive/2004/06/04/148426.aspx
* for details. */
- DEBUG(10,("open_file: overrode ACCESS_DENIED "
+ access_granted &= ~DELETE_ACCESS;
+
+ DEBUG(10,("open_file: overrode DELETE_ACCESS "
"on file %s\n",
path ));
- } else {
+ }
+
+ if (access_granted != 0) {
DEBUG(10, ("open_file: Access denied on "
"file %s\n",
path));