svn commit: samba r3387 - in branches/SAMBA_4_0/source: include
ntvfs/common ntvfs/posix torture/basic
tridge at samba.org
tridge at samba.org
Sat Oct 30 05:53:56 GMT 2004
Author: tridge
Date: 2004-10-30 05:53:56 +0000 (Sat, 30 Oct 2004)
New Revision: 3387
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3387
Log:
fixed pvfs to pass the NTDENY tests. The tricky bit was
SA_RIGHT_FILE_EXECUTE, which depends on a flags2 bit
Modified:
branches/SAMBA_4_0/source/include/smb.h
branches/SAMBA_4_0/source/ntvfs/common/opendb.c
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_read.c
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_write.c
branches/SAMBA_4_0/source/torture/basic/denytest.c
Changeset:
Modified: branches/SAMBA_4_0/source/include/smb.h
===================================================================
--- branches/SAMBA_4_0/source/include/smb.h 2004-10-30 04:59:52 UTC (rev 3386)
+++ branches/SAMBA_4_0/source/include/smb.h 2004-10-30 05:53:56 UTC (rev 3387)
@@ -503,7 +503,7 @@
#define FLAGS2_IS_LONG_NAME 0x0040
#define FLAGS2_EXTENDED_SECURITY 0x0800
#define FLAGS2_DFS_PATHNAMES 0x1000
-#define FLAGS2_READ_PERMIT_NO_EXECUTE 0x2000
+#define FLAGS2_READ_PERMIT_EXECUTE 0x2000
#define FLAGS2_32_BIT_ERROR_CODES 0x4000
#define FLAGS2_UNICODE_STRINGS 0x8000
Modified: branches/SAMBA_4_0/source/ntvfs/common/opendb.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/common/opendb.c 2004-10-30 04:59:52 UTC (rev 3386)
+++ branches/SAMBA_4_0/source/ntvfs/common/opendb.c 2004-10-30 05:53:56 UTC (rev 3387)
@@ -154,20 +154,24 @@
/* if either open involves no read.write or delete access then
it can't conflict */
- if (!(e1->access_mask & (SA_RIGHT_FILE_WRITE_DATA |
+ if (!(e1->access_mask & (SA_RIGHT_FILE_WRITE_APPEND |
SA_RIGHT_FILE_READ_EXEC |
STD_RIGHT_DELETE_ACCESS))) {
return False;
}
- if (!(e2->access_mask & (SA_RIGHT_FILE_WRITE_DATA |
+ if (!(e2->access_mask & (SA_RIGHT_FILE_WRITE_APPEND |
SA_RIGHT_FILE_READ_EXEC |
STD_RIGHT_DELETE_ACCESS))) {
return False;
}
/* check the basic share access */
- CHECK_MASK(e1->access_mask, e2->share_access, SA_RIGHT_FILE_WRITE_DATA, NTCREATEX_SHARE_ACCESS_WRITE);
- CHECK_MASK(e2->access_mask, e1->share_access, SA_RIGHT_FILE_WRITE_DATA, NTCREATEX_SHARE_ACCESS_WRITE);
+ CHECK_MASK(e1->access_mask, e2->share_access,
+ SA_RIGHT_FILE_WRITE_APPEND,
+ NTCREATEX_SHARE_ACCESS_WRITE);
+ CHECK_MASK(e2->access_mask, e1->share_access,
+ SA_RIGHT_FILE_WRITE_APPEND,
+ NTCREATEX_SHARE_ACCESS_WRITE);
CHECK_MASK(e1->access_mask, e2->share_access,
SA_RIGHT_FILE_READ_EXEC,
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c 2004-10-30 04:59:52 UTC (rev 3386)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c 2004-10-30 05:53:56 UTC (rev 3387)
@@ -290,9 +290,9 @@
}
if ((access_mask & SA_RIGHT_FILE_READ_EXEC) &&
- (access_mask & SA_RIGHT_FILE_WRITE_DATA)) {
+ (access_mask & SA_RIGHT_FILE_WRITE_APPEND)) {
flags = O_RDWR;
- } else if (access_mask & SA_RIGHT_FILE_WRITE_DATA) {
+ } else if (access_mask & SA_RIGHT_FILE_WRITE_APPEND) {
flags = O_WRONLY;
} else {
flags = O_RDONLY;
@@ -491,9 +491,9 @@
}
if ((access_mask & SA_RIGHT_FILE_READ_EXEC) &&
- (access_mask & SA_RIGHT_FILE_WRITE_DATA)) {
+ (access_mask & SA_RIGHT_FILE_WRITE_APPEND)) {
flags |= O_RDWR;
- } else if (access_mask & SA_RIGHT_FILE_WRITE_DATA) {
+ } else if (access_mask & SA_RIGHT_FILE_WRITE_APPEND) {
flags |= O_WRONLY;
} else {
flags |= O_RDONLY;
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_read.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_read.c 2004-10-30 04:59:52 UTC (rev 3386)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_read.c 2004-10-30 05:53:56 UTC (rev 3387)
@@ -34,6 +34,7 @@
struct pvfs_file *f;
NTSTATUS status;
uint32_t maxcnt;
+ uint32_t mask;
if (rd->generic.level != RAW_READ_READX) {
return ntvfs_map_read(req, rd, ntvfs);
@@ -48,9 +49,13 @@
return NT_STATUS_FILE_IS_A_DIRECTORY;
}
- if (!(f->access_mask & SA_RIGHT_FILE_READ_EXEC)) {
- return NT_STATUS_ACCESS_VIOLATION;
+ mask = SA_RIGHT_FILE_READ_DATA;
+ if (req->flags2 & FLAGS2_READ_PERMIT_EXECUTE) {
+ mask |= SA_RIGHT_FILE_EXECUTE;
}
+ if (!(f->access_mask & mask)) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
maxcnt = rd->readx.in.maxcnt;
if (maxcnt > UINT16_MAX) {
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_write.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_write.c 2004-10-30 04:59:52 UTC (rev 3386)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_write.c 2004-10-30 05:53:56 UTC (rev 3387)
@@ -48,7 +48,7 @@
return NT_STATUS_FILE_IS_A_DIRECTORY;
}
- if (!(f->access_mask & SA_RIGHT_FILE_WRITE_DATA)) {
+ if (!(f->access_mask & SA_RIGHT_FILE_WRITE_APPEND)) {
return NT_STATUS_ACCESS_VIOLATION;
}
Modified: branches/SAMBA_4_0/source/torture/basic/denytest.c
===================================================================
--- branches/SAMBA_4_0/source/torture/basic/denytest.c 2004-10-30 04:59:52 UTC (rev 3386)
+++ branches/SAMBA_4_0/source/torture/basic/denytest.c 2004-10-30 05:53:56 UTC (rev 3387)
@@ -1773,24 +1773,27 @@
union smb_open io1, io2;
extern int torture_numops;
int failures = 0;
+ char buf[1];
- fname = talloc_asprintf(cli1, "\\ntdeny_%d.dat", client);
+ ZERO_STRUCT(buf);
+ fname = talloc_asprintf(cli1, "\\ntdeny_%d.dll", client);
+
smbcli_unlink(cli1->tree, fname);
fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
- smbcli_write(cli1->tree, fnum1, 0, fname, 0, strlen(fname));
+ smbcli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf));
smbcli_close(cli1->tree, fnum1);
GetTimeOfDay(&tv_start);
io1.ntcreatex.level = RAW_OPEN_NTCREATEX;
io1.ntcreatex.in.root_fid = 0;
- io1.ntcreatex.in.flags = 0;
- io1.ntcreatex.in.create_options = 0;
- io1.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+ io1.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
+ io1.ntcreatex.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
+ io1.ntcreatex.in.file_attr = 0;
io1.ntcreatex.in.alloc_size = 0;
io1.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
- io1.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
+ io1.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_IMPERSONATION;
io1.ntcreatex.in.security_flags = 0;
io1.ntcreatex.in.fname = fname;
io2 = io1;
@@ -1814,7 +1817,7 @@
io2.ntcreatex.in.share_access = map_bits(share_access_bits, b_sa2, nbits1);
io2.ntcreatex.in.access_mask = map_bits(access_mask_bits, b_am2, nbits2);
-
+
status1 = smb_raw_open(cli1->tree, mem_ctx, &io1);
status2 = smb_raw_open(cli2->tree, mem_ctx, &io2);
@@ -1823,14 +1826,13 @@
} else if (!NT_STATUS_IS_OK(status2)) {
res = A_0;
} else {
- char x = 1;
res = A_0;
if (smbcli_read(cli2->tree,
- io2.ntcreatex.out.fnum, (void *)&x, 0, 1) == 1) {
+ io2.ntcreatex.out.fnum, (void *)buf, 0, sizeof(buf)) >= 1) {
res += A_R;
}
if (smbcli_write(cli2->tree,
- io2.ntcreatex.out.fnum, 0, (void *)&x, 0, 1) == 1) {
+ io2.ntcreatex.out.fnum, 0, (void *)buf, 0, sizeof(buf)) >= 1) {
res += A_W;
}
}
More information about the samba-cvs
mailing list