mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
r3383: avoid multi-part SMBtrans and SMBtrans2 replies until our client library can handle
them properly (they are difficult to do in an async fashion).
By choosing trans.in.max_data to fix in the negotiated buffer size a
server won't send us multi-part replies.
I notice that windows seems to avoid them too :)
(This used to be commit e23edf762c
)
This commit is contained in:
parent
ad8c4ae941
commit
39883a90cf
@ -31,7 +31,7 @@ struct smbcli_request *smb_raw_query_secdesc_send(struct smbcli_tree *tree,
|
||||
|
||||
nt.in.max_setup = 0;
|
||||
nt.in.max_param = 4;
|
||||
nt.in.max_data = 0x10000;
|
||||
nt.in.max_data = smb_raw_max_trans_data(tree, 4);
|
||||
nt.in.setup_count = 0;
|
||||
nt.in.function = NT_TRANSACT_QUERY_SECURITY_DESC;
|
||||
nt.in.setup = NULL;
|
||||
|
@ -291,7 +291,7 @@ static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tre
|
||||
tp.in.setup_count = 1;
|
||||
tp.in.data = data_blob(NULL, 0);
|
||||
tp.in.max_param = 2;
|
||||
tp.in.max_data = 0xFFFF;
|
||||
tp.in.max_data = smb_raw_max_trans_data(tree, 2);
|
||||
tp.in.setup = &setup;
|
||||
|
||||
tp.in.params = data_blob_talloc(mem_ctx, NULL, 4);
|
||||
@ -344,7 +344,7 @@ static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tre
|
||||
tp.in.setup_count = 1;
|
||||
tp.in.data = data_blob(NULL, 0);
|
||||
tp.in.max_param = 2;
|
||||
tp.in.max_data = 0xFFFF;
|
||||
tp.in.max_data = smb_raw_max_trans_data(tree, 2);
|
||||
tp.in.setup = &setup;
|
||||
|
||||
tp.in.params = data_blob_talloc(mem_ctx, NULL, 6);
|
||||
|
@ -77,7 +77,7 @@ static struct smbcli_request *smb_raw_qfsinfo_send(struct smbcli_tree *tree,
|
||||
tp.in.timeout = 0;
|
||||
tp.in.setup_count = 1;
|
||||
tp.in.max_param = 0;
|
||||
tp.in.max_data = 0x1000; /* plenty for all possible QFS levels */
|
||||
tp.in.max_data = smb_raw_max_trans_data(tree, 0);
|
||||
tp.in.setup = &setup;
|
||||
tp.in.data = data_blob(NULL, 0);
|
||||
tp.in.timeout = 0;
|
||||
|
@ -206,8 +206,8 @@ static NTSTATUS smb_raw_search_first_blob(struct smbcli_tree *tree,
|
||||
tp.in.timeout = 0;
|
||||
tp.in.setup_count = 1;
|
||||
tp.in.data = data_blob(NULL, 0);
|
||||
tp.in.max_param = 1024;
|
||||
tp.in.max_data = 8192;
|
||||
tp.in.max_param = 10;
|
||||
tp.in.max_data = smb_raw_max_trans_data(tree, 10);
|
||||
tp.in.setup = &setup;
|
||||
|
||||
tp.in.params = data_blob_talloc(mem_ctx, NULL, 12);
|
||||
@ -258,8 +258,8 @@ static NTSTATUS smb_raw_search_next_blob(struct smbcli_tree *tree,
|
||||
tp.in.timeout = 0;
|
||||
tp.in.setup_count = 1;
|
||||
tp.in.data = data_blob(NULL, 0);
|
||||
tp.in.max_param = 1024;
|
||||
tp.in.max_data = 8192;
|
||||
tp.in.max_param = 10;
|
||||
tp.in.max_data = smb_raw_max_trans_data(tree, 10);
|
||||
tp.in.setup = &setup;
|
||||
|
||||
tp.in.params = data_blob_talloc(mem_ctx, NULL, 12);
|
||||
|
@ -531,3 +531,15 @@ NTSTATUS smb_raw_nttrans(struct smbcli_tree *tree,
|
||||
|
||||
return smb_raw_nttrans_recv(req, mem_ctx, parms);
|
||||
}
|
||||
|
||||
/*
|
||||
work out the maximum data size for a trans request while avoiding
|
||||
multi-part replies
|
||||
|
||||
TODO: we only need to avoid multi-part replies because the
|
||||
multi-part trans receive code is broken.
|
||||
*/
|
||||
size_t smb_raw_max_trans_data(struct smbcli_tree *tree, size_t param_size)
|
||||
{
|
||||
return tree->session->transport->options.max_xmit - (70 + param_size);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ static NTSTATUS smb_send_trans_request(struct dcerpc_pipe *p, DATA_BLOB *blob)
|
||||
setup[1] = smb->fnum;
|
||||
|
||||
trans->in.max_param = 0;
|
||||
trans->in.max_data = 0x8000;
|
||||
trans->in.max_data = smb_raw_max_trans_data(smb->tree, 0);
|
||||
trans->in.max_setup = 0;
|
||||
trans->in.setup_count = 2;
|
||||
trans->in.flags = 0;
|
||||
|
@ -86,7 +86,7 @@ static void qfsinfo_aliases(struct smbcli_state *cli)
|
||||
d_printf("\nChecking for QFSINFO aliases\n");
|
||||
|
||||
t2.in.max_param = 0;
|
||||
t2.in.max_data = 0x8000;
|
||||
t2.in.max_data = smb_raw_max_trans_data(cli->tree, 0);
|
||||
t2.in.max_setup = 0;
|
||||
t2.in.flags = 0;
|
||||
t2.in.timeout = 0;
|
||||
@ -109,7 +109,7 @@ static void qfileinfo_aliases(struct smbcli_state *cli)
|
||||
d_printf("\nChecking for QFILEINFO aliases\n");
|
||||
|
||||
t2.in.max_param = 2;
|
||||
t2.in.max_data = 0x8000;
|
||||
t2.in.max_data = smb_raw_max_trans_data(cli->tree, 2);
|
||||
t2.in.max_setup = 0;
|
||||
t2.in.flags = 0;
|
||||
t2.in.timeout = 0;
|
||||
@ -149,7 +149,7 @@ static void qpathinfo_aliases(struct smbcli_state *cli)
|
||||
d_printf("\nChecking for QPATHINFO aliases\n");
|
||||
|
||||
t2.in.max_param = 2;
|
||||
t2.in.max_data = 0x8000;
|
||||
t2.in.max_data = smb_raw_max_trans_data(cli->tree, 2);
|
||||
t2.in.max_setup = 0;
|
||||
t2.in.flags = 0;
|
||||
t2.in.timeout = 0;
|
||||
@ -193,7 +193,7 @@ static void findfirst_aliases(struct smbcli_state *cli)
|
||||
d_printf("\nChecking for FINDFIRST aliases\n");
|
||||
|
||||
t2.in.max_param = 16;
|
||||
t2.in.max_data = 0x8000;
|
||||
t2.in.max_data = smb_raw_max_trans_data(cli->tree, 16);
|
||||
t2.in.max_setup = 0;
|
||||
t2.in.flags = 0;
|
||||
t2.in.timeout = 0;
|
||||
@ -345,7 +345,7 @@ static void setpathinfo_aliases(struct smbcli_state *cli)
|
||||
d_printf("\nChecking for SETPATHINFO aliases\n");
|
||||
|
||||
t2.in.max_param = 32;
|
||||
t2.in.max_data = 0x8000;
|
||||
t2.in.max_data = smb_raw_max_trans_data(cli->tree, 32);
|
||||
t2.in.max_setup = 0;
|
||||
t2.in.flags = 0;
|
||||
t2.in.timeout = 0;
|
||||
|
@ -58,8 +58,8 @@ static NTSTATUS try_trans2(struct smbcli_state *cli,
|
||||
|
||||
mem_ctx = talloc_init("try_trans2");
|
||||
|
||||
t2.in.max_param = 1024;
|
||||
t2.in.max_data = 0x8000;
|
||||
t2.in.max_param = 64;
|
||||
t2.in.max_data = smb_raw_max_trans_data(cli->tree, 64);
|
||||
t2.in.max_setup = 10;
|
||||
t2.in.flags = 0;
|
||||
t2.in.timeout = 0;
|
||||
@ -339,8 +339,8 @@ static NTSTATUS try_nttrans(struct smbcli_state *cli,
|
||||
ntdata_blob.length = data_len;
|
||||
ntdata_blob.data = data;
|
||||
|
||||
parms.in.max_param = 1024;
|
||||
parms.in.max_data = 1024;
|
||||
parms.in.max_param = 64;
|
||||
parms.in.max_data = smb_raw_max_trans_data(cli->tree, 64);
|
||||
parms.in.max_setup = 0;
|
||||
parms.in.setup_count = 0;
|
||||
parms.in.function = op;
|
||||
|
@ -172,7 +172,7 @@ static NTSTATUS rap_cli_do_call(struct smbcli_state *cli, TALLOC_CTX *mem_ctx,
|
||||
params->flags = RAPNDR_FLAGS;
|
||||
|
||||
trans.in.max_param = call->rcv_paramlen;
|
||||
trans.in.max_data = call->rcv_datalen;
|
||||
trans.in.max_data = smb_raw_max_trans_data(cli->tree, call->rcv_paramlen);
|
||||
trans.in.max_setup = 0;
|
||||
trans.in.flags = 0;
|
||||
trans.in.timeout = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user