summaryrefslogtreecommitdiffstats
path: root/source3/libsmb/cliconnect.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-13 11:35:53 +0200
committerStefan Metzmacher <metze@samba.org>2011-09-13 13:16:08 +0200
commit76c1164406fa642fccdda0e4643a2ff4afdaedb4 (patch)
treec5996cce985558a43baf82c66f794083b7b2adc4 /source3/libsmb/cliconnect.c
parentafda15aa868856a727d860d04b7c7c1277484fe1 (diff)
downloadsamba-76c1164406fa642fccdda0e4643a2ff4afdaedb4.tar.gz
samba-76c1164406fa642fccdda0e4643a2ff4afdaedb4.tar.xz
samba-76c1164406fa642fccdda0e4643a2ff4afdaedb4.zip
s3:libsmb: make use of cli_state_available_size() in cli_sesssetup_blob_send()
metze
Diffstat (limited to 'source3/libsmb/cliconnect.c')
-rw-r--r--source3/libsmb/cliconnect.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index e0d2419ab6..f47336bd47 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1198,6 +1198,7 @@ static struct tevent_req *cli_sesssetup_blob_send(TALLOC_CTX *mem_ctx,
{
struct tevent_req *req, *subreq;
struct cli_sesssetup_blob_state *state;
+ uint32_t usable_space;
req = tevent_req_create(mem_ctx, &state,
struct cli_sesssetup_blob_state);
@@ -1208,16 +1209,17 @@ static struct tevent_req *cli_sesssetup_blob_send(TALLOC_CTX *mem_ctx,
state->blob = blob;
state->cli = cli;
- if (cli->max_xmit < BASE_SESSSETUP_BLOB_PACKET_SIZE + 1) {
+ usable_space = cli_state_available_size(cli,
+ BASE_SESSSETUP_BLOB_PACKET_SIZE);
+
+ if (usable_space == 0) {
DEBUG(1, ("cli_session_setup_blob: cli->max_xmit too small "
- "(was %u, need minimum %u)\n",
- (unsigned int)cli->max_xmit,
- BASE_SESSSETUP_BLOB_PACKET_SIZE));
+ "(not possible to send %u bytes)\n",
+ BASE_SESSSETUP_BLOB_PACKET_SIZE + 1));
tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
return tevent_req_post(req, ev);
}
- state->max_blob_size =
- MIN(cli->max_xmit - BASE_SESSSETUP_BLOB_PACKET_SIZE, 0xFFFF);
+ state->max_blob_size = MIN(usable_space, 0xFFFF);
if (!cli_sesssetup_blob_next(state, &subreq)) {
tevent_req_nterror(req, NT_STATUS_NO_MEMORY);