summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-25 02:36:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:04:37 -0500
commit3cf018b517de0afa006ac14d5185e3c95d8a923b (patch)
treebde8705421bbb7e66fbb4e2beb63597f37349bbe /source4/ntvfs/posix
parent8af9b5e42e7e1a356e6401079ed5d035f9cc8636 (diff)
downloadsamba-3cf018b517de0afa006ac14d5185e3c95d8a923b.tar.gz
samba-3cf018b517de0afa006ac14d5185e3c95d8a923b.tar.bz2
samba-3cf018b517de0afa006ac14d5185e3c95d8a923b.zip
r3180: - basic support for SEC_RIGHT_MAXIMUM_ALLOWED in pvfs
- RAW-CONTEXT test now passes (This used to be commit 0dae9fef09ec8bce19c39a0caf36e0882e507bc4)
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r--source4/ntvfs/posix/pvfs_open.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index ac2742d357..badd18d370 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -283,6 +283,10 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
return NT_STATUS_CANNOT_DELETE;
}
+ if (access_mask & SEC_RIGHT_MAXIMUM_ALLOWED) {
+ access_mask = GENERIC_RIGHTS_FILE_READ | GENERIC_RIGHTS_FILE_WRITE;
+ }
+
flags = O_RDWR;
f = talloc_p(req, struct pvfs_file);
@@ -355,7 +359,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
f->lock_count = 0;
f->create_options = io->generic.in.create_options;
f->share_access = io->generic.in.share_access;
- f->access_mask = io->generic.in.access_mask;
+ f->access_mask = access_mask;
f->seek_offset = 0;
f->position = 0;
@@ -429,6 +433,14 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
share_access = io->generic.in.share_access;
access_mask = io->generic.in.access_mask;
+ if (access_mask & SEC_RIGHT_MAXIMUM_ALLOWED) {
+ if (name->dos.attrib & FILE_ATTRIBUTE_READONLY) {
+ access_mask = GENERIC_RIGHTS_FILE_READ;
+ } else {
+ access_mask = GENERIC_RIGHTS_FILE_READ | GENERIC_RIGHTS_FILE_WRITE;
+ }
+ }
+
/* certain create options are not allowed */
if ((create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) &&
!(access_mask & STD_RIGHT_DELETE_ACCESS)) {
@@ -551,7 +563,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
f->lock_count = 0;
f->create_options = io->generic.in.create_options;
f->share_access = io->generic.in.share_access;
- f->access_mask = io->generic.in.access_mask;
+ f->access_mask = access_mask;
f->seek_offset = 0;
f->position = 0;