summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-30 02:17:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:03 -0500
commit39883a90cf3ecabfc39e68e8b1d3265a4026d25c (patch)
tree5e66f3abe634ce01fe8b19e99aa355155cad9927
parentad8c4ae941047aa7409ff0d8d10de721f5ff0659 (diff)
downloadsamba-39883a90cf3ecabfc39e68e8b1d3265a4026d25c.tar.gz
samba-39883a90cf3ecabfc39e68e8b1d3265a4026d25c.tar.bz2
samba-39883a90cf3ecabfc39e68e8b1d3265a4026d25c.zip
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 e23edf762cace35f937959c9ffbef718431a79b9)
-rw-r--r--source4/libcli/raw/rawacl.c2
-rw-r--r--source4/libcli/raw/rawfileinfo.c4
-rw-r--r--source4/libcli/raw/rawfsinfo.c2
-rw-r--r--source4/libcli/raw/rawsearch.c8
-rw-r--r--source4/libcli/raw/rawtrans.c12
-rw-r--r--source4/librpc/rpc/dcerpc_smb.c2
-rw-r--r--source4/torture/basic/aliases.c10
-rw-r--r--source4/torture/basic/scanner.c8
-rw-r--r--source4/torture/rap/rap.c2
9 files changed, 31 insertions, 19 deletions
diff --git a/source4/libcli/raw/rawacl.c b/source4/libcli/raw/rawacl.c
index 20e6d6df31..9b4f2db3b2 100644
--- a/source4/libcli/raw/rawacl.c
+++ b/source4/libcli/raw/rawacl.c
@@ -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;
diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c
index cbb666b7ce..a0ee7891bf 100644
--- a/source4/libcli/raw/rawfileinfo.c
+++ b/source4/libcli/raw/rawfileinfo.c
@@ -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);
diff --git a/source4/libcli/raw/rawfsinfo.c b/source4/libcli/raw/rawfsinfo.c
index aefe8e3085..49378887fa 100644
--- a/source4/libcli/raw/rawfsinfo.c
+++ b/source4/libcli/raw/rawfsinfo.c
@@ -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;
diff --git a/source4/libcli/raw/rawsearch.c b/source4/libcli/raw/rawsearch.c
index dd8904dfd1..120a42f0d6 100644
--- a/source4/libcli/raw/rawsearch.c
+++ b/source4/libcli/raw/rawsearch.c
@@ -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);
diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c
index e6c928e3ed..21e20d00e0 100644
--- a/source4/libcli/raw/rawtrans.c
+++ b/source4/libcli/raw/rawtrans.c
@@ -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);
+}
diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c
index a6307a9413..ead479230d 100644
--- a/source4/librpc/rpc/dcerpc_smb.c
+++ b/source4/librpc/rpc/dcerpc_smb.c
@@ -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;
diff --git a/source4/torture/basic/aliases.c b/source4/torture/basic/aliases.c
index 4f63b366a5..b63a1555f3 100644
--- a/source4/torture/basic/aliases.c
+++ b/source4/torture/basic/aliases.c
@@ -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;
diff --git a/source4/torture/basic/scanner.c b/source4/torture/basic/scanner.c
index cd53cb3979..0e79e94f82 100644
--- a/source4/torture/basic/scanner.c
+++ b/source4/torture/basic/scanner.c
@@ -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;
diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c
index a74acdb331..1ae92a6034 100644
--- a/source4/torture/rap/rap.c
+++ b/source4/torture/rap/rap.c
@@ -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;