svn commit: samba r11681 - in branches/SAMBA_4_0/source: libcli/smb2 torture/smb2

tridge at samba.org tridge at samba.org
Fri Nov 11 14:04:46 GMT 2005


Author: tridge
Date: 2005-11-11 14:04:46 +0000 (Fri, 11 Nov 2005)
New Revision: 11681

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11681

Log:

filled in a few more smb2_create() fields


Modified:
   branches/SAMBA_4_0/source/libcli/smb2/create.c
   branches/SAMBA_4_0/source/libcli/smb2/smb2_calls.h
   branches/SAMBA_4_0/source/torture/smb2/connect.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/smb2/create.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb2/create.c	2005-11-11 13:08:31 UTC (rev 11680)
+++ branches/SAMBA_4_0/source/libcli/smb2/create.c	2005-11-11 14:04:46 UTC (rev 11681)
@@ -51,9 +51,9 @@
 	SIVAL(req->out.body, 0x14, io->in.unknown3[3]);
 	SIVAL(req->out.body, 0x18, io->in.access_mask);
 	SIVAL(req->out.body, 0x1C, io->in.file_attr);
-	SIVAL(req->out.body, 0x20, io->in.unknown4);
+	SIVAL(req->out.body, 0x20, io->in.share_access);
 	SIVAL(req->out.body, 0x24, io->in.open_disposition);
-	SIVAL(req->out.body, 0x28, io->in.unknown5);
+	SIVAL(req->out.body, 0x28, io->in.create_options);
 
 	SSVAL(req->out.body, 0x2C, 0x40+0x38); /* offset to fname */
 	SSVAL(req->out.body, 0x2E, path.length);
@@ -99,13 +99,10 @@
 	io->out.access_time = smbcli_pull_nttime(req->in.body, 0x10);
 	io->out.write_time  = smbcli_pull_nttime(req->in.body, 0x18);
 	io->out.change_time = smbcli_pull_nttime(req->in.body, 0x20);
-	io->out.unknown3 = IVAL(req->in.body, 0x24);
-	io->out.unknown4 = IVAL(req->in.body, 0x28);
-	io->out.unknown5 = IVAL(req->in.body, 0x2C);
-	io->out.unknown6 = IVAL(req->in.body, 0x30);
-	io->out.unknown7 = IVAL(req->in.body, 0x34);
-	io->out.unknown8 = IVAL(req->in.body, 0x38);
-	io->out.unknown9 = IVAL(req->in.body, 0x3C);
+	io->out.alloc_size  = BVAL(req->in.body, 0x28);
+	io->out.size        = BVAL(req->in.body, 0x30);
+	io->out.file_attr   = IVAL(req->in.body, 0x38);
+	io->out.unknown8    = IVAL(req->in.body, 0x3C);
 	io->out.handle.data[0] = BVAL(req->in.body, 0x40);
 	io->out.handle.data[1] = BVAL(req->in.body, 0x48);
 	io->out.unknown10 = IVAL(req->in.body, 0x50);

Modified: branches/SAMBA_4_0/source/libcli/smb2/smb2_calls.h
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb2/smb2_calls.h	2005-11-11 13:08:31 UTC (rev 11680)
+++ branches/SAMBA_4_0/source/libcli/smb2/smb2_calls.h	2005-11-11 14:04:46 UTC (rev 11681)
@@ -89,9 +89,9 @@
 		uint32_t unknown3[4];
 		uint32_t access_mask;
 		uint32_t file_attr;
-		uint32_t unknown4;
+		uint32_t share_access;
 		uint32_t open_disposition;
-		uint32_t unknown5;
+		uint32_t create_options;
 		/* ofs/len of name here, 16 bits */
 		uint32_t unknown6;
 		const char *fname;
@@ -109,15 +109,12 @@
 		NTTIME   access_time;
 		NTTIME   write_time;
 		NTTIME   change_time;
+		uint64_t alloc_size;
+		uint64_t size;
+		uint32_t file_attr;
 		uint32_t unknown3;
-		uint32_t unknown4;
-		uint32_t unknown5;
-		uint32_t unknown6;
-		uint32_t unknown7;
-		uint32_t unknown8;
-		uint32_t unknown9;
 		struct smb2_handle handle;
-		uint32_t unknown10;
+		uint32_t unknown4;
 	} out;
 };
 

Modified: branches/SAMBA_4_0/source/torture/smb2/connect.c
===================================================================
--- branches/SAMBA_4_0/source/torture/smb2/connect.c	2005-11-11 13:08:31 UTC (rev 11680)
+++ branches/SAMBA_4_0/source/torture/smb2/connect.c	2005-11-11 14:04:46 UTC (rev 11681)
@@ -196,68 +196,79 @@
 }
 
 /*
-  send a create
+  send a close
 */
-static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, 
-					      const char *fname)
+static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle handle)
 {
-	struct smb2_create io;
+	struct smb2_close io;
 	NTSTATUS status;
 	TALLOC_CTX *tmp_ctx = talloc_new(tree);
 
 	ZERO_STRUCT(io);
-	io.in.unknown1 = 0x09000039;
-	io.in.access_mask = SEC_RIGHTS_FILE_ALL;
-	io.in.file_attr   = FILE_ATTRIBUTE_NORMAL;
-	io.in.open_disposition = NTCREATEX_DISP_OVERWRITE_IF;
-	io.in.fname = fname;
-	status = smb2_create(tree, &io);
+	io.in.unknown1 = 0x10018;
+	io.in.handle   = handle;
+	status = smb2_close(tree, &io);
 	if (!NT_STATUS_IS_OK(status)) {
-		printf("create failed - %s\n", nt_errstr(status));
-		return io.out.handle;
+		printf("close failed - %s\n", nt_errstr(status));
+		return status;
 	}
 
-	printf("Open gave:\n");
+	printf("Close gave:\n");
 	printf("create_time     = %s\n", nt_time_string(tmp_ctx, io.out.create_time));
 	printf("access_time     = %s\n", nt_time_string(tmp_ctx, io.out.access_time));
 	printf("write_time      = %s\n", nt_time_string(tmp_ctx, io.out.write_time));
 	printf("change_time     = %s\n", nt_time_string(tmp_ctx, io.out.change_time));
-	printf("handle          = %016llx%016llx\n", 
-	       io.out.handle.data[0], 
-	       io.out.handle.data[1]);
 
 	talloc_free(tmp_ctx);
 	
-	return io.out.handle;
+	return status;
 }
 
+
 /*
-  send a close
+  send a create
 */
-static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle handle)
+static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, 
+					      const char *fname)
 {
-	struct smb2_close io;
+	struct smb2_create io;
 	NTSTATUS status;
 	TALLOC_CTX *tmp_ctx = talloc_new(tree);
 
 	ZERO_STRUCT(io);
-	io.in.unknown1 = 0x10018;
-	io.in.handle   = handle;
-	status = smb2_close(tree, &io);
+	io.in.unknown1 = 0x09000039; /* gets an oplock */
+	io.in.unknown1 = 0x00000039; /* no oplock */
+	io.in.access_mask = SEC_RIGHTS_FILE_ALL;
+	io.in.file_attr   = FILE_ATTRIBUTE_NORMAL;
+	io.in.open_disposition = NTCREATEX_DISP_OPEN;
+	io.in.share_access = 
+		NTCREATEX_SHARE_ACCESS_DELETE|
+		NTCREATEX_SHARE_ACCESS_READ|
+		NTCREATEX_SHARE_ACCESS_WRITE;
+	io.in.create_options = NTCREATEX_OPTIONS_WRITE_THROUGH;
+	io.in.fname = fname;
+
+	status = smb2_create(tree, &io);
 	if (!NT_STATUS_IS_OK(status)) {
-		printf("close failed - %s\n", nt_errstr(status));
-		return status;
+		printf("create1 failed - %s\n", nt_errstr(status));
+		return io.out.handle;
 	}
 
-	printf("Close gave:\n");
+	printf("Open gave:\n");
 	printf("create_time     = %s\n", nt_time_string(tmp_ctx, io.out.create_time));
 	printf("access_time     = %s\n", nt_time_string(tmp_ctx, io.out.access_time));
 	printf("write_time      = %s\n", nt_time_string(tmp_ctx, io.out.write_time));
 	printf("change_time     = %s\n", nt_time_string(tmp_ctx, io.out.change_time));
+	printf("alloc_size      = %lld\n", io.out.alloc_size);
+	printf("size            = %lld\n", io.out.size);
+	printf("file_attr       = 0x%x\n", io.out.file_attr);
+	printf("handle          = %016llx%016llx\n", 
+	       io.out.handle.data[0], 
+	       io.out.handle.data[1]);
 
 	talloc_free(tmp_ctx);
 	
-	return status;
+	return io.out.handle;
 }
 
 /* 
@@ -277,8 +288,8 @@
 	transport = torture_smb2_negprot(mem_ctx, host);
 	session   = torture_smb2_session(transport, credentials);
 	tree      = torture_smb2_tree(session, share);
-	h1        = torture_smb2_create(tree, "test1.dat");
-	h2        = torture_smb2_create(tree, "test2.dat");
+	h1        = torture_smb2_create(tree, "test.dat");
+	h2        = torture_smb2_create(tree, "test1.dat");
 	torture_smb2_close(tree, h1);
 	torture_smb2_close(tree, h2);
 



More information about the samba-cvs mailing list