1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r3180: - basic support for SEC_RIGHT_MAXIMUM_ALLOWED in pvfs

- RAW-CONTEXT test now passes
(This used to be commit 0dae9fef09)
This commit is contained in:
Andrew Tridgell 2004-10-25 02:36:12 +00:00 committed by Gerald (Jerry) Carter
parent 8af9b5e42e
commit 3cf018b517
3 changed files with 23 additions and 11 deletions

View File

@ -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;

View File

@ -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

View File

@ -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)