[SCM] Samba Shared Repository - branch v4-0-test updated -
release-4-0-0alpha3-204-g9013748
Stefan Metzmacher
metze at samba.org
Thu Apr 17 02:18:05 GMT 2008
The branch, v4-0-test has been updated
via 9013748273378f88bfc66d3583814f0fee67c40f (commit)
via ae0a7d0918cc15309a6d1166885f23531365007c (commit)
from 30e04ae3a02596de03d06874ff5dfc0ddc3bf902 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test
- Log -----------------------------------------------------------------
commit 9013748273378f88bfc66d3583814f0fee67c40f
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Apr 17 03:54:26 2008 +0200
ntvfs_generic: map SMB2 oplock levels to the generic ones
metze
commit ae0a7d0918cc15309a6d1166885f23531365007c
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Apr 17 03:52:45 2008 +0200
SMB2-PERSISTENT-HANDLES1: verify some more fields
metze
-----------------------------------------------------------------------
Summary of changes:
source/ntvfs/ntvfs_generic.c | 29 ++++++++++-
source/torture/smb2/persistent_handles.c | 84 ++++++++++++++++++-----------
2 files changed, 79 insertions(+), 34 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/ntvfs/ntvfs_generic.c b/source/ntvfs/ntvfs_generic.c
index fee3269..5d4bbf3 100644
--- a/source/ntvfs/ntvfs_generic.c
+++ b/source/ntvfs/ntvfs_generic.c
@@ -208,7 +208,21 @@ static NTSTATUS ntvfs_map_open_finish(struct ntvfs_module_context *ntvfs,
case RAW_OPEN_SMB2:
io->smb2.out.file.ntvfs = io2->generic.out.file.ntvfs;
- io->smb2.out.oplock_level = 0;
+ switch (io2->generic.out.oplock_level) {
+ case OPLOCK_BATCH:
+ io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
+ break;
+ case OPLOCK_EXCLUSIVE:
+ io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_EXCLUSIVE;
+ break;
+ case OPLOCK_LEVEL_II:
+ io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_II;
+ break;
+ default:
+ io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_NONE;
+ break;
+ }
+ io->smb2.out.reserved = 0;
io->smb2.out.create_action = io2->generic.out.create_action;
io->smb2.out.create_time = io2->generic.out.create_time;
io->smb2.out.access_time = io2->generic.out.access_time;
@@ -484,7 +498,18 @@ NTSTATUS ntvfs_map_open(struct ntvfs_module_context *ntvfs,
status = ntvfs->ops->open(ntvfs, req, io2);
break;
case RAW_OPEN_SMB2:
- io2->generic.in.flags = 0;
+ switch (io->smb2.in.oplock_level) {
+ case SMB2_OPLOCK_LEVEL_BATCH:
+ io2->generic.in.flags = NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK |
+ NTCREATEX_FLAGS_REQUEST_OPLOCK;
+ break;
+ case SMB2_OPLOCK_LEVEL_EXCLUSIVE:
+ io2->generic.in.flags = NTCREATEX_FLAGS_REQUEST_OPLOCK;
+ break;
+ default:
+ io2->generic.in.flags = 0;
+ break;
+ }
io2->generic.in.root_fid = 0;
io2->generic.in.access_mask = io->smb2.in.desired_access;
io2->generic.in.alloc_size = 0;
diff --git a/source/torture/smb2/persistent_handles.c b/source/torture/smb2/persistent_handles.c
index d08714d..ace57d8 100644
--- a/source/torture/smb2/persistent_handles.c
+++ b/source/torture/smb2/persistent_handles.c
@@ -52,44 +52,57 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx,
{
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_handle h1, h2;
- struct smb2_create io;
+ struct smb2_create io1, io2;
NTSTATUS status;
const char *fname = "persistent_handles.dat";
DATA_BLOB b;
union smb_fileinfo qfinfo;
union smb_setfileinfo sfinfo;
bool ret = true;
-
- ZERO_STRUCT(io);
- io.in.security_flags = 0x00;
- io.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
- io.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
- io.in.create_flags = 0x00000000;
- io.in.reserved = 0x00000000;
- io.in.desired_access = SEC_RIGHTS_FILE_READ;
- io.in.file_attributes = 0x00000000;
- io.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ uint64_t pos;
+
+ smb2_util_unlink(tree1, fname);
+
+ ZERO_STRUCT(io1);
+ io1.in.security_flags = 0x00;
+ io1.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
+ io1.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
+ io1.in.create_flags = 0x00000000;
+ io1.in.reserved = 0x00000000;
+ io1.in.desired_access = SEC_RIGHTS_FILE_ALL;
+ io1.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ io1.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE |
NTCREATEX_SHARE_ACCESS_DELETE;
- io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
- io.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
+ io1.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
+ io1.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
NTCREATEX_OPTIONS_ASYNC_ALERT |
NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
0x00200000;
- io.in.fname = fname;
+ io1.in.fname = fname;
b = data_blob_talloc(mem_ctx, NULL, 16);
SBVAL(b.data, 0, 0);
SBVAL(b.data, 8, 0);
- status = smb2_create_blob_add(tree1, &io.in.blobs,
+ status = smb2_create_blob_add(tree1, &io1.in.blobs,
SMB2_CREATE_TAG_DHNQ,
b);
CHECK_STATUS(status, NT_STATUS_OK);
- status = smb2_create(tree1, mem_ctx, &io);
+ status = smb2_create(tree1, mem_ctx, &io1);
CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VAL(io1.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
+ /*CHECK_VAL(io1.out.reserved, 0);*/
+ CHECK_VAL(io1.out.create_action, NTCREATEX_ACTION_CREATED);
+ CHECK_VAL(io1.out.alloc_size, 0);
+ CHECK_VAL(io1.out.size, 0);
+ CHECK_VAL(io1.out.file_attr, FILE_ATTRIBUTE_ARCHIVE);
+ CHECK_VAL(io1.out.reserved2, 0);
+
+ /* TODO: check extra blob content */
- h1 = io.out.file.handle;
+ h1 = io1.out.file.handle;
ZERO_STRUCT(qfinfo);
qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
@@ -97,8 +110,9 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx,
status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(qfinfo.position_information.out.position, 0);
- printf("position: %llu\n",
- (unsigned long long)qfinfo.position_information.out.position);
+ pos = qfinfo.position_information.out.position;
+ torture_comment(tctx, "position: %llu\n",
+ (unsigned long long)pos);
ZERO_STRUCT(sfinfo);
sfinfo.generic.level = RAW_SFILEINFO_POSITION_INFORMATION;
@@ -113,8 +127,9 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx,
status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(qfinfo.position_information.out.position, 0x1000);
- printf("position: %llu\n",
- (unsigned long long)qfinfo.position_information.out.position);
+ pos = qfinfo.position_information.out.position;
+ torture_comment(tctx, "position: %llu\n",
+ (unsigned long long)pos);
talloc_free(tree1);
tree1 = NULL;
@@ -125,26 +140,29 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx,
status = smb2_getinfo_file(tree2, mem_ctx, &qfinfo);
CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
- ZERO_STRUCT(io);
- io.in.fname = fname;
+ ZERO_STRUCT(io2);
+ io2.in.fname = fname;
b = data_blob_talloc(tctx, NULL, 16);
SBVAL(b.data, 0, h1.data[0]);
SBVAL(b.data, 8, h1.data[1]);
- status = smb2_create_blob_add(tree2, &io.in.blobs,
+ status = smb2_create_blob_add(tree2, &io2.in.blobs,
SMB2_CREATE_TAG_DHNC,
b);
CHECK_STATUS(status, NT_STATUS_OK);
- if (!NT_STATUS_IS_OK(status)) {
- printf("create1 failed - %s\n", nt_errstr(status));
- return false;
- }
- status = smb2_create(tree2, mem_ctx, &io);
+ status = smb2_create(tree2, mem_ctx, &io2);
CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
+ CHECK_VAL(io2.out.reserved, 0x00);
+ CHECK_VAL(io2.out.create_action, NTCREATEX_ACTION_EXISTED);
+ CHECK_VAL(io2.out.alloc_size, 0);
+ CHECK_VAL(io2.out.size, 0);
+ CHECK_VAL(io2.out.file_attr, FILE_ATTRIBUTE_ARCHIVE);
+ CHECK_VAL(io2.out.reserved2, 0);
- h2 = io.out.file.handle;
+ h2 = io2.out.file.handle;
ZERO_STRUCT(qfinfo);
qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
@@ -152,11 +170,13 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx,
status = smb2_getinfo_file(tree2, mem_ctx, &qfinfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(qfinfo.position_information.out.position, 0x1000);
- printf("position: %llu\n",
- (unsigned long long)qfinfo.position_information.out.position);
+ pos = qfinfo.position_information.out.position;
+ torture_comment(tctx, "position: %llu\n",
+ (unsigned long long)pos);
talloc_free(mem_ctx);
+ smb2_util_unlink(tree2, fname);
done:
return ret;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list