svn commit: samba r11716 - in
branches/SAMBA_4_0/source/torture/smb2: .
tridge at samba.org
tridge at samba.org
Mon Nov 14 05:10:10 GMT 2005
Author: tridge
Date: 2005-11-14 05:10:09 +0000 (Mon, 14 Nov 2005)
New Revision: 11716
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11716
Log:
added a read/write test
Modified:
branches/SAMBA_4_0/source/torture/smb2/connect.c
Changeset:
Modified: branches/SAMBA_4_0/source/torture/smb2/connect.c
===================================================================
--- branches/SAMBA_4_0/source/torture/smb2/connect.c 2005-11-14 05:09:26 UTC (rev 11715)
+++ branches/SAMBA_4_0/source/torture/smb2/connect.c 2005-11-14 05:10:09 UTC (rev 11716)
@@ -64,6 +64,53 @@
/*
+ test writing
+*/
+static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle handle)
+{
+ struct smb2_write w;
+ struct smb2_read r;
+ NTSTATUS status;
+ DATA_BLOB data;
+
+ data = data_blob_talloc(tree, NULL, 700);
+ generate_random_buffer(data.data, data.length);
+
+ ZERO_STRUCT(w);
+ w.in.buffer_code = 0x31;
+ w.in.offset = 0;
+ w.in.handle = handle;
+ w.in.data = data;
+
+ status = smb2_write(tree, &w);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("write failed - %s\n", nt_errstr(status));
+ return status;
+ }
+
+ ZERO_STRUCT(r);
+ r.in.buffer_code = 0x31;
+ r.in.length = data.length;
+ r.in.offset = 0;
+ r.in.handle = handle;
+
+ status = smb2_read(tree, tree, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("read failed - %s\n", nt_errstr(status));
+ return status;
+ }
+
+ if (data.length != r.out.data.length ||
+ memcmp(data.data, r.out.data.data, data.length) != 0) {
+ printf("read data mismatch\n");
+ return NT_STATUS_NET_WRITE_FAULT;
+ }
+
+ return status;
+}
+
+
+/*
send a create
*/
static struct smb2_handle torture_smb2_create(struct smb2_tree *tree,
@@ -136,6 +183,7 @@
h1 = torture_smb2_create(tree, "test9.dat");
h2 = torture_smb2_create(tree, "test9.dat");
+ torture_smb2_write(tree, h1);
torture_smb2_close(tree, h1);
torture_smb2_close(tree, h2);
More information about the samba-cvs
mailing list