mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
added a simple test for the old SMBtcon interface
(This used to be commit c95ae394c5dfe5e0fcc658119213b17bcb95fab5)
This commit is contained in:
parent
a6fad1ca72
commit
dfcf1634bc
@ -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;
|
||||
}
|
||||
|
@ -976,6 +976,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
|
||||
|
||||
@ -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}};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user