summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-13 15:00:59 +0200
committerStefan Metzmacher <metze@samba.org>2011-09-15 12:12:24 +0200
commit768581eee524540ef576ce2cf56c0b5fbfe862d9 (patch)
treef2d084d01ed683126b9250c33fa854b3aece4449 /source3/libsmb
parentb02d27ae056b08372861de4980fca1e03cb8d091 (diff)
downloadsamba-768581eee524540ef576ce2cf56c0b5fbfe862d9.tar.gz
samba-768581eee524540ef576ce2cf56c0b5fbfe862d9.tar.bz2
samba-768581eee524540ef576ce2cf56c0b5fbfe862d9.zip
s3:libsmb: move cli->max_xmit to cli->conn.smb1.max_xmit
And keep cli->conn.smb1.client.max_xmit and cli->conn.smb1.server.max_xmit. metze
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c18
-rw-r--r--source3/libsmb/clientgen.c6
2 files changed, 16 insertions, 8 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 6e34c3d622..1abd76018a 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2611,6 +2611,9 @@ static void cli_negprot_done(struct tevent_req *subreq)
uint32_t both_capabilities;
uint32_t server_capabilities = 0;
uint32_t capabilities;
+ uint32_t client_max_xmit = cli->conn.smb1.client.max_xmit;
+ uint32_t server_max_xmit = 0;
+ uint32_t max_xmit;
enum protocol_types protocol;
status = cli_smb_recv(subreq, state, &inbuf, 1, &wct, &vwv,
@@ -2654,7 +2657,7 @@ static void cli_negprot_done(struct tevent_req *subreq)
/* NT protocol */
cli->sec_mode = CVAL(vwv + 1, 0);
cli->max_mux = SVAL(vwv + 1, 1);
- cli->max_xmit = IVAL(vwv + 3, 1);
+ server_max_xmit = IVAL(vwv + 3, 1);
cli->sesskey = IVAL(vwv + 7, 1);
cli->serverzone = SVALS(vwv + 15, 1);
cli->serverzone *= 60;
@@ -2715,7 +2718,7 @@ static void cli_negprot_done(struct tevent_req *subreq)
}
cli->sec_mode = SVAL(vwv + 1, 0);
- cli->max_xmit = SVAL(vwv + 2, 0);
+ server_max_xmit = SVAL(vwv + 2, 0);
cli->max_mux = SVAL(vwv + 3, 0);
cli->sesskey = IVAL(vwv + 6, 0);
cli->serverzone = SVALS(vwv + 10, 0);
@@ -2730,11 +2733,11 @@ static void cli_negprot_done(struct tevent_req *subreq)
/* the old core protocol */
cli->sec_mode = 0;
cli->serverzone = get_time_zone(time(NULL));
- cli->max_xmit = 1024;
+ server_max_xmit = 1024;
cli->max_mux = 1;
}
- if (cli->max_xmit < 1024) {
+ if (server_max_xmit < 1024) {
tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
return;
}
@@ -2744,8 +2747,6 @@ static void cli_negprot_done(struct tevent_req *subreq)
return;
}
- cli->max_xmit = MIN(cli->max_xmit, CLI_BUFFER_SIZE);
-
/*
* Now calculate the negotiated capabilities
* based on the mask for:
@@ -2758,11 +2759,16 @@ static void cli_negprot_done(struct tevent_req *subreq)
capabilities |= both_capabilities & SMB_CAP_BOTH_MASK;
capabilities |= server_capabilities & SMB_CAP_SERVER_MASK;
+ max_xmit = MIN(client_max_xmit, server_max_xmit);
+
cli->conn.protocol = protocol;
cli->conn.smb1.server.capabilities = server_capabilities;
cli->conn.smb1.capabilities = capabilities;
+ cli->conn.smb1.server.max_xmit = server_max_xmit;
+ cli->conn.smb1.max_xmit = max_xmit;
+
tevent_req_done(req);
}
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 720a118559..9091ad38d8 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -195,7 +195,6 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
}
cli->raw_status = NT_STATUS_INTERNAL_ERROR;
cli->timeout = 20000; /* Timeout is in milliseconds. */
- cli->max_xmit = CLI_BUFFER_SIZE+4;
cli->case_sensitive = false;
/* Set the CLI_FORCE_DOSERR environment variable to test
@@ -302,7 +301,10 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
cli->conn.smb1.client.capabilities |= CAP_LEVEL_II_OPLOCKS;
}
+ cli->conn.smb1.client.max_xmit = CLI_BUFFER_SIZE;
+
cli->conn.smb1.capabilities = cli->conn.smb1.client.capabilities;
+ cli->conn.smb1.max_xmit = 1024;
cli->conn.smb1.mid = 1;
@@ -548,7 +550,7 @@ uint32_t cli_state_capabilities(struct cli_state *cli)
uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs)
{
- uint32_t ret = cli->max_xmit;
+ uint32_t ret = cli->conn.smb1.max_xmit;
if (ofs >= ret) {
return 0;