summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-05-26 14:56:08 +0200
committerStefan Metzmacher <metze@samba.org>2009-06-03 17:54:37 +0200
commitd9843b3db4ba6961ba1af01f8393b7e744df5927 (patch)
treea3f03fdc32668b37c0c409fd630653fa03605f9c /source3/smbd
parente16e7146b378e8e89bf25adc66d806bac7feaeb6 (diff)
downloadsamba-d9843b3db4ba6961ba1af01f8393b7e744df5927.tar.gz
samba-d9843b3db4ba6961ba1af01f8393b7e744df5927.tar.bz2
samba-d9843b3db4ba6961ba1af01f8393b7e744df5927.zip
s3:smbd: move max_recv to struct smbd_server_connection
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/globals.c5
-rw-r--r--source3/smbd/globals.h10
-rw-r--r--source3/smbd/negprot.c7
-rw-r--r--source3/smbd/process.c2
-rw-r--r--source3/smbd/reply.c19
5 files changed, 22 insertions, 21 deletions
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 8126989bbf..6c34f9d44b 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -115,11 +115,6 @@ bool already_got_session = false;
* Set by us for CORE protocol.
*/
int max_send = BUFFER_SIZE;
-/*
- * Size of the data we can receive. Set by us.
- * Can be modified by the max xmit parameter.
- */
-int max_recv = BUFFER_SIZE;
uint16 last_session_tag = UID_FIELD_INVALID;
int trans_num = 0;
pid_t mypid = 0;
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 46c52fea12..e8f26a98d0 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -113,11 +113,6 @@ extern bool already_got_session;
* Set by us for CORE protocol.
*/
extern int max_send;
-/*
- * Size of the data we can receive. Set by us.
- * Can be modified by the max xmit parameter.
- */
-extern int max_recv;
extern uint16 last_session_tag;
extern int trans_num;
@@ -330,6 +325,11 @@ struct smbd_server_connection {
bool spnego;
struct auth_context *auth_context;
bool done;
+ /*
+ * Size of the data we can receive. Set by us.
+ * Can be modified by the max xmit parameter.
+ */
+ int max_recv;
} negprot;
struct smb_signing_state *signing_state;
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index 4e14ee8aad..85dc32447d 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -117,7 +117,7 @@ static void reply_lanman1(struct smb_request *req, uint16 choice)
/* Reply, SMBlockread, SMBwritelock supported. */
SCVAL(req->outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
- SSVAL(req->outbuf,smb_vwv2,max_recv);
+ SSVAL(req->outbuf,smb_vwv2,sconn->smb1.negprot.max_recv);
SSVAL(req->outbuf,smb_vwv3,lp_maxmux()); /* maxmux */
SSVAL(req->outbuf,smb_vwv4,1);
SSVAL(req->outbuf,smb_vwv5,raw); /* tell redirector we support
@@ -166,7 +166,7 @@ static void reply_lanman2(struct smb_request *req, uint16 choice)
/* Reply, SMBlockread, SMBwritelock supported. */
SCVAL(req->outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
- SSVAL(req->outbuf,smb_vwv2,max_recv);
+ SSVAL(req->outbuf,smb_vwv2,sconn->smb1.negprot.max_recv);
SSVAL(req->outbuf,smb_vwv3,lp_maxmux());
SSVAL(req->outbuf,smb_vwv4,1);
SSVAL(req->outbuf,smb_vwv5,raw); /* readbraw and/or writebraw */
@@ -348,7 +348,8 @@ static void reply_nt1(struct smb_request *req, uint16 choice)
SSVAL(req->outbuf,smb_vwv1+1,lp_maxmux()); /* maxmpx */
SSVAL(req->outbuf,smb_vwv2+1,1); /* num vcs */
- SIVAL(req->outbuf,smb_vwv3+1,max_recv); /* max buffer. LOTS! */
+ SIVAL(req->outbuf,smb_vwv3+1,
+ sconn->smb1.negprot.max_recv); /* max buffer. LOTS! */
SIVAL(req->outbuf,smb_vwv5+1,0x10000); /* raw size. full 64k */
SIVAL(req->outbuf,smb_vwv7+1,sys_getpid()); /* session key */
SIVAL(req->outbuf,smb_vwv9+1,capabilities); /* capabilities */
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index f63e36a62b..4c33257b9d 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2157,7 +2157,7 @@ void smbd_process(void)
#endif
- max_recv = MIN(lp_maxxmit(),BUFFER_SIZE);
+ smbd_server_conn->smb1.negprot.max_recv = MIN(lp_maxxmit(),BUFFER_SIZE);
smbd_server_conn->smb1.fde = event_add_fd(smbd_event_context(),
smbd_server_conn,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index f6d5f11f13..16fc61955d 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -611,6 +611,7 @@ void reply_tcon(struct smb_request *req)
const char *p;
DATA_BLOB password_blob;
TALLOC_CTX *ctx = talloc_tos();
+ struct smbd_server_connection *sconn = smbd_server_conn;
START_PROFILE(SMBtcon);
@@ -654,7 +655,7 @@ void reply_tcon(struct smb_request *req)
}
reply_outbuf(req, 2, 0);
- SSVAL(req->outbuf,smb_vwv0,max_recv);
+ SSVAL(req->outbuf,smb_vwv0,sconn->smb1.negprot.max_recv);
SSVAL(req->outbuf,smb_vwv1,conn->cnum);
SSVAL(req->outbuf,smb_tid,conn->cnum);
@@ -3154,6 +3155,7 @@ void reply_lockread(struct smb_request *req)
files_struct *fsp;
struct byte_range_lock *br_lck = NULL;
char *p = NULL;
+ struct smbd_server_connection *sconn = smbd_server_conn;
START_PROFILE(SMBlockread);
@@ -3216,11 +3218,12 @@ void reply_lockread(struct smb_request *req)
* However the requested READ size IS affected by max_recv. Insanity.... JRA.
*/
- if (numtoread > max_recv) {
+ if (numtoread > sconn->smb1.negprot.max_recv) {
DEBUG(0,("reply_lockread: requested read size (%u) is greater than maximum allowed (%u). \
Returning short read of maximum allowed for compatibility with Windows 2000.\n",
- (unsigned int)numtoread, (unsigned int)max_recv ));
- numtoread = MIN(numtoread,max_recv);
+ (unsigned int)numtoread,
+ (unsigned int)sconn->smb1.negprot.max_recv));
+ numtoread = MIN(numtoread, sconn->smb1.negprot.max_recv);
}
nread = read_file(fsp,data,startpos,numtoread);
@@ -3262,6 +3265,7 @@ void reply_read(struct smb_request *req)
int outsize = 0;
files_struct *fsp;
struct lock_struct lock;
+ struct smbd_server_connection *sconn = smbd_server_conn;
START_PROFILE(SMBread);
@@ -3292,11 +3296,12 @@ void reply_read(struct smb_request *req)
/*
* The requested read size cannot be greater than max_recv. JRA.
*/
- if (numtoread > max_recv) {
+ if (numtoread > sconn->smb1.negprot.max_recv) {
DEBUG(0,("reply_read: requested read size (%u) is greater than maximum allowed (%u). \
Returning short read of maximum allowed for compatibility with Windows 2000.\n",
- (unsigned int)numtoread, (unsigned int)max_recv ));
- numtoread = MIN(numtoread,max_recv);
+ (unsigned int)numtoread,
+ (unsigned int)sconn->smb1.negprot.max_recv));
+ numtoread = MIN(numtoread, sconn->smb1.negprot.max_recv);
}
reply_outbuf(req, 5, numtoread+3);