diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-10-25 02:36:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:04:37 -0500 |
commit | 3cf018b517de0afa006ac14d5185e3c95d8a923b (patch) | |
tree | bde8705421bbb7e66fbb4e2beb63597f37349bbe | |
parent | 8af9b5e42e7e1a356e6401079ed5d035f9cc8636 (diff) | |
download | samba-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)
-rw-r--r-- | source4/ntvfs/posix/pvfs_open.c | 16 | ||||
-rwxr-xr-x | source4/script/tests/test_posix.sh | 6 | ||||
-rw-r--r-- | source4/torture/raw/context.c | 12 |
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) |