From 686070a147531ac704730eb1b5b6857b5cfc92bb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 04:46:48 +0000 Subject: r11663: start of a SMB2 torture test. Just does a negprot and prints some fields for now. test name is SMB2-CONNECT (This used to be commit 13f27fadca2f74a2486caa7df0fc7662fca16f67) --- source4/torture/smb2/connect.c | 74 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 source4/torture/smb2/connect.c (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c new file mode 100644 index 0000000000..00a9b35c17 --- /dev/null +++ b/source4/torture/smb2/connect.c @@ -0,0 +1,74 @@ +/* + Unix SMB/CIFS implementation. + + test suite for SMB2 connection operations + + Copyright (C) Andrew Tridgell 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "libcli/raw/libcliraw.h" +#include "libcli/smb2/smb2.h" +#include "librpc/gen_ndr/ndr_security.h" +#include "lib/cmdline/popt_common.h" +#include "lib/events/events.h" + +#define BASEDIR "\\testsmb2" + +#define CHECK_STATUS(status, correct) do { \ + if (!NT_STATUS_EQUAL(status, correct)) { \ + printf("(%s) Incorrect status %s - should be %s\n", \ + __location__, nt_errstr(status), nt_errstr(correct)); \ + ret = False; \ + goto done; \ + }} while (0) + +/* + basic testing of SMB2 connection calls +*/ +BOOL torture_smb2_connect(void) +{ + TALLOC_CTX *mem_ctx = talloc_new(NULL); + struct smbcli_socket *socket; + struct smb2_transport *transport; + const char *host = lp_parm_string(-1, "torture", "host"); + BOOL ret = True; + NTSTATUS status; + + socket = smbcli_sock_connect_byname(host, 445, mem_ctx, NULL); + if (socket == NULL) { + printf("Failed to connect to %s\n", host); + return False; + } + + transport = smb2_transport_init(socket, mem_ctx); + if (socket == NULL) { + printf("Failed to setup smb2 transport\n"); + return False; + } + + /* send a negprot */ + status = smb2_negprot(transport); + if (!NT_STATUS_IS_OK(status)) { + printf("negprot failed - %s\n", nt_errstr(status)); + return False; + } + + talloc_free(mem_ctx); + + return ret; +} -- cgit From 555b45e12c281eb3980d15b12728c59c6b73c302 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 05:53:54 +0000 Subject: r11665: started to put some meat on the structure used for the SMB2 library the call definitions will be in smb2_calls.h, which will play a similar role that smb_interfaces.h plays for the old SMB protocol (This used to be commit 4ef3902a8a99a0b8caa81a07ba07830d7cbbc32c) --- source4/torture/smb2/connect.c | 70 +++++++++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 11 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 00a9b35c17..7237bb704a 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -23,6 +23,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" #include "libcli/smb2/smb2.h" +#include "libcli/smb2/smb2_calls.h" #include "librpc/gen_ndr/ndr_security.h" #include "lib/cmdline/popt_common.h" #include "lib/events/events.h" @@ -37,17 +38,16 @@ goto done; \ }} while (0) -/* - basic testing of SMB2 connection calls -*/ -BOOL torture_smb2_connect(void) + +/* + send a negotiate + */ +static struct smb2_transport *torture_smb2_negprot(TALLOC_CTX *mem_ctx, const char *host) { - TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smbcli_socket *socket; struct smb2_transport *transport; - const char *host = lp_parm_string(-1, "torture", "host"); - BOOL ret = True; NTSTATUS status; + struct smb2_negprot io; socket = smbcli_sock_connect_byname(host, 445, mem_ctx, NULL); if (socket == NULL) { @@ -56,19 +56,67 @@ BOOL torture_smb2_connect(void) } transport = smb2_transport_init(socket, mem_ctx); - if (socket == NULL) { + if (transport == NULL) { printf("Failed to setup smb2 transport\n"); return False; } + ZERO_STRUCT(io); + io.in.unknown1 = 0x010024; + /* send a negprot */ - status = smb2_negprot(transport); + status = smb2_negprot(transport, mem_ctx, &io); if (!NT_STATUS_IS_OK(status)) { printf("negprot failed - %s\n", nt_errstr(status)); - return False; + return NULL; } + printf("Negprot reply:\n"); + printf("current_time = %s\n", nt_time_string(mem_ctx, io.out.current_time)); + printf("boot_time = %s\n", nt_time_string(mem_ctx, io.out.boot_time)); + + return transport; +} + +#if 0 +/* + send a session setup +*/ +static struct smb2_session *torture_smb2_session(struct smb2_transport *transport, + struct cli_credentials *credentials) +{ + struct smb2_session *session; + NTSTATUS status; + + session = smb2_session_init(transport); + + status = smb2_session_setup(session, credentials) + if (!NT_STATUS_IS_OK(status)) { + printf("session setup failed - %s\n", nt_errstr(status)); + return NULL; + } + + return session; +} +#endif + +/* + basic testing of SMB2 connection calls +*/ +BOOL torture_smb2_connect(void) +{ + TALLOC_CTX *mem_ctx = talloc_new(NULL); + struct smb2_transport *transport; + struct smb2_session *session; + const char *host = lp_parm_string(-1, "torture", "host"); + struct cli_credentials *credentials = cmdline_credentials; + + transport = torture_smb2_negprot(mem_ctx, host); +#if 0 + session = torture_smb2_session(transport, credentials); +#endif + talloc_free(mem_ctx); - return ret; + return True; } -- cgit From 86c1370cb03a244fd5644d30732a1fbda762fe6a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 06:26:42 +0000 Subject: r11666: filled in the basic session setup. Vista happily accepts the first stage of the session setup, and waits for more. (This used to be commit 804c229c3ba7f866a7f3d66684e268d5ddc820ce) --- source4/torture/smb2/connect.c | 54 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 7237bb704a..43029dd04d 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -27,6 +27,7 @@ #include "librpc/gen_ndr/ndr_security.h" #include "lib/cmdline/popt_common.h" #include "lib/events/events.h" +#include "auth/gensec/gensec.h" #define BASEDIR "\\testsmb2" @@ -78,7 +79,6 @@ static struct smb2_transport *torture_smb2_negprot(TALLOC_CTX *mem_ctx, const ch return transport; } -#if 0 /* send a session setup */ @@ -86,11 +86,56 @@ static struct smb2_session *torture_smb2_session(struct smb2_transport *transpor struct cli_credentials *credentials) { struct smb2_session *session; + struct smb2_session_setup io; NTSTATUS status; + TALLOC_CTX *tmp_ctx = talloc_new(transport); - session = smb2_session_init(transport); + ZERO_STRUCT(io); + io.in.unknown1 = 0x11; + io.in.unknown2 = 0xF; + io.in.unknown3 = 0x00; + io.in.unknown4 = 0x50; + + session = smb2_session_init(transport, transport, True); + + status = gensec_set_credentials(session->gensec, credentials); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("Failed to start set GENSEC client credentails: %s\n", + nt_errstr(status))); + return NULL; + } + + status = gensec_set_target_hostname(session->gensec, transport->socket->hostname); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("Failed to start set GENSEC target hostname: %s\n", + nt_errstr(status))); + return NULL; + } + + status = gensec_set_target_service(session->gensec, "cifs"); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("Failed to start set GENSEC target service: %s\n", + nt_errstr(status))); + return NULL; + } + + status = gensec_start_mech_by_oid(session->gensec, GENSEC_OID_SPNEGO); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("Failed to start set GENSEC client - %s\n", + nt_errstr(status))); + return NULL; + } + + status = gensec_update(session->gensec, tmp_ctx, + session->transport->negotiate.secblob, + &io.in.secblob); + if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) && + !NT_STATUS_IS_OK(status)) { + DEBUG(1, ("Failed initial gensec_update : %s\n", nt_errstr(status))); + return NULL; + } - status = smb2_session_setup(session, credentials) + status = smb2_session_setup(session, tmp_ctx, &io); if (!NT_STATUS_IS_OK(status)) { printf("session setup failed - %s\n", nt_errstr(status)); return NULL; @@ -98,7 +143,6 @@ static struct smb2_session *torture_smb2_session(struct smb2_transport *transpor return session; } -#endif /* basic testing of SMB2 connection calls @@ -112,9 +156,7 @@ BOOL torture_smb2_connect(void) struct cli_credentials *credentials = cmdline_credentials; transport = torture_smb2_negprot(mem_ctx, host); -#if 0 session = torture_smb2_session(transport, credentials); -#endif talloc_free(mem_ctx); -- cgit From 7a78d2d6b083fbd408c766116693d01b57628f28 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 07:23:45 +0000 Subject: r11668: yay! we get a successful session setup with SMB2, and get back a 64bit uid (This used to be commit 72b34a7c1b66af6be02f66639efc55a19c73e387) --- source4/torture/smb2/connect.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 43029dd04d..49b9582d4d 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -76,6 +76,8 @@ static struct smb2_transport *torture_smb2_negprot(TALLOC_CTX *mem_ctx, const ch printf("current_time = %s\n", nt_time_string(mem_ctx, io.out.current_time)); printf("boot_time = %s\n", nt_time_string(mem_ctx, io.out.boot_time)); + transport->negotiate.secblob = io.out.secblob; + return transport; } @@ -89,12 +91,12 @@ static struct smb2_session *torture_smb2_session(struct smb2_transport *transpor struct smb2_session_setup io; NTSTATUS status; TALLOC_CTX *tmp_ctx = talloc_new(transport); + DATA_BLOB secblob; ZERO_STRUCT(io); io.in.unknown1 = 0x11; io.in.unknown2 = 0xF; io.in.unknown3 = 0x00; - io.in.unknown4 = 0x50; session = smb2_session_init(transport, transport, True); @@ -126,21 +128,39 @@ static struct smb2_session *torture_smb2_session(struct smb2_transport *transpor return NULL; } - status = gensec_update(session->gensec, tmp_ctx, - session->transport->negotiate.secblob, - &io.in.secblob); - if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) && - !NT_STATUS_IS_OK(status)) { - DEBUG(1, ("Failed initial gensec_update : %s\n", nt_errstr(status))); - return NULL; - } + secblob = session->transport->negotiate.secblob; + + do { + NTSTATUS status1; + + status1 = gensec_update(session->gensec, tmp_ctx, secblob, &io.in.secblob); + if (!NT_STATUS_EQUAL(status1, NT_STATUS_MORE_PROCESSING_REQUIRED) && + !NT_STATUS_IS_OK(status1)) { + DEBUG(1, ("Failed initial gensec_update : %s\n", + nt_errstr(status1))); + status = status1; + break; + } + + status = smb2_session_setup(session, tmp_ctx, &io); + secblob = io.out.secblob; + + session->uid = io.out.uid; + + if (NT_STATUS_IS_OK(status) && + NT_STATUS_EQUAL(status1, NT_STATUS_MORE_PROCESSING_REQUIRED)) { + status = gensec_update(session->gensec, tmp_ctx, secblob, + &io.in.secblob); + } + } while (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)); - status = smb2_session_setup(session, tmp_ctx, &io); if (!NT_STATUS_IS_OK(status)) { printf("session setup failed - %s\n", nt_errstr(status)); return NULL; } + printf("Session setup gave UID 0x%llx\n", session->uid); + return session; } -- cgit From 3e54c36fa459ec6f5e721b90ce4e4c1d0e31d85c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 09:11:51 +0000 Subject: r11674: SMB2 tree connect now works. We do 2 session setups and 2 tree connects, giving the following output: Running SMB2-CONNECT Negprot reply: current_time = Fri Nov 11 20:10:42 2005 EST boot_time = Sat Nov 12 10:34:33 2005 EST Session setup gave UID 0x40000000071 Session setup gave UID 0x140000000075 Tree connect gave tid = 0x7500000001 Tree connect gave tid = 0x7500000005 SMB2-CONNECT took 0.049024 secs (This used to be commit a24a4c311005dec4c5638e9c7c10e5e2f9872f4d) --- source4/torture/smb2/connect.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 49b9582d4d..8b5a26bce3 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -164,6 +164,35 @@ static struct smb2_session *torture_smb2_session(struct smb2_transport *transpor return session; } + +/* + send a tree connect +*/ +static struct smb2_tree *torture_smb2_tree(struct smb2_session *session, + const char *share) +{ + struct smb2_tree *tree; + struct smb2_tree_connect io; + NTSTATUS status; + + tree = smb2_tree_init(session, session, True); + + io.in.unknown1 = 0x09; + io.in.path = talloc_asprintf(tree, "\\\\%s\\%s", + session->transport->socket->hostname, + share); + + status = smb2_tree_connect(tree, &io); + if (!NT_STATUS_IS_OK(status)) { + printf("tcon failed - %s\n", nt_errstr(status)); + return NULL; + } + + printf("Tree connect gave tid = 0x%llx\n", io.out.tid); + + return tree; +} + /* basic testing of SMB2 connection calls */ @@ -171,12 +200,17 @@ BOOL torture_smb2_connect(void) { TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_transport *transport; - struct smb2_session *session; + struct smb2_session *session; + struct smb2_tree *tree; const char *host = lp_parm_string(-1, "torture", "host"); + const char *share = lp_parm_string(-1, "torture", "share"); struct cli_credentials *credentials = cmdline_credentials; transport = torture_smb2_negprot(mem_ctx, host); - session = torture_smb2_session(transport, credentials); + session = torture_smb2_session(transport, credentials); + session = torture_smb2_session(transport, credentials); + tree = torture_smb2_tree(session, share); + tree = torture_smb2_tree(session, share); talloc_free(mem_ctx); -- cgit From 75a807425c0a6c2da11b4eeee1326dc1f61fc14d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 11 Nov 2005 10:50:47 +0000 Subject: r11677: print leading zeros metze (This used to be commit 19fb79b35d6d0b20d01f3722754cdd734bebc2ba) --- source4/torture/smb2/connect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 8b5a26bce3..39131a74f2 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -159,7 +159,7 @@ static struct smb2_session *torture_smb2_session(struct smb2_transport *transpor return NULL; } - printf("Session setup gave UID 0x%llx\n", session->uid); + printf("Session setup gave UID 0x%016llx\n", session->uid); return session; } @@ -188,7 +188,7 @@ static struct smb2_tree *torture_smb2_tree(struct smb2_session *session, return NULL; } - printf("Tree connect gave tid = 0x%llx\n", io.out.tid); + printf("Tree connect gave tid = 0x%016llx\n", io.out.tid); return tree; } -- cgit From 2e753f851885930000eadbd4b69660d85124c716 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 12:37:16 +0000 Subject: r11679: opening/creating files in SMB2 now works. Lots of unknown parameters in the call tho. (This used to be commit 548fbd86b3b114493943b50669bdcba2f4ed87f2) --- source4/torture/smb2/connect.c | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 39131a74f2..955df4c890 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -188,11 +188,40 @@ static struct smb2_tree *torture_smb2_tree(struct smb2_session *session, return NULL; } - printf("Tree connect gave tid = 0x%016llx\n", io.out.tid); + printf("Tree connect gave tid = 0x%x\n", io.out.tid); + + tree->tid = io.out.tid; return tree; } +/* + send a create +*/ +static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, + const char *fname) +{ + struct smb2_create io; + NTSTATUS status; + + 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); + if (!NT_STATUS_IS_OK(status)) { + printf("create failed - %s\n", nt_errstr(status)); + return io.out.handle; + } + + printf("Open gave handle:\n"); + dump_data(0, io.out.handle.data, 20); + + return io.out.handle; +} + /* basic testing of SMB2 connection calls */ @@ -205,12 +234,15 @@ BOOL torture_smb2_connect(void) const char *host = lp_parm_string(-1, "torture", "host"); const char *share = lp_parm_string(-1, "torture", "share"); struct cli_credentials *credentials = cmdline_credentials; + struct smb2_handle h; transport = torture_smb2_negprot(mem_ctx, host); session = torture_smb2_session(transport, credentials); - session = torture_smb2_session(transport, credentials); - tree = torture_smb2_tree(session, share); tree = torture_smb2_tree(session, share); + h = torture_smb2_create(tree, "test2.dat"); + h = torture_smb2_create(tree, "test3.dat"); + h = torture_smb2_create(tree, "test4.dat"); + h = torture_smb2_create(tree, "test5.dat"); talloc_free(mem_ctx); -- cgit From 1b2e8caad3fb01ea3b61bda63965d324de61c815 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 13:08:31 +0000 Subject: r11680: added smb2_close(). This also demonstrates that file handles are 16 bytes, not 20 bytes (metze, you were right!) (This used to be commit d3bcc6628cde9ddedf0fd408cbee573f133ce582) --- source4/torture/smb2/connect.c | 52 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 955df4c890..ee323a8b3a 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -203,6 +203,7 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, { struct smb2_create io; NTSTATUS status; + TALLOC_CTX *tmp_ctx = talloc_new(tree); ZERO_STRUCT(io); io.in.unknown1 = 0x09000039; @@ -216,12 +217,49 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, return io.out.handle; } - printf("Open gave handle:\n"); - dump_data(0, io.out.handle.data, 20); + 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("handle = %016llx%016llx\n", + io.out.handle.data[0], + io.out.handle.data[1]); + + talloc_free(tmp_ctx); return io.out.handle; } +/* + send a close +*/ +static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle handle) +{ + struct smb2_close 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); + if (!NT_STATUS_IS_OK(status)) { + printf("close failed - %s\n", nt_errstr(status)); + return status; + } + + 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)); + + talloc_free(tmp_ctx); + + return status; +} + /* basic testing of SMB2 connection calls */ @@ -234,15 +272,15 @@ BOOL torture_smb2_connect(void) const char *host = lp_parm_string(-1, "torture", "host"); const char *share = lp_parm_string(-1, "torture", "share"); struct cli_credentials *credentials = cmdline_credentials; - struct smb2_handle h; + struct smb2_handle h1, h2; transport = torture_smb2_negprot(mem_ctx, host); session = torture_smb2_session(transport, credentials); tree = torture_smb2_tree(session, share); - h = torture_smb2_create(tree, "test2.dat"); - h = torture_smb2_create(tree, "test3.dat"); - h = torture_smb2_create(tree, "test4.dat"); - h = torture_smb2_create(tree, "test5.dat"); + h1 = torture_smb2_create(tree, "test1.dat"); + h2 = torture_smb2_create(tree, "test2.dat"); + torture_smb2_close(tree, h1); + torture_smb2_close(tree, h2); talloc_free(mem_ctx); -- cgit From 461ccc557b7cc4ed8b0a3f9fc9aa5f03eccbc656 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 14:04:46 +0000 Subject: r11681: filled in a few more smb2_create() fields (This used to be commit a95413568f1e45691524dfd8e9159a3bafe358ea) --- source4/torture/smb2/connect.c | 69 ++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 29 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index ee323a8b3a..53236d3b27 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -196,68 +196,79 @@ static struct smb2_tree *torture_smb2_tree(struct smb2_session *session, } /* - 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 @@ BOOL torture_smb2_connect(void) 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); -- cgit From 222e197b848e2f1e58602d1e709f057a1f8833fd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 21:22:15 +0000 Subject: r11687: filled in 3 more fields in the close reply (This used to be commit 3a0abb3ff0b532179780ed95f8fcb4bca6e040b1) --- source4/torture/smb2/connect.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 53236d3b27..68eb922b55 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -218,6 +218,9 @@ static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle ha 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); talloc_free(tmp_ctx); -- cgit From 91e1893741741de04b73a098495c697434105803 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 23:27:47 +0000 Subject: r11691: added reply buffer code checks and oplock flags for create request/reply (This used to be commit 26ed781375c03958241d8c93324e04e948944d01) --- source4/torture/smb2/connect.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 68eb922b55..2af6bfb576 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -205,7 +205,8 @@ static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle ha TALLOC_CTX *tmp_ctx = talloc_new(tree); ZERO_STRUCT(io); - io.in.unknown1 = 0x10018; + io.in.buffer_code = 0x18; + io.in.flags = SMB2_CLOSE_FLAGS_FULL_INFORMATION; io.in.handle = handle; status = smb2_close(tree, &io); if (!NT_STATUS_IS_OK(status)) { @@ -239,11 +240,11 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, TALLOC_CTX *tmp_ctx = talloc_new(tree); ZERO_STRUCT(io); - io.in.unknown1 = 0x09000039; /* gets an oplock */ - io.in.unknown1 = 0x00000039; /* no oplock */ + io.in.buffer_code = 0x39; + io.in.oplock_flags = 0; io.in.access_mask = SEC_RIGHTS_FILE_ALL; io.in.file_attr = FILE_ATTRIBUTE_NORMAL; - io.in.open_disposition = NTCREATEX_DISP_OPEN; + io.in.open_disposition = NTCREATEX_DISP_OPEN_IF; io.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE| NTCREATEX_SHARE_ACCESS_READ| @@ -258,6 +259,8 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, } printf("Open gave:\n"); + printf("oplock_flags = 0x%x\n", io.out.oplock_flags); + printf("create_action = 0x%x\n", io.out.create_action); 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)); @@ -291,8 +294,8 @@ BOOL torture_smb2_connect(void) transport = torture_smb2_negprot(mem_ctx, host); session = torture_smb2_session(transport, credentials); tree = torture_smb2_tree(session, share); - h1 = torture_smb2_create(tree, "test.dat"); - h2 = torture_smb2_create(tree, "test1.dat"); + h1 = torture_smb2_create(tree, "test9.dat"); + h2 = torture_smb2_create(tree, "test9.dat"); torture_smb2_close(tree, h1); torture_smb2_close(tree, h2); -- cgit From 2b7ee2ceee0a1b2be596a602997908f72a3af14d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 12 Nov 2005 01:08:43 +0000 Subject: r11692: added a full composite (async) spnego session setup for SMB2. This simplies the torture code a lot. (This used to be commit 7bf1046fbb7fd83fecb2fa645628ba9a17aab037) --- source4/torture/smb2/connect.c | 76 ++++++------------------------------------ 1 file changed, 10 insertions(+), 66 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 2af6bfb576..e88db8ac5b 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -27,7 +27,6 @@ #include "librpc/gen_ndr/ndr_security.h" #include "lib/cmdline/popt_common.h" #include "lib/events/events.h" -#include "auth/gensec/gensec.h" #define BASEDIR "\\testsmb2" @@ -88,77 +87,16 @@ static struct smb2_session *torture_smb2_session(struct smb2_transport *transpor struct cli_credentials *credentials) { struct smb2_session *session; - struct smb2_session_setup io; NTSTATUS status; - TALLOC_CTX *tmp_ctx = talloc_new(transport); - DATA_BLOB secblob; - - ZERO_STRUCT(io); - io.in.unknown1 = 0x11; - io.in.unknown2 = 0xF; - io.in.unknown3 = 0x00; - + session = smb2_session_init(transport, transport, True); - status = gensec_set_credentials(session->gensec, credentials); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("Failed to start set GENSEC client credentails: %s\n", - nt_errstr(status))); - return NULL; - } - - status = gensec_set_target_hostname(session->gensec, transport->socket->hostname); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("Failed to start set GENSEC target hostname: %s\n", - nt_errstr(status))); - return NULL; - } - - status = gensec_set_target_service(session->gensec, "cifs"); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("Failed to start set GENSEC target service: %s\n", - nt_errstr(status))); - return NULL; - } - - status = gensec_start_mech_by_oid(session->gensec, GENSEC_OID_SPNEGO); + status = smb2_session_setup_spnego(session, credentials); if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("Failed to start set GENSEC client - %s\n", - nt_errstr(status))); + printf("Session setup failed - %s\n", nt_errstr(status)); return NULL; } - - secblob = session->transport->negotiate.secblob; - - do { - NTSTATUS status1; - - status1 = gensec_update(session->gensec, tmp_ctx, secblob, &io.in.secblob); - if (!NT_STATUS_EQUAL(status1, NT_STATUS_MORE_PROCESSING_REQUIRED) && - !NT_STATUS_IS_OK(status1)) { - DEBUG(1, ("Failed initial gensec_update : %s\n", - nt_errstr(status1))); - status = status1; - break; - } - - status = smb2_session_setup(session, tmp_ctx, &io); - secblob = io.out.secblob; - - session->uid = io.out.uid; - - if (NT_STATUS_IS_OK(status) && - NT_STATUS_EQUAL(status1, NT_STATUS_MORE_PROCESSING_REQUIRED)) { - status = gensec_update(session->gensec, tmp_ctx, secblob, - &io.in.secblob); - } - } while (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)); - - if (!NT_STATUS_IS_OK(status)) { - printf("session setup failed - %s\n", nt_errstr(status)); - return NULL; - } - + printf("Session setup gave UID 0x%016llx\n", session->uid); return session; @@ -292,8 +230,14 @@ BOOL torture_smb2_connect(void) struct smb2_handle h1, h2; transport = torture_smb2_negprot(mem_ctx, host); + if (transport == NULL) return False; + session = torture_smb2_session(transport, credentials); + if (session == NULL) return False; + tree = torture_smb2_tree(session, share); + if (tree == NULL) return False; + h1 = torture_smb2_create(tree, "test9.dat"); h2 = torture_smb2_create(tree, "test9.dat"); torture_smb2_close(tree, h1); -- cgit From e27ba5e4c6f684c0fc0f0db9a84164384ff3c0fd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 12 Nov 2005 02:12:51 +0000 Subject: r11693: added a full async composite function for SMB2 that does: - name resolution - socket connect - negprot - multi-stage session setup - tcon (This used to be commit c1a8e866fe6a0544b7b26da451ea093cdcacdd8f) --- source4/torture/smb2/connect.c | 111 +++-------------------------------------- 1 file changed, 7 insertions(+), 104 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index e88db8ac5b..f76553c019 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -39,100 +39,6 @@ }} while (0) -/* - send a negotiate - */ -static struct smb2_transport *torture_smb2_negprot(TALLOC_CTX *mem_ctx, const char *host) -{ - struct smbcli_socket *socket; - struct smb2_transport *transport; - NTSTATUS status; - struct smb2_negprot io; - - socket = smbcli_sock_connect_byname(host, 445, mem_ctx, NULL); - if (socket == NULL) { - printf("Failed to connect to %s\n", host); - return False; - } - - transport = smb2_transport_init(socket, mem_ctx); - if (transport == NULL) { - printf("Failed to setup smb2 transport\n"); - return False; - } - - ZERO_STRUCT(io); - io.in.unknown1 = 0x010024; - - /* send a negprot */ - status = smb2_negprot(transport, mem_ctx, &io); - if (!NT_STATUS_IS_OK(status)) { - printf("negprot failed - %s\n", nt_errstr(status)); - return NULL; - } - - printf("Negprot reply:\n"); - printf("current_time = %s\n", nt_time_string(mem_ctx, io.out.current_time)); - printf("boot_time = %s\n", nt_time_string(mem_ctx, io.out.boot_time)); - - transport->negotiate.secblob = io.out.secblob; - - return transport; -} - -/* - send a session setup -*/ -static struct smb2_session *torture_smb2_session(struct smb2_transport *transport, - struct cli_credentials *credentials) -{ - struct smb2_session *session; - NTSTATUS status; - - session = smb2_session_init(transport, transport, True); - - status = smb2_session_setup_spnego(session, credentials); - if (!NT_STATUS_IS_OK(status)) { - printf("Session setup failed - %s\n", nt_errstr(status)); - return NULL; - } - - printf("Session setup gave UID 0x%016llx\n", session->uid); - - return session; -} - - -/* - send a tree connect -*/ -static struct smb2_tree *torture_smb2_tree(struct smb2_session *session, - const char *share) -{ - struct smb2_tree *tree; - struct smb2_tree_connect io; - NTSTATUS status; - - tree = smb2_tree_init(session, session, True); - - io.in.unknown1 = 0x09; - io.in.path = talloc_asprintf(tree, "\\\\%s\\%s", - session->transport->socket->hostname, - share); - - status = smb2_tree_connect(tree, &io); - if (!NT_STATUS_IS_OK(status)) { - printf("tcon failed - %s\n", nt_errstr(status)); - return NULL; - } - - printf("Tree connect gave tid = 0x%x\n", io.out.tid); - - tree->tid = io.out.tid; - - return tree; -} - /* send a close */ @@ -221,22 +127,19 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, BOOL torture_smb2_connect(void) { TALLOC_CTX *mem_ctx = talloc_new(NULL); - struct smb2_transport *transport; - struct smb2_session *session; struct smb2_tree *tree; const char *host = lp_parm_string(-1, "torture", "host"); const char *share = lp_parm_string(-1, "torture", "share"); struct cli_credentials *credentials = cmdline_credentials; struct smb2_handle h1, h2; + NTSTATUS status; - transport = torture_smb2_negprot(mem_ctx, host); - if (transport == NULL) return False; - - session = torture_smb2_session(transport, credentials); - if (session == NULL) return False; - - tree = torture_smb2_tree(session, share); - if (tree == NULL) return False; + status = smb2_connect(mem_ctx, host, share, credentials, &tree, + event_context_find(mem_ctx)); + if (!NT_STATUS_IS_OK(status)) { + printf("Connection failed - %s\n", nt_errstr(status)); + return False; + } h1 = torture_smb2_create(tree, "test9.dat"); h2 = torture_smb2_create(tree, "test9.dat"); -- cgit From 4d74d259d806618c1f00af50dfa2925738b84083 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 12 Nov 2005 02:37:51 +0000 Subject: r11695: added SMB2-SCAN torture test for scanning for active SMB2 opcodes (This used to be commit aa3bcf952c4436b488e461a3686955d70c672ce4) --- source4/torture/smb2/connect.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index f76553c019..6a9a803155 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -24,21 +24,9 @@ #include "libcli/raw/libcliraw.h" #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" -#include "librpc/gen_ndr/ndr_security.h" #include "lib/cmdline/popt_common.h" #include "lib/events/events.h" -#define BASEDIR "\\testsmb2" - -#define CHECK_STATUS(status, correct) do { \ - if (!NT_STATUS_EQUAL(status, correct)) { \ - printf("(%s) Incorrect status %s - should be %s\n", \ - __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ - goto done; \ - }} while (0) - - /* send a close */ @@ -141,8 +129,8 @@ BOOL torture_smb2_connect(void) return False; } - h1 = torture_smb2_create(tree, "test9.dat"); - h2 = torture_smb2_create(tree, "test9.dat"); + h1 = torture_smb2_create(tree, "test9.dat"); + h2 = torture_smb2_create(tree, "test9.dat"); torture_smb2_close(tree, h1); torture_smb2_close(tree, h2); -- cgit From 67a85b3f1bca7e0590ae97d07a6ef32c418e64d1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 12 Nov 2005 07:48:56 +0000 Subject: r11697: - added a generic SMB2 getinfo call - added a SMB2-SCANGETINFO test for scanning for available info levels - added names for the info levels I recognise to smb2.h (This used to be commit fe5986067e2aaca039d70393ccc8761434f18fe6) --- source4/torture/smb2/connect.c | 47 +++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 6a9a803155..54991e27ba 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -46,14 +46,16 @@ static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle ha return status; } - 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("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); + if (DEBUGLVL(1)) { + 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("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); + } talloc_free(tmp_ctx); @@ -90,25 +92,28 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, return io.out.handle; } - printf("Open gave:\n"); - printf("oplock_flags = 0x%x\n", io.out.oplock_flags); - printf("create_action = 0x%x\n", io.out.create_action); - 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]); + if (DEBUGLVL(1)) { + printf("Open gave:\n"); + printf("oplock_flags = 0x%x\n", io.out.oplock_flags); + printf("create_action = 0x%x\n", io.out.create_action); + 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 io.out.handle; } + /* basic testing of SMB2 connection calls */ -- cgit From 695e37d8e75c95af24cb3f02cfb6d44d95067671 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Nov 2005 05:10:09 +0000 Subject: r11716: added a read/write test (This used to be commit 7c229e5b9fc8774207b647214b9d03d26a60aae3) --- source4/torture/smb2/connect.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 54991e27ba..4907aadecb 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -63,6 +63,53 @@ static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle ha } +/* + 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 */ @@ -136,6 +183,7 @@ BOOL torture_smb2_connect(void) 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); -- cgit From b51703baf152c309ce325ce573c1683d7e503122 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 15 Nov 2005 04:38:59 +0000 Subject: r11730: added parsing and tests for a bunch more SMB2 getinfo levels (This used to be commit ca65bf0235cbfab451e5d5ceac9f714acc0cd46c) --- source4/torture/smb2/connect.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 4907aadecb..077c873d08 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -82,12 +82,26 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha w.in.handle = handle; w.in.data = data; + memset(w.in._pad, 0xff, 16); + + status = smb2_write(tree, &w); + if (!NT_STATUS_IS_OK(status)) { + printf("write failed - %s\n", nt_errstr(status)); + return status; + } + + torture_smb2_all_info(tree, handle); + + memset(w.in._pad, 0xff, 16); + status = smb2_write(tree, &w); if (!NT_STATUS_IS_OK(status)) { printf("write failed - %s\n", nt_errstr(status)); return status; } + torture_smb2_all_info(tree, handle); + ZERO_STRUCT(r); r.in.buffer_code = 0x31; r.in.length = data.length; @@ -168,16 +182,9 @@ BOOL torture_smb2_connect(void) { TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; - const char *host = lp_parm_string(-1, "torture", "host"); - const char *share = lp_parm_string(-1, "torture", "share"); - struct cli_credentials *credentials = cmdline_credentials; struct smb2_handle h1, h2; - NTSTATUS status; - status = smb2_connect(mem_ctx, host, share, credentials, &tree, - event_context_find(mem_ctx)); - if (!NT_STATUS_IS_OK(status)) { - printf("Connection failed - %s\n", nt_errstr(status)); + if (!torture_smb2_connection(mem_ctx, &tree)) { return False; } -- cgit From 6e94a6753025fca537e2d2981d1c01d7be44308f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 16 Nov 2005 06:39:57 +0000 Subject: r11738: test larger read/write calls. If you run smbtorture with -X (to enable 'dangerous' tests) then it does a write of 160k, which causes vista to blue screen. Otherwise it does a 120k write which works fine. (This used to be commit b4c5d7d0173b94ade4c16d47ef774ad9f3c17bc8) --- source4/torture/smb2/connect.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 077c873d08..34f8d5aa9f 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -72,9 +72,16 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha struct smb2_read r; NTSTATUS status; DATA_BLOB data; + int i; - data = data_blob_talloc(tree, NULL, 700); - generate_random_buffer(data.data, data.length); + if (lp_parm_bool(-1, "torture", "dangerous", False)) { + data = data_blob_talloc(tree, NULL, 160000); + } else { + data = data_blob_talloc(tree, NULL, 120000); + } + for (i=0;i Date: Wed, 16 Nov 2005 11:01:15 +0000 Subject: r11741: - the buffer code (first 2 bytes in the SMB2 body) seem to be the length of the fixed body part, and +1 if there's a dynamic part - there're 3 types of dynamic blobs with uint16_t offset/uint16_t size with uint16_t offset/uint32_t size with uint32_t offset/uint32_t size /* aligned to 8 bytes */ - strings are transmitted in UTF-16 with no termination and packet into a uint16/uint16 blob metze (This used to be commit 79103c51e5c752fbdb4d25a0047b65002828df89) --- source4/torture/smb2/connect.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 34f8d5aa9f..54f2920600 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -37,7 +37,6 @@ static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle ha TALLOC_CTX *tmp_ctx = talloc_new(tree); ZERO_STRUCT(io); - io.in.buffer_code = 0x18; io.in.flags = SMB2_CLOSE_FLAGS_FULL_INFORMATION; io.in.handle = handle; status = smb2_close(tree, &io); @@ -84,13 +83,10 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha } ZERO_STRUCT(w); - w.in.buffer_code = 0x31; w.in.offset = 0; w.in.handle = handle; w.in.data = data; - memset(w.in._pad, 0xff, 16); - status = smb2_write(tree, &w); if (!NT_STATUS_IS_OK(status)) { printf("write failed - %s\n", nt_errstr(status)); @@ -99,8 +95,6 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha torture_smb2_all_info(tree, handle); - memset(w.in._pad, 0xff, 16); - status = smb2_write(tree, &w); if (!NT_STATUS_IS_OK(status)) { printf("write failed - %s\n", nt_errstr(status)); @@ -110,7 +104,6 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha torture_smb2_all_info(tree, handle); ZERO_STRUCT(r); - r.in.buffer_code = 0x31; r.in.length = data.length; r.in.offset = 0; r.in.handle = handle; @@ -140,9 +133,21 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, struct smb2_create io; NTSTATUS status; TALLOC_CTX *tmp_ctx = talloc_new(tree); + DATA_BLOB blob = data_blob(NULL, 0); + +#if 0 /* TODO: find out what this blob mean */ + uint8_t buf[0x18]; + + SIVAL(buf, 0x00, 0x00000000); + SIVAL(buf, 0x04, 0x00040010); + SIVAL(buf, 0x08, 0x00180000); + SIVAL(buf, 0x0C, 0x00000000); + SBVAL(buf, 0x10, 0x006C00466341784DLLU); + + blob = data_blob_const(buf, 0x18) +#endif ZERO_STRUCT(io); - io.in.buffer_code = 0x39; io.in.oplock_flags = 0; io.in.access_mask = SEC_RIGHTS_FILE_ALL; io.in.file_attr = FILE_ATTRIBUTE_NORMAL; @@ -153,8 +158,9 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, NTCREATEX_SHARE_ACCESS_WRITE; io.in.create_options = NTCREATEX_OPTIONS_WRITE_THROUGH; io.in.fname = fname; + io.in.blob = blob; - status = smb2_create(tree, &io); + status = smb2_create(tree, tmp_ctx, &io); if (!NT_STATUS_IS_OK(status)) { printf("create1 failed - %s\n", nt_errstr(status)); return io.out.handle; @@ -197,6 +203,7 @@ BOOL torture_smb2_connect(void) h1 = torture_smb2_create(tree, "test9.dat"); h2 = torture_smb2_create(tree, "test9.dat"); +// h2 = torture_smb2_create(tree, "test9test9test9t9.dat"); torture_smb2_write(tree, h1); torture_smb2_close(tree, h1); torture_smb2_close(tree, h2); -- cgit From c8c7fb2492d3f19939df67f98e4ea6ad423274da Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 18 Nov 2005 09:25:25 +0000 Subject: r11775: added support for creating files on SMB2 with initial EA lists and an ACL (This used to be commit ff197092988cee64742f83df23c43ae664a196f9) --- source4/torture/smb2/connect.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 54f2920600..2307d8fffb 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -133,19 +133,6 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, struct smb2_create io; NTSTATUS status; TALLOC_CTX *tmp_ctx = talloc_new(tree); - DATA_BLOB blob = data_blob(NULL, 0); - -#if 0 /* TODO: find out what this blob mean */ - uint8_t buf[0x18]; - - SIVAL(buf, 0x00, 0x00000000); - SIVAL(buf, 0x04, 0x00040010); - SIVAL(buf, 0x08, 0x00180000); - SIVAL(buf, 0x0C, 0x00000000); - SBVAL(buf, 0x10, 0x006C00466341784DLLU); - - blob = data_blob_const(buf, 0x18) -#endif ZERO_STRUCT(io); io.in.oplock_flags = 0; @@ -158,7 +145,6 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, NTCREATEX_SHARE_ACCESS_WRITE; io.in.create_options = NTCREATEX_OPTIONS_WRITE_THROUGH; io.in.fname = fname; - io.in.blob = blob; status = smb2_create(tree, tmp_ctx, &io); if (!NT_STATUS_IS_OK(status)) { -- cgit From 2ede0b162caf1dc77092f9003ce6765b869432e1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 Nov 2005 11:05:21 +0000 Subject: r11902: added smb2_logoff() testing (This used to be commit ff50377822fa48eab7f66275098782241ca50f40) --- source4/torture/smb2/connect.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 2307d8fffb..080bb5a1c5 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -182,6 +182,7 @@ BOOL torture_smb2_connect(void) TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; struct smb2_handle h1, h2; + NTSTATUS status; if (!torture_smb2_connection(mem_ctx, &tree)) { return False; @@ -194,6 +195,18 @@ BOOL torture_smb2_connect(void) torture_smb2_close(tree, h1); torture_smb2_close(tree, h2); + status = smb2_logoff(tree); + if (!NT_STATUS_IS_OK(status)) { + printf("Logoff failed - %s\n", nt_errstr(status)); + return False; + } + + status = smb2_logoff(tree); + if (!NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) { + printf("Logoff should have disabled session - %s\n", nt_errstr(status)); + return False; + } + talloc_free(mem_ctx); return True; -- cgit From 43405e07446bfaaee25bcd0b1140667b533e59e3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 Nov 2005 11:12:08 +0000 Subject: r11904: added smb2_tdis() testing (This used to be commit e2ed615a44d825f8c46755408a1a1657222a508b) --- source4/torture/smb2/connect.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 080bb5a1c5..a1215e3ae7 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -195,7 +195,19 @@ BOOL torture_smb2_connect(void) torture_smb2_close(tree, h1); torture_smb2_close(tree, h2); - status = smb2_logoff(tree); + status = smb2_tdis(tree); + if (!NT_STATUS_IS_OK(status)) { + printf("tdis failed - %s\n", nt_errstr(status)); + return False; + } + + status = smb2_tdis(tree); + if (!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED)) { + printf("tdis should have disabled session - %s\n", nt_errstr(status)); + return False; + } + + status = smb2_logoff(tree); if (!NT_STATUS_IS_OK(status)) { printf("Logoff failed - %s\n", nt_errstr(status)); return False; -- cgit From 1e3583475fbe6be46383866f3e061637f2f20c2a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 Nov 2005 11:33:57 +0000 Subject: r11905: added SMB2_FLUSH as opcode 7. Thanks to metze and volker for help brainstorming this one. (This used to be commit a969ad592ae4cd8f7c66b1df4763fdc70328c967) --- source4/torture/smb2/connect.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index a1215e3ae7..a4f4cb6ba4 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -69,6 +69,7 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha { struct smb2_write w; struct smb2_read r; + struct smb2_flush f; NTSTATUS status; DATA_BLOB data; int i; @@ -103,6 +104,15 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha torture_smb2_all_info(tree, handle); + ZERO_STRUCT(f); + f.in.handle = handle; + + status = smb2_flush(tree, &f); + if (!NT_STATUS_IS_OK(status)) { + printf("flush failed - %s\n", nt_errstr(status)); + return status; + } + ZERO_STRUCT(r); r.in.length = data.length; r.in.offset = 0; -- cgit From 42cba737c0e63069c08fc65396f389d0fe45764a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 Nov 2005 11:51:47 +0000 Subject: r11907: added testing of SMB2 keepalive (This used to be commit 6096d23fe0e58b6c3e4174a70a0faebd88fd5f79) --- source4/torture/smb2/connect.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index a4f4cb6ba4..4973dcee6f 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -200,7 +200,6 @@ BOOL torture_smb2_connect(void) h1 = torture_smb2_create(tree, "test9.dat"); h2 = torture_smb2_create(tree, "test9.dat"); -// h2 = torture_smb2_create(tree, "test9test9test9t9.dat"); torture_smb2_write(tree, h1); torture_smb2_close(tree, h1); torture_smb2_close(tree, h2); @@ -229,6 +228,12 @@ BOOL torture_smb2_connect(void) return False; } + status = smb2_keepalive(tree); + if (!NT_STATUS_IS_OK(status)) { + printf("keepalive failed? - %s\n", nt_errstr(status)); + return False; + } + talloc_free(mem_ctx); return True; -- cgit From 03d301ead5f702872b8cb948b8cd01b0fa0db5f7 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Nov 2005 02:08:15 +0000 Subject: r11967: Fix more 64-bit warnings. (This used to be commit 9c4436a124f874ae240feaf590141d48c33a635f) --- source4/torture/smb2/connect.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 4973dcee6f..dde2ace4b2 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -51,8 +51,8 @@ static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle ha 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("alloc_size = %lld\n", (long long)io.out.alloc_size); + printf("size = %lld\n", (long long)io.out.size); printf("file_attr = 0x%x\n", io.out.file_attr); } @@ -170,12 +170,12 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, 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("alloc_size = %lld\n", (long long)io.out.alloc_size); + printf("size = %lld\n", (long long)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]); + (long long)io.out.handle.data[0], + (long long)io.out.handle.data[1]); } talloc_free(tmp_ctx); -- cgit From 89f5d66dfeb02ad626ad21c4c4c7800560f83676 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 7 Dec 2005 07:28:43 +0000 Subject: r12114: - smb2_keepalive() acts on the smb2_transport - smb2_logoff() acts on the smb2_session metze (This used to be commit ae1ca2bb4affefff1026c03f0765faf28c2b316b) --- source4/torture/smb2/connect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index dde2ace4b2..fe5febdf07 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -216,19 +216,19 @@ BOOL torture_smb2_connect(void) return False; } - status = smb2_logoff(tree); + status = smb2_logoff(tree->session); if (!NT_STATUS_IS_OK(status)) { printf("Logoff failed - %s\n", nt_errstr(status)); return False; } - status = smb2_logoff(tree); + status = smb2_logoff(tree->session); if (!NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) { printf("Logoff should have disabled session - %s\n", nt_errstr(status)); return False; } - status = smb2_keepalive(tree); + status = smb2_keepalive(tree->session->transport); if (!NT_STATUS_IS_OK(status)) { printf("keepalive failed? - %s\n", nt_errstr(status)); return False; -- cgit From d4de4c2d210d2e8c9b5aedf70695594809ad6a0b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 30 Dec 2005 13:16:54 +0000 Subject: r12608: Remove some unused #include lines. (This used to be commit 70e7449318aa0e9d2639c76730a7d1683b2f4981) --- source4/torture/smb2/connect.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index fe5febdf07..2077bb0227 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -21,11 +21,8 @@ */ #include "includes.h" -#include "libcli/raw/libcliraw.h" #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" -#include "lib/cmdline/popt_common.h" -#include "lib/events/events.h" /* send a close -- cgit From 78c50015bb8bd5a1d831a6e7ec796b3367c73145 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Jan 2006 15:40:05 +0000 Subject: r12694: Move some headers to the directory of the subsystem they belong to. (This used to be commit c722f665c90103f3ed57621c460e32ad33e7a8a3) --- source4/torture/smb2/connect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 2077bb0227..d4016b8770 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "smb.h" #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" -- cgit From 1a53c1dc927efbc6a594ed513feb9ab9247078e8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 4 Feb 2006 14:08:24 +0000 Subject: r13346: use private proto header files for the torture tests metze (This used to be commit 67837dbd2bcff8ec1917ba02884ee2eaa0776b46) --- source4/torture/smb2/connect.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index d4016b8770..7472493894 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -25,6 +25,8 @@ #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" +#include "torture/smb2/proto.h" + /* send a close */ -- cgit From 35349a58df5b69446607fbd742a05f57f3515319 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 18 Mar 2006 15:42:57 +0000 Subject: r14542: Remove librpc, libndr and libnbt from includes.h (This used to be commit 51b4270513752d2eafbe77f9de598de16ef84a1f) --- source4/torture/smb2/connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 7472493894..10b7046375 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -22,9 +22,9 @@ #include "includes.h" #include "smb.h" +#include "librpc/gen_ndr/security.h" #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" - #include "torture/smb2/proto.h" /* -- cgit From 909b111f587705a45f63540b39968f1af58a9b5d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 25 Mar 2006 16:01:28 +0000 Subject: r14720: Add torture_context argument to all torture tests (This used to be commit 3c7a5ce29108dd82210dc3e1f00414f545949e1d) --- source4/torture/smb2/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 10b7046375..349fcda992 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -25,6 +25,7 @@ #include "librpc/gen_ndr/security.h" #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" +#include "torture/torture.h" #include "torture/smb2/proto.h" /* @@ -187,7 +188,7 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, /* basic testing of SMB2 connection calls */ -BOOL torture_smb2_connect(void) +BOOL torture_smb2_connect(struct torture_context *torture) { TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; -- cgit From e306c5bf129a981693bd251d45597f1e584ee850 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 20 May 2006 10:46:38 +0000 Subject: r15741: move smb2 request structures into the main smb request structs as new levels metze (This used to be commit 91806353174704857dfcc15a730af7232cfde660) --- source4/torture/smb2/connect.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 349fcda992..77b5d5c40d 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -38,8 +38,8 @@ static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle ha TALLOC_CTX *tmp_ctx = talloc_new(tree); ZERO_STRUCT(io); - io.in.flags = SMB2_CLOSE_FLAGS_FULL_INFORMATION; - io.in.handle = handle; + io.in.file.handle = handle; + io.in.flags = SMB2_CLOSE_FLAGS_FULL_INFORMATION; status = smb2_close(tree, &io); if (!NT_STATUS_IS_OK(status)) { printf("close failed - %s\n", nt_errstr(status)); @@ -85,8 +85,8 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha } ZERO_STRUCT(w); + w.in.file.handle = handle; w.in.offset = 0; - w.in.handle = handle; w.in.data = data; status = smb2_write(tree, &w); @@ -106,7 +106,7 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha torture_smb2_all_info(tree, handle); ZERO_STRUCT(f); - f.in.handle = handle; + f.in.file.handle = handle; status = smb2_flush(tree, &f); if (!NT_STATUS_IS_OK(status)) { @@ -115,9 +115,9 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha } ZERO_STRUCT(r); + r.in.file.handle = handle; 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)) { @@ -160,7 +160,7 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, status = smb2_create(tree, tmp_ctx, &io); if (!NT_STATUS_IS_OK(status)) { printf("create1 failed - %s\n", nt_errstr(status)); - return io.out.handle; + return io.out.file.handle; } if (DEBUGLVL(1)) { @@ -175,13 +175,13 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, printf("size = %lld\n", (long long)io.out.size); printf("file_attr = 0x%x\n", io.out.file_attr); printf("handle = %016llx%016llx\n", - (long long)io.out.handle.data[0], - (long long)io.out.handle.data[1]); + (long long)io.out.file.handle.data[0], + (long long)io.out.file.handle.data[1]); } talloc_free(tmp_ctx); - return io.out.handle; + return io.out.file.handle; } -- cgit From f9ddc0dde562b0976a05fc6ca07ea8c9ce0bd284 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 20 May 2006 19:00:53 +0000 Subject: r15759: samba4 currently only supports read sizes up to with UINT16_MAX metze (This used to be commit 05ced31cb91eb1f170cb87d6964cf65daba43493) --- source4/torture/smb2/connect.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 77b5d5c40d..54075b17d0 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -77,6 +77,8 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha if (lp_parm_bool(-1, "torture", "dangerous", False)) { data = data_blob_talloc(tree, NULL, 160000); + } else if (lp_parm_bool(-1, "target", "samba4", False)) { + data = data_blob_talloc(tree, NULL, UINT16_MAX); } else { data = data_blob_talloc(tree, NULL, 120000); } -- cgit From 184c28844d9a2186053ea23920607831299100a7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 22 May 2006 14:18:17 +0000 Subject: r15803: the SMB2 server gives NT_STATUS_NOT_FOUND instead of NT_STATUS_INVALID_HANDLE metze (This used to be commit aa98aad0975e59fc8cf56c624f728b33ab54e099) --- source4/torture/smb2/connect.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 54075b17d0..3b12e54a3b 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -207,6 +207,12 @@ BOOL torture_smb2_connect(struct torture_context *torture) torture_smb2_close(tree, h1); torture_smb2_close(tree, h2); + status = smb2_util_close(tree, h1); + if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { + printf("close should have closed the handle - %s\n", nt_errstr(status)); + return False; + } + status = smb2_tdis(tree); if (!NT_STATUS_IS_OK(status)) { printf("tdis failed - %s\n", nt_errstr(status)); -- cgit From 348ad95ea7daa7ed17a0d50ebf642fc41770b631 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 1 Jul 2006 07:49:02 +0000 Subject: r16725: don't ignore errors metze (This used to be commit 42282301961a13055869445eb9d00492bdbbb61b) --- source4/torture/smb2/connect.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 3b12e54a3b..bd11f310d9 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -203,9 +203,21 @@ BOOL torture_smb2_connect(struct torture_context *torture) 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); + status = torture_smb2_write(tree, h1); + if (!NT_STATUS_IS_OK(status)) { + printf("Write failed - %s\n", nt_errstr(status)); + return False; + } + status = torture_smb2_close(tree, h1); + if (!NT_STATUS_IS_OK(status)) { + printf("Close failed - %s\n", nt_errstr(status)); + return False; + } + status = torture_smb2_close(tree, h2); + if (!NT_STATUS_IS_OK(status)) { + printf("Close failed - %s\n", nt_errstr(status)); + return False; + } status = smb2_util_close(tree, h1); if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { -- cgit From dd44e2415ce2f0c6afddbb88b0c069ade95dc99f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 1 Jul 2006 14:27:49 +0000 Subject: r16738: vista beta2 use FILE_CLOSED as error for an invalid file handle metze (This used to be commit fa35ddcaf9bbeaa4780aa3497cdff56b02af0ab9) --- source4/torture/smb2/connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index bd11f310d9..7d2773ebb6 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -220,7 +220,7 @@ BOOL torture_smb2_connect(struct torture_context *torture) } status = smb2_util_close(tree, h1); - if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { + if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("close should have closed the handle - %s\n", nt_errstr(status)); return False; } -- cgit From 0329d755a7611ba3897fc1ee9bdce410cc33d7f8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 30 Aug 2006 11:29:34 +0000 Subject: r17930: Merge noinclude branch: * Move dlinklist.h, smb.h to subsystem-specific directories * Clean up ads.h and move what is left of it to dsdb/ (only place where it's used) (This used to be commit f7afa1cb77f3cfa7020b57de12e6003db7cfcc42) --- source4/torture/smb2/connect.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 7d2773ebb6..9f36e4d707 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -21,7 +21,6 @@ */ #include "includes.h" -#include "smb.h" #include "librpc/gen_ndr/security.h" #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" -- cgit From 8c3b54f01dfc7275c7ff0ec194cd68ea072a8186 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 22 Sep 2006 04:04:46 +0000 Subject: r18808: added SMB2-MAXWRITE test and SMB2-DIR tests expanded size of dangerous level for write in SMB2-CONNECT test (This used to be commit 355c6e78a91f4e934479829e722f873ca7e66baf) --- source4/torture/smb2/connect.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 9f36e4d707..bb6ba0c39d 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -75,7 +75,7 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha int i; if (lp_parm_bool(-1, "torture", "dangerous", False)) { - data = data_blob_talloc(tree, NULL, 160000); + data = data_blob_talloc(tree, NULL, 16000000); } else if (lp_parm_bool(-1, "target", "samba4", False)) { data = data_blob_talloc(tree, NULL, UINT16_MAX); } else { @@ -90,6 +90,8 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha w.in.offset = 0; w.in.data = data; + printf("writing %d bytes\n", data.length); + status = smb2_write(tree, &w); if (!NT_STATUS_IS_OK(status)) { printf("write failed - %s\n", nt_errstr(status)); @@ -120,6 +122,8 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha r.in.length = data.length; r.in.offset = 0; + printf("reading %d bytes\n", data.length); + status = smb2_read(tree, tree, &r); if (!NT_STATUS_IS_OK(status)) { printf("read failed - %s\n", nt_errstr(status)); @@ -139,8 +143,7 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha /* send a create */ -static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, - const char *fname) +struct smb2_handle torture_smb2_create(struct smb2_tree *tree, const char *fname) { struct smb2_create io; NTSTATUS status; -- cgit From 8773e743c518578584d07d35ffdafdd598af88b0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 16 Oct 2006 13:06:41 +0000 Subject: r19339: Merge my 4.0-unittest branch. This adds an API for more fine-grained output in the testsuite rather than just True or False for a set of tests. The aim is to use this for: * known failure lists (run all tests and detect tests that started working or started failing). This would allow us to get rid of the RPC-SAMBA3-* tests * nicer torture output * simplification of the testsuite system * compatibility with other unit testing systems * easier usage of smbtorture (being able to run one test and automatically set up the environment for that) This is still a work-in-progress; expect more updates over the next couple of days. (This used to be commit 0eb6097305776325c75081356309115f445a7218) --- source4/torture/smb2/connect.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index bb6ba0c39d..9f36e4d707 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -75,7 +75,7 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha int i; if (lp_parm_bool(-1, "torture", "dangerous", False)) { - data = data_blob_talloc(tree, NULL, 16000000); + data = data_blob_talloc(tree, NULL, 160000); } else if (lp_parm_bool(-1, "target", "samba4", False)) { data = data_blob_talloc(tree, NULL, UINT16_MAX); } else { @@ -90,8 +90,6 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha w.in.offset = 0; w.in.data = data; - printf("writing %d bytes\n", data.length); - status = smb2_write(tree, &w); if (!NT_STATUS_IS_OK(status)) { printf("write failed - %s\n", nt_errstr(status)); @@ -122,8 +120,6 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha r.in.length = data.length; r.in.offset = 0; - printf("reading %d bytes\n", data.length); - status = smb2_read(tree, tree, &r); if (!NT_STATUS_IS_OK(status)) { printf("read failed - %s\n", nt_errstr(status)); @@ -143,7 +139,8 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha /* send a create */ -struct smb2_handle torture_smb2_create(struct smb2_tree *tree, const char *fname) +static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, + const char *fname) { struct smb2_create io; NTSTATUS status; -- cgit From a39f239cb28e4ac6be207d4179bacffce97f1b3e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 18 Oct 2006 14:23:19 +0000 Subject: r19392: Use torture_setting_* rather than lp_parm_* where possible. (This used to be commit b28860978fe29c5b10abfb8c59d7182864e21dd6) --- source4/torture/smb2/connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 9f36e4d707..46aabc0e9a 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -76,7 +76,7 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha if (lp_parm_bool(-1, "torture", "dangerous", False)) { data = data_blob_talloc(tree, NULL, 160000); - } else if (lp_parm_bool(-1, "target", "samba4", False)) { + } else if (lp_parm_bool(-1, "torture", "samba4", False)) { data = data_blob_talloc(tree, NULL, UINT16_MAX); } else { data = data_blob_talloc(tree, NULL, 120000); -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/torture/smb2/connect.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 46aabc0e9a..62d273e623 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/torture/smb2/connect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 62d273e623..fdfc4378ab 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -25,6 +25,7 @@ #include "libcli/smb2/smb2_calls.h" #include "torture/torture.h" #include "torture/smb2/proto.h" +#include "param/param.h" /* send a close -- cgit From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/torture/smb2/connect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index fdfc4378ab..c9a5732d2a 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -74,9 +74,9 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha DATA_BLOB data; int i; - if (lp_parm_bool(-1, "torture", "dangerous", False)) { + if (lp_parm_bool(NULL, "torture", "dangerous", false)) { data = data_blob_talloc(tree, NULL, 160000); - } else if (lp_parm_bool(-1, "torture", "samba4", False)) { + } else if (lp_parm_bool(NULL, "torture", "samba4", false)) { data = data_blob_talloc(tree, NULL, UINT16_MAX); } else { data = data_blob_talloc(tree, NULL, 120000); -- cgit From 60a1046c5c5783799bd64fe18e03534670f83d82 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 29 Sep 2007 18:00:19 +0000 Subject: r25430: Add the loadparm context to all parametric options. (This used to be commit fd697d77c9fe67a00939a1f04b35c451316fff58) --- source4/torture/smb2/connect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index c9a5732d2a..c071327419 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -74,9 +74,9 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha DATA_BLOB data; int i; - if (lp_parm_bool(NULL, "torture", "dangerous", false)) { + if (lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { data = data_blob_talloc(tree, NULL, 160000); - } else if (lp_parm_bool(NULL, "torture", "samba4", false)) { + } else if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { data = data_blob_talloc(tree, NULL, UINT16_MAX); } else { data = data_blob_talloc(tree, NULL, 120000); -- cgit From 2151cde58014ea2e822c13d2f8a369b45dc19ca8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 22:28:14 +0000 Subject: r25554: Convert last instances of BOOL, True and False to the standard types. (This used to be commit 566aa14139510788548a874e9213d91317f83ca9) --- source4/torture/smb2/connect.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index c071327419..796b180ddf 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -189,7 +189,7 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, /* basic testing of SMB2 connection calls */ -BOOL torture_smb2_connect(struct torture_context *torture) +bool torture_smb2_connect(struct torture_context *torture) { TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; @@ -197,7 +197,7 @@ BOOL torture_smb2_connect(struct torture_context *torture) NTSTATUS status; if (!torture_smb2_connection(mem_ctx, &tree)) { - return False; + return false; } h1 = torture_smb2_create(tree, "test9.dat"); @@ -205,56 +205,56 @@ BOOL torture_smb2_connect(struct torture_context *torture) status = torture_smb2_write(tree, h1); if (!NT_STATUS_IS_OK(status)) { printf("Write failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_smb2_close(tree, h1); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_smb2_close(tree, h2); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_util_close(tree, h1); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("close should have closed the handle - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_tdis(tree); if (!NT_STATUS_IS_OK(status)) { printf("tdis failed - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_tdis(tree); if (!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED)) { printf("tdis should have disabled session - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_logoff(tree->session); if (!NT_STATUS_IS_OK(status)) { printf("Logoff failed - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_logoff(tree->session); if (!NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) { printf("Logoff should have disabled session - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_keepalive(tree->session->transport); if (!NT_STATUS_IS_OK(status)) { printf("keepalive failed? - %s\n", nt_errstr(status)); - return False; + return false; } talloc_free(mem_ctx); - return True; + return true; } -- cgit From 934e932387ea5668ec000bcefe4ec86935297339 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Dec 2007 21:32:08 +0100 Subject: r26235: Avoid global_loadparm. (This used to be commit e9039782204389cc827e76da319d5ccf6d33be46) --- source4/torture/smb2/connect.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 796b180ddf..d01c138ef8 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -65,7 +65,7 @@ static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle ha /* test writing */ -static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle handle) +static NTSTATUS torture_smb2_write(struct torture_context *tctx, struct smb2_tree *tree, struct smb2_handle handle) { struct smb2_write w; struct smb2_read r; @@ -74,9 +74,9 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha DATA_BLOB data; int i; - if (lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { + if (torture_setting_bool(tctx, "dangerous", false)) { data = data_blob_talloc(tree, NULL, 160000); - } else if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { + } else if (torture_setting_bool(tctx, "samba4", false)) { data = data_blob_talloc(tree, NULL, UINT16_MAX); } else { data = data_blob_talloc(tree, NULL, 120000); @@ -202,7 +202,7 @@ bool torture_smb2_connect(struct torture_context *torture) h1 = torture_smb2_create(tree, "test9.dat"); h2 = torture_smb2_create(tree, "test9.dat"); - status = torture_smb2_write(tree, h1); + status = torture_smb2_write(torture, tree, h1); if (!NT_STATUS_IS_OK(status)) { printf("Write failed - %s\n", nt_errstr(status)); return false; -- cgit From bbdfbf8d9d486aee51117976b8f825759a4c4a37 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 00:28:22 +0100 Subject: r26238: Add a loadparm context parameter to torture_context, remove more uses of global_loadparm. (This used to be commit a33a5530545086b81a3b205aa109dff11c546926) --- source4/torture/smb2/connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index d01c138ef8..f1bc63dbbb 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -196,7 +196,7 @@ bool torture_smb2_connect(struct torture_context *torture) struct smb2_handle h1, h2; NTSTATUS status; - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } -- cgit From 88d2e0522737fb8856fb0f52c2af8a2f56130f19 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Feb 2008 15:05:44 +1100 Subject: updated SMB2 create operation to match WSPP. Adding some defined for various new create options (This used to be commit d037dc23ced3df6bce98cbf4810fb5f1247336bd) --- source4/torture/smb2/connect.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index f1bc63dbbb..0004ea958e 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -147,10 +147,10 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, TALLOC_CTX *tmp_ctx = talloc_new(tree); ZERO_STRUCT(io); - io.in.oplock_flags = 0; - io.in.access_mask = SEC_RIGHTS_FILE_ALL; - io.in.file_attr = FILE_ATTRIBUTE_NORMAL; - io.in.open_disposition = NTCREATEX_DISP_OPEN_IF; + io.in.oplock_level = 0; + io.in.desired_access = SEC_RIGHTS_FILE_ALL; + io.in.file_attributes = FILE_ATTRIBUTE_NORMAL; + io.in.create_disposition = NTCREATEX_DISP_OPEN_IF; io.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE| NTCREATEX_SHARE_ACCESS_READ| @@ -166,7 +166,7 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, if (DEBUGLVL(1)) { printf("Open gave:\n"); - printf("oplock_flags = 0x%x\n", io.out.oplock_flags); + printf("oplock_flags = 0x%x\n", io.out.oplock_level); printf("create_action = 0x%x\n", io.out.create_action); 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)); -- cgit From 95afe46a0ec550253255f963bc0afe89cf0444ad Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 27 May 2008 14:07:27 +1000 Subject: expanded the SMB2 create testing (This used to be commit 71915128498674d9937780b9278fd2ac1eb06ba8) --- source4/torture/smb2/connect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 0004ea958e..826bb2d719 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -139,7 +139,7 @@ static NTSTATUS torture_smb2_write(struct torture_context *tctx, struct smb2_tre /* send a create */ -static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, +static struct smb2_handle torture_smb2_createfile(struct smb2_tree *tree, const char *fname) { struct smb2_create io; @@ -200,8 +200,8 @@ bool torture_smb2_connect(struct torture_context *torture) return false; } - h1 = torture_smb2_create(tree, "test9.dat"); - h2 = torture_smb2_create(tree, "test9.dat"); + h1 = torture_smb2_createfile(tree, "test9.dat"); + h2 = torture_smb2_createfile(tree, "test9.dat"); status = torture_smb2_write(torture, tree, h1); if (!NT_STATUS_IS_OK(status)) { printf("Write failed - %s\n", nt_errstr(status)); -- cgit From 1a4f4d2cf052edde8ef6893081ed3c5a756e51d2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 9 Jun 2008 21:41:55 +0200 Subject: SMB2-CONNECT: remove reference to req->session before calling smb2_logoff_recv() on the invalid session metze (This used to be commit 93203e8e318dd10b9e7096e586187eb271d42134) --- source4/torture/smb2/connect.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source4/torture/smb2/connect.c') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 826bb2d719..e77e32ff7a 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -193,6 +193,7 @@ bool torture_smb2_connect(struct torture_context *torture) { TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; + struct smb2_request *req; struct smb2_handle h1, h2; NTSTATUS status; @@ -242,7 +243,15 @@ bool torture_smb2_connect(struct torture_context *torture) return false; } - status = smb2_logoff(tree->session); + req = smb2_logoff_send(tree->session); + if (!req) { + printf("smb2_logoff_send() failed\n"); + return false; + } + + req->session = NULL; + + status = smb2_logoff_recv(req); if (!NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) { printf("Logoff should have disabled session - %s\n", nt_errstr(status)); return false; -- cgit