smbtorture - RAW-ECHO test patch
Matthias Dieter Wallnöfer
mwallnoefer at yahoo.de
Thu Oct 4 12:11:06 GMT 2007
Hallo!
Maybe we should think to apply this patch. It seems very reasonable.
Other question: when is my own patch for torture in Samba 4 reviewed or applied (https://bugzilla.samba.org/show_bug.cgi?id=4284), I haven't it seen yet in the Samba 4 source tree. So afterwards we could definitely clear this circumstance.
Matthias
Martin Pala <Martin.Pala at Sun.COM> schrieb: Volker Lendecke wrote:
> On Tue, Sep 25, 2007 at 10:34:15AM +0200, Martin Pala wrote:
>
>
>> here is patch which implements the RAW-ECHO test.
>>
>
> ...
>
>
>> + Unix SMB/CIFS implementation.
>> + RAW_ECHO individual test suite
>> + Copyright (C) Andrew Tridgell 2003
>>
>
> Can you change this to your own personal (!) copyright
> please?
>
> Volker
>
OK, modified patch attached.
Thanks,
Martin
diff -Naur samba-4.0.0tp5/source/torture/raw/echo.c samba-4.0.0tp5-mp/source/torture/raw/echo.c
--- samba-4.0.0tp5/source/torture/raw/echo.c 1970-01-01 01:00:00.000000000 +0100
+++ samba-4.0.0tp5-mp/source/torture/raw/echo.c 2007-09-24 16:43:15.527041000 +0200
@@ -0,0 +1,119 @@
+/*
+ Unix SMB/CIFS implementation.
+ RAW_ECHO individual test suite
+ Copyright (C) Martin Pala 2007
+
+ 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 "torture/torture.h"
+#include "system/time.h"
+#include "libcli/raw/libcliraw.h"
+#include "libcli/libcli.h"
+#include "torture/util.h"
+#include "lib/cmdline/popt_common.h"
+
+
+/* basic testing of RAW_ECHO call
+*/
+BOOL torture_raw_echo(struct torture_context *torture)
+{
+ struct smb_echo p;
+ struct smbcli_state *cli;
+ const char *host = torture_setting_string(torture, "host", NULL);
+ BOOL ret = False;
+ TALLOC_CTX *mem_ctx;
+ NTSTATUS status;
+
+ mem_ctx = talloc_init("torture_raw_echo");
+
+ /* Prepare echo parameters */
+ p.in.repeat_count = 1;
+ p.in.size = 0;
+ p.in.data = NULL;
+
+
+ /* Establish connection */
+ cli = smbcli_state_init(mem_ctx);
+ if (!cli) {
+ torture_comment(torture, "Failed initialize smbcli_struct to connect with %s\n", host);
+ goto done;
+ }
+ if (!smbcli_socket_connect(cli, host)) {
+ torture_comment(torture, "Failed to connect with %s\n", host);
+ goto done;
+ }
+
+
+ /* Try echo right after negotiate protocol request */
+ printf("testing echo -- no session established\n");
+
+ status = smbcli_negprot(cli);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_OK)) {
+ printf("(%d) Failed to negotiate protocol - status %s, should be %s\n",
+ __LINE__, nt_errstr(status), nt_errstr(NT_STATUS_OK));
+ goto done;
+ }
+ status = smb_raw_echo(cli->transport, &p);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_OK)) {
+ printf("(%d) Incorrect status %s - should be %s\n",
+ __LINE__, nt_errstr(status), nt_errstr(NT_STATUS_OK));
+ goto done;
+ }
+
+
+ /* Try echo right after session setup request */
+ printf("testing echo -- session ready\n");
+
+ status = smbcli_session_setup(cli, cmdline_credentials);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_OK)) {
+ printf("(%d) Failed to establish session - status %s, should be %s\n",
+ __LINE__, nt_errstr(status), nt_errstr(NT_STATUS_OK));
+ goto done;
+ }
+
+ status = smb_raw_echo(cli->transport, &p);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_OK)) {
+ printf("(%d) Incorrect status %s - should be %s\n",
+ __LINE__, nt_errstr(status), nt_errstr(NT_STATUS_OK));
+ goto done;
+ }
+
+
+ /* Try echo right after logoff request */
+ printf("testing echo -- session logged off\n");
+
+ status = smb_raw_ulogoff(cli->session);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_OK)) {
+ printf("(%d) Failed to logoff - status %s, should be %s\n",
+ __LINE__, nt_errstr(status), nt_errstr(NT_STATUS_OK));
+ goto done;
+ }
+
+ status = smb_raw_echo(cli->transport, &p);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_OK)) {
+ printf("(%d) Incorrect status %s - should be %s\n",
+ __LINE__, nt_errstr(status), nt_errstr(NT_STATUS_OK));
+ goto done;
+ }
+
+
+ ret = True;
+done:
+ talloc_free(mem_ctx);
+ return ret;
+}
+
diff -Naur samba-4.0.0tp5/source/torture/raw/missing.txt samba-4.0.0tp5-mp/source/torture/raw/missing.txt
--- samba-4.0.0tp5/source/torture/raw/missing.txt 2004-04-04 13:51:10.000000000 +0200
+++ samba-4.0.0tp5-mp/source/torture/raw/missing.txt 2007-09-24 16:51:47.176612000 +0200
@@ -18,8 +18,6 @@
- SMBtcon
-- SMBecho
-
- SMBfunique
- SMBsearch vs SMBffirst?
diff -Naur samba-4.0.0tp5/source/torture/raw/raw.c samba-4.0.0tp5-mp/source/torture/raw/raw.c
--- samba-4.0.0tp5/source/torture/raw/raw.c 2007-05-25 15:03:33.000000000 +0200
+++ samba-4.0.0tp5-mp/source/torture/raw/raw.c 2007-09-24 12:55:46.506927000 +0200
@@ -62,6 +62,7 @@
torture_suite_add_simple_test(suite, "SAMBA3CHECKFSP", torture_samba3_checkfsp);
torture_suite_add_simple_test(suite, "SAMBA3BADPATH", torture_samba3_badpath);
torture_suite_add_simple_test(suite, "SCAN-EAMAX", torture_max_eas);
+ torture_suite_add_simple_test(suite, "ECHO", torture_raw_echo);
suite->description = talloc_strdup(suite,
"Tests for the raw SMB interface");
--- samba-4.0.0tp5/source/torture/config.mk 2007-04-20 13:28:25.000000000 +0200
+++ samba-4.0.0tp5-mp/source/torture/config.mk 2007-09-24 12:52:37.962948000 +0200
@@ -87,6 +87,7 @@
raw/samba3hide.o \
raw/samba3misc.o \
raw/composite.o \
+ raw/echo.o \
raw/raw.o
PRIVATE_DEPENDENCIES = \
LIBCLI_SMB LIBCLI_LSA LIBCLI_SMB_COMPOSITE \
---------------------------------
Beginnen Sie den Tag mit den neuesten Nachrichten. Machen Sie Yahoo! zu Ihrer Startseite!
More information about the samba-technical
mailing list