summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix
diff options
context:
space:
mode:
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r--source4/ntvfs/posix/pvfs_open.c30
-rw-r--r--source4/ntvfs/posix/pvfs_read.c2
2 files changed, 13 insertions, 19 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index 1575ca82c1..73514f81b7 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -289,16 +289,13 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
access_mask = GENERIC_RIGHTS_FILE_READ | GENERIC_RIGHTS_FILE_WRITE;
}
- switch (access_mask & (SA_RIGHT_FILE_READ_DATA | SA_RIGHT_FILE_WRITE_DATA)) {
- case SA_RIGHT_FILE_READ_DATA:
- flags = O_RDONLY;
- break;
- case SA_RIGHT_FILE_WRITE_DATA:
- flags = O_WRONLY;
- break;
- case SA_RIGHT_FILE_WRITE_DATA|SA_RIGHT_FILE_READ_DATA:
+ if ((access_mask & SA_RIGHT_FILE_READ_EXEC) &&
+ (access_mask & SA_RIGHT_FILE_WRITE_DATA)) {
flags = O_RDWR;
- break;
+ } else if (access_mask & SA_RIGHT_FILE_WRITE_DATA) {
+ flags = O_WRONLY;
+ } else {
+ flags = O_RDONLY;
}
f = talloc_p(req, struct pvfs_file);
@@ -493,16 +490,13 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
return NT_STATUS_INVALID_PARAMETER;
}
- switch (access_mask & (SA_RIGHT_FILE_READ_DATA | SA_RIGHT_FILE_WRITE_DATA)) {
- case SA_RIGHT_FILE_READ_DATA:
- flags |= O_RDONLY;
- break;
- case SA_RIGHT_FILE_WRITE_DATA:
- flags |= O_WRONLY;
- break;
- case SA_RIGHT_FILE_WRITE_DATA|SA_RIGHT_FILE_READ_DATA:
+ if ((access_mask & SA_RIGHT_FILE_READ_EXEC) &&
+ (access_mask & SA_RIGHT_FILE_WRITE_DATA)) {
flags |= O_RDWR;
- break;
+ } else if (access_mask & SA_RIGHT_FILE_WRITE_DATA) {
+ flags |= O_WRONLY;
+ } else {
+ flags |= O_RDONLY;
}
/* handle creating a new file separately */
diff --git a/source4/ntvfs/posix/pvfs_read.c b/source4/ntvfs/posix/pvfs_read.c
index b36840cb15..734134368d 100644
--- a/source4/ntvfs/posix/pvfs_read.c
+++ b/source4/ntvfs/posix/pvfs_read.c
@@ -48,7 +48,7 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
return NT_STATUS_FILE_IS_A_DIRECTORY;
}
- if (!(f->access_mask & SA_RIGHT_FILE_READ_DATA)) {
+ if (!(f->access_mask & SA_RIGHT_FILE_READ_EXEC)) {
return NT_STATUS_ACCESS_VIOLATION;
}