summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/ntvfs/posix/pvfs_open.c16
-rwxr-xr-xsource4/script/tests/test_posix.sh6
-rw-r--r--source4/torture/raw/context.c12
3 files changed, 23 insertions, 11 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;
diff --git a/source4/script/tests/test_posix.sh b/source4/script/tests/test_posix.sh
index 0cb983e74c..d17d428642 100755
--- a/source4/script/tests/test_posix.sh
+++ b/source4/script/tests/test_posix.sh
@@ -36,12 +36,12 @@ tests="$tests BASE-DENY3 BASE-XCOPY"
tests="$tests BASE-DELETE BASE-PROPERTIES BASE-MANGLE"
tests="$tests BASE-CHKPATH BASE-SECLEAK"
tests="$tests RAW-QFSINFO RAW-QFILEINFO RAW-SFILEINFO-BUG"
-tests="$tests RAW-LOCK RAW-SEEK"
+tests="$tests RAW-LOCK RAW-SEEK RAW-CONTEXT"
soon="BASE-DIR1 BASE-DENY1 BASE-VUID BASE-OPEN BASE-DEFER_OPEN BASE-RENAME BASE-OPENATTR BASE-CHARSET"
-soon="$soon RAW-SFILEINFO RAW-SEARCH RAW-CLOSE RAW-OPEN RAW-MKDIR RAW-OPLOCK RAW-NOTIFY RAW-MUX RAW-IOCTL"
-soon="$soon RAW-CHKPATH RAW-UNLINK RAW-READ RAW-WRITE RAW-CONTEXT RAW-RENAME"
+soon="$soon RAW-SFILEINFO RAW-SEARCH RAW-OPEN RAW-MKDIR RAW-OPLOCK RAW-NOTIFY RAW-MUX RAW-IOCTL"
+soon="$soon RAW-CHKPATH RAW-UNLINK RAW-READ RAW-WRITE RAW-RENAME RAW-CLOSE"
for t in $tests; do
if [ ! -z "$start" -a "$start" != $t ]; then
diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c
index 33eab4a0c3..85357e2535 100644
--- a/source4/torture/raw/context.c
+++ b/source4/torture/raw/context.c
@@ -24,24 +24,24 @@
#define CHECK_STATUS(status, correct) do { \
if (!NT_STATUS_EQUAL(status, correct)) { \
- printf("(%d) Incorrect status %s - should be %s\n", \
- __LINE__, nt_errstr(status), nt_errstr(correct)); \
+ printf("(%s) Incorrect status %s - should be %s\n", \
+ __location__, nt_errstr(status), nt_errstr(correct)); \
ret = False; \
goto done; \
}} while (0)
#define CHECK_VALUE(v, correct) do { \
if ((v) != (correct)) { \
- printf("(%d) Incorrect value %s=%d - should be %d\n", \
- __LINE__, #v, v, correct); \
+ printf("(%s) Incorrect value %s=%d - should be %d\n", \
+ __location__, #v, v, correct); \
ret = False; \
goto done; \
}} while (0)
#define CHECK_NOT_VALUE(v, correct) do { \
if ((v) == (correct)) { \
- printf("(%d) Incorrect value %s=%d - should not be %d\n", \
- __LINE__, #v, v, correct); \
+ printf("(%s) Incorrect value %s=%d - should not be %d\n", \
+ __location__, #v, v, correct); \
ret = False; \
goto done; \
}} while (0)