summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-01-30 23:44:21 +0100
committerVolker Lendecke <vl@samba.org>2009-01-31 11:09:39 +0100
commitd94e9c802ceddeff93168337b6fc5533db7f2d33 (patch)
treef38232bdd6402b386b2248793d99cc02eceb68e6 /source3/smbd
parentb99859b948f31dbe474b6ce0c6cab601e7e7bc56 (diff)
downloadsamba-d94e9c802ceddeff93168337b6fc5533db7f2d33.tar.gz
samba-d94e9c802ceddeff93168337b6fc5533db7f2d33.tar.bz2
samba-d94e9c802ceddeff93168337b6fc5533db7f2d33.zip
Remove the global variable "chain_size"
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/aio.c6
-rw-r--r--source3/smbd/blocking.c7
-rw-r--r--source3/smbd/process.c26
-rw-r--r--source3/smbd/reply.c7
4 files changed, 31 insertions, 15 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 4ce43c95e8..64d512d675 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -141,8 +141,7 @@ bool schedule_aio_read_and_X(connection_struct *conn,
/* Only do this on non-chained and non-chaining reads not using the
* write cache. */
- if (chain_size !=0 || (CVAL(req->vwv+0, 0) != 0xFF)
- || (lp_write_cache_size(SNUM(conn)) != 0) ) {
+ if (req_is_in_chain(req) || (lp_write_cache_size(SNUM(conn)) != 0)) {
return False;
}
@@ -238,8 +237,7 @@ bool schedule_aio_write_and_X(connection_struct *conn,
/* Only do this on non-chained and non-chaining reads not using the
* write cache. */
- if (chain_size !=0 || (CVAL(req->vwv+0, 0) != 0xFF)
- || (lp_write_cache_size(SNUM(conn)) != 0) ) {
+ if (req_is_in_chain(req) || (lp_write_cache_size(SNUM(conn)) != 0)) {
return False;
}
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index 9936fb219f..ac1ff00858 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -47,11 +47,6 @@ typedef struct blocking_lock_record {
Determine if this is a secondary element of a chained SMB.
**************************************************************************/
-static bool in_chained_smb(void)
-{
- return (chain_size != 0);
-}
-
static void received_unlock_msg(struct messaging_context *msg,
void *private_data,
uint32_t msg_type,
@@ -144,7 +139,7 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
blocking_lock_record *blr;
NTSTATUS status;
- if(in_chained_smb() ) {
+ if(req_is_in_chain(req)) {
DEBUG(0,("push_blocking_lock_request: cannot queue a chained request (currently).\n"));
return False;
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index d617ef1915..c9fc1fbb6a 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1359,8 +1359,6 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool enc
connection_struct *conn;
struct smb_request *req;
- chain_size = 0;
-
if (!(req = talloc(talloc_tos(), struct smb_request))) {
smb_panic("could not allocate smb_request");
}
@@ -2114,3 +2112,27 @@ void smbd_process(void)
exit_server_cleanly(NULL);
}
+
+bool req_is_in_chain(struct smb_request *req)
+{
+ if (req->vwv != (uint16_t *)(req->inbuf+smb_vwv)) {
+ /*
+ * We're right now handling a subsequent request, so we must
+ * be in a chain
+ */
+ return true;
+ }
+
+ if (!is_andx_req(req->cmd)) {
+ return false;
+ }
+
+ if (req->wct < 2) {
+ /*
+ * Okay, an illegal request, but definitely not chained :-)
+ */
+ return false;
+ }
+
+ return (CVAL(req->vwv+0, 0) != 0xFF);
+}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 25d50470ff..eeb6692eb5 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2729,6 +2729,7 @@ static void reply_readbraw_error(void)
****************************************************************************/
void send_file_readbraw(connection_struct *conn,
+ struct smb_request *req,
files_struct *fsp,
SMB_OFF_T startpos,
size_t nread,
@@ -2745,7 +2746,7 @@ void send_file_readbraw(connection_struct *conn,
* reply_readbraw has already checked the length.
*/
- if ( (chain_size == 0) && (nread > 0) && (fsp->base_fsp == NULL) &&
+ if ( !req_is_in_chain(req) && (nread > 0) && (fsp->base_fsp == NULL) &&
(fsp->wcp == NULL) && lp_use_sendfile(SNUM(conn)) ) {
ssize_t sendfile_read = -1;
char header[4];
@@ -2963,7 +2964,7 @@ void reply_readbraw(struct smb_request *req)
(unsigned long)mincount,
(unsigned long)nread ) );
- send_file_readbraw(conn, fsp, startpos, nread, mincount);
+ send_file_readbraw(conn, req, fsp, startpos, nread, mincount);
DEBUG(5,("reply_readbraw finished\n"));
END_PROFILE(SMBreadbraw);
@@ -3229,7 +3230,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
* on a train in Germany :-). JRA.
*/
- if ((chain_size == 0) && (CVAL(req->vwv+0, 0) == 0xFF) &&
+ if (!req_is_in_chain(req) &&
!is_encrypted_packet(req->inbuf) && (fsp->base_fsp == NULL) &&
lp_use_sendfile(SNUM(conn)) && (fsp->wcp == NULL) ) {
uint8 headerbuf[smb_size + 12 * 2];