1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

s3:smbd: move max_recv to struct smbd_server_connection

metze
This commit is contained in:
Stefan Metzmacher 2009-05-26 14:56:08 +02:00
parent e16e7146b3
commit d9843b3db4
5 changed files with 22 additions and 21 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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,

View File

@ -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);