summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/cliconnect.c43
-rw-r--r--source3/torture/torture.c38
2 files changed, 80 insertions, 1 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 763878f9b3..75dcd62c2f 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -750,7 +750,6 @@ BOOL cli_ulogoff(struct cli_state *cli)
/****************************************************************************
Send a tconX.
****************************************************************************/
-
BOOL cli_send_tconX(struct cli_state *cli,
const char *share, const char *dev, const char *pass, int passlen)
{
@@ -1343,3 +1342,45 @@ name *SMBSERVER with error %s\n", desthost, cli_errstr(cli) ));
return True;
}
+
+
+
+
+
+/****************************************************************************
+ Send an old style tcon.
+****************************************************************************/
+NTSTATUS cli_raw_tcon(struct cli_state *cli,
+ const char *service, const char *pass, const char *dev,
+ uint16 *max_xmit, uint16 *tid)
+{
+ char *p;
+
+ memset(cli->outbuf,'\0',smb_size);
+ memset(cli->inbuf,'\0',smb_size);
+
+ set_message(cli->outbuf, 0, 0, True);
+ SCVAL(cli->outbuf,smb_com,SMBtcon);
+ cli_setup_packet(cli);
+
+ p = smb_buf(cli->outbuf);
+ *p++ = 4; p += clistr_push(cli, p, service, -1, STR_TERMINATE | STR_NOALIGN);
+ *p++ = 4; p += clistr_push(cli, p, pass, -1, STR_TERMINATE | STR_NOALIGN);
+ *p++ = 4; p += clistr_push(cli, p, dev, -1, STR_TERMINATE | STR_NOALIGN);
+
+ cli_setup_bcc(cli, p);
+
+ cli_send_smb(cli);
+ if (!cli_receive_smb(cli)) {
+ return NT_STATUS_UNEXPECTED_NETWORK_ERROR;
+ }
+
+ if (cli_is_error(cli)) {
+ return cli_nt_error(cli);
+ }
+
+ *max_xmit = SVAL(cli->inbuf, smb_vwv0);
+ *tid = SVAL(cli->inbuf, smb_vwv1);
+
+ return NT_STATUS_OK;
+}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 327212c6be..6ab5bf6dbb 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -977,6 +977,43 @@ static BOOL run_tcon_test(int dummy)
/*
+ checks for old style tcon support
+ */
+static BOOL run_tcon2_test(int dummy)
+{
+ static struct cli_state *cli;
+ uint16 cnum, max_xmit;
+ char *service;
+ NTSTATUS status;
+
+ if (!torture_open_connection(&cli)) {
+ return False;
+ }
+ cli_sockopt(cli, sockops);
+
+ printf("starting tcon2 test\n");
+
+ asprintf(&service, "\\\\%s\\%s", host, share);
+
+ status = cli_raw_tcon(cli, service, password, "?????", &max_xmit, &cnum);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("tcon2 failed : %s\n", cli_errstr(cli));
+ } else {
+ printf("tcon OK : max_xmit=%d cnum=%d tid=%d\n",
+ (int)max_xmit, (int)cnum, SVAL(cli->inbuf, smb_tid));
+ }
+
+ if (!torture_close_connection(cli)) {
+ return False;
+ }
+
+ printf("Passed tcon2 test\n");
+ return True;
+}
+
+
+/*
This test checks that
1) the server supports multiple locking contexts on the one SMB
@@ -4137,6 +4174,7 @@ static struct {
{"CASETABLE", torture_casetable, 0},
{"ERRMAPEXTRACT", run_error_map_extract, 0},
{"PIPE_NUMBER", run_pipe_number, 0},
+ {"TCON2", run_tcon2_test, 0},
{NULL, NULL, 0}};