diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-05-26 15:21:16 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-06-03 17:54:37 +0200 |
commit | 356f0336e558465318450da8936ebfef3f1f4eb1 (patch) | |
tree | ccdbba254bf1ab69ac0463df2b5db675d5ee8a45 /source3/smbd | |
parent | f554af187161a006c3f51edd129e53500acc9046 (diff) | |
download | samba-356f0336e558465318450da8936ebfef3f1f4eb1.tar.gz samba-356f0336e558465318450da8936ebfef3f1f4eb1.tar.bz2 samba-356f0336e558465318450da8936ebfef3f1f4eb1.zip |
s3:smbd: move some session specific globals to struct smbd_server_connection
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/globals.c | 8 | ||||
-rw-r--r-- | source3/smbd/globals.h | 18 | ||||
-rw-r--r-- | source3/smbd/ipc.c | 2 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 2 | ||||
-rw-r--r-- | source3/smbd/process.c | 9 | ||||
-rw-r--r-- | source3/smbd/reply.c | 1 | ||||
-rw-r--r-- | source3/smbd/sesssetup.c | 9 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 2 |
8 files changed, 29 insertions, 22 deletions
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c index bcf01069bc..352fe3571a 100644 --- a/source3/smbd/globals.c +++ b/source3/smbd/globals.c @@ -107,13 +107,6 @@ int num_validated_vuids = 0; char *my_yp_domain = NULL; #endif -/* - * Size of data we can send to client. Set - * by the client for all protocols above CORE. - * Set by us for CORE protocol. - */ -int max_send = BUFFER_SIZE; -uint16 last_session_tag = UID_FIELD_INVALID; int trans_num = 0; pid_t mypid = 0; time_t last_smb_conf_reload_time = 0; @@ -141,7 +134,6 @@ uint16_t last_flags = 0; struct db_context *session_db_ctx_ptr = NULL; uint32_t global_client_caps = 0; -bool done_sesssetup = false; uint16_t fnf_handle = 257; diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 2b4dce7489..c538ecf64f 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -105,13 +105,6 @@ extern int num_validated_vuids; extern char *my_yp_domain; #endif -/* - * Size of data we can send to client. Set - * by the client for all protocols above CORE. - * Set by us for CORE protocol. - */ -extern int max_send; -extern uint16 last_session_tag; extern int trans_num; extern pid_t mypid; @@ -146,7 +139,6 @@ extern uint16_t last_flags; extern struct db_context *session_db_ctx_ptr; extern uint32_t global_client_caps; -extern bool done_sesssetup; extern uint16_t fnf_handle; @@ -333,6 +325,16 @@ struct smbd_server_connection { int max_recv; } negprot; + struct { + bool done_sesssetup; + /* + * Size of data we can send to client. Set + * by the client for all protocols above CORE. + * Set by us for CORE protocol. + */ + int max_send; + uint16_t last_session_tag; + } sessions; struct smb_signing_state *signing_state; /* List to store partial SPNEGO auth fragments. */ struct pending_auth_data *pd_list; diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 2d5713590d..a93fdd5ae0 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -93,6 +93,8 @@ void send_trans_reply(connection_struct *conn, int ldata = rdata ? rdata_len : 0; int lparam = rparam ? rparam_len : 0; + struct smbd_server_connection *sconn = smbd_server_conn; + int max_send = sconn->smb1.sessions.max_send; if (buffer_too_large) DEBUG(5,("send_trans_reply: buffer %d too large\n", ldata )); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index d6be35d29b..4c216cc6be 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -58,6 +58,8 @@ void send_nt_replies(connection_struct *conn, int params_sent_thistime, data_sent_thistime, total_sent_thistime; int alignment_offset = 3; int data_alignment_offset = 0; + struct smbd_server_connection *sconn = smbd_server_conn; + int max_send = sconn->smb1.sessions.max_send; /* * If there genuinely are no parameters or data to send just send diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 3bf0566097..f66f114c7b 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1226,6 +1226,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in int flags; uint16 session_tag; connection_struct *conn = NULL; + struct smbd_server_connection *sconn = smbd_server_conn; errno = 0; @@ -1269,10 +1270,10 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in * JRA. */ - if (session_tag != last_session_tag) { + if (session_tag != sconn->smb1.sessions.last_session_tag) { user_struct *vuser = NULL; - last_session_tag = session_tag; + sconn->smb1.sessions.last_session_tag = session_tag; if(session_tag != UID_FIELD_INVALID) { vuser = get_valid_user_struct(session_tag); if (vuser) { @@ -2161,6 +2162,10 @@ void smbd_process(void) smbd_server_conn->smb1.negprot.max_recv = MIN(lp_maxxmit(),BUFFER_SIZE); + smbd_server_conn->smb1.sessions.done_sesssetup = false; + smbd_server_conn->smb1.sessions.max_send = BUFFER_SIZE; + smbd_server_conn->smb1.sessions.last_session_tag = UID_FIELD_INVALID; + smbd_server_conn->smb1.fde = event_add_fd(smbd_event_context(), smbd_server_conn, smbd_server_fd(), diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index f71fde1818..f93386a1e5 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -506,6 +506,7 @@ void reply_special(char *inbuf) int msg_flags = CVAL(inbuf,1); fstring name1,name2; char name_type1, name_type2; + struct smbd_server_connection *sconn = smbd_server_conn; /* * We only really use 4 bytes of the outbuf, but for the smb_setlen diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index 8a517994cc..be88330344 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -1803,10 +1803,11 @@ void reply_sesssetup_and_X(struct smb_request *req) SSVAL(req->outbuf,smb_uid,sess_vuid); SSVAL(req->inbuf,smb_uid,sess_vuid); - if (!done_sesssetup) - max_send = MIN(max_send,smb_bufsize); - - done_sesssetup = True; + if (!sconn->smb1.sessions.done_sesssetup) { + sconn->smb1.sessions.max_send = + MIN(sconn->smb1.sessions.max_send,smb_bufsize); + } + sconn->smb1.sessions.done_sesssetup = true; END_PROFILE(SMBsesssetupX); chain_reply(req); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index d11bf088e0..a8120d42fb 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -682,6 +682,8 @@ void send_trans2_replies(connection_struct *conn, int alignment_offset = 1; /* JRA. This used to be 3. Set to 1 to make netmon parse ok. */ int data_alignment_offset = 0; bool overflow = False; + struct smbd_server_connection *sconn = smbd_server_conn; + int max_send = sconn->smb1.sessions.max_send; /* Modify the data_to_send and datasize and set the error if we're trying to send more than max_data_bytes. We still send |