summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/include/smb.h1
-rw-r--r--source3/smbd/blocking.c1
-rw-r--r--source3/smbd/files.c28
-rw-r--r--source3/smbd/process.c3
5 files changed, 12 insertions, 22 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index f8d6f10334..66eb1b0fac 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -9594,7 +9594,6 @@ void file_sync_all(connection_struct *conn);
void file_free(struct smb_request *req, files_struct *fsp);
files_struct *file_fnum(uint16 fnum);
files_struct *file_fsp(struct smb_request *req, uint16 fid);
-void file_chain_reset(void);
NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *fsp,
uint32 access_mask, uint32 share_access,
uint32 create_options, files_struct **result);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 6aca7526fd..fb79e91121 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -636,6 +636,7 @@ struct smb_request {
size_t unread_bytes;
bool encrypted;
connection_struct *conn;
+ struct files_struct *chain_fsp;
};
/* Defines for the sent_oplock_break field above. */
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index 479361a8c1..9b9aa1697e 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -704,7 +704,6 @@ static void process_blocking_lock_queue(void)
* sitting around....
*/
chain_size = 0;
- file_chain_reset();
fsp = blr->fsp;
conn = conn_find(SVAL(blr->inbuf,smb_tid));
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index d77ee76be7..4a27d02cfe 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -28,9 +28,6 @@ static int real_max_open_files;
static struct bitmap *file_bmap;
static files_struct *Files;
-
-/* a fsp to use when chaining */
-static files_struct *chain_fsp = NULL;
static int files_used;
@@ -121,7 +118,9 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
DEBUG(5,("allocated file structure %d, fnum = %d (%d used)\n",
i, fsp->fnum, files_used));
- chain_fsp = fsp;
+ if (req != NULL) {
+ req->chain_fsp = fsp;
+ }
/* A new fsp invalidates the positive and
negative fsp_fi_cache as the new fsp is pushed
@@ -430,8 +429,8 @@ void file_free(struct smb_request *req, files_struct *fsp)
information */
ZERO_STRUCTP(fsp);
- if (fsp == chain_fsp) {
- chain_fsp = NULL;
+ if ((req != NULL) && (fsp == req->chain_fsp)) {
+ req->chain_fsp = NULL;
}
/* Closing a file can invalidate the positive cache. */
@@ -475,27 +474,18 @@ files_struct *file_fsp(struct smb_request *req, uint16 fid)
{
files_struct *fsp;
- if (chain_fsp) {
- return chain_fsp;
+ if ((req != NULL) && (req->chain_fsp != NULL)) {
+ return req->chain_fsp;
}
fsp = file_fnum(fid);
- if (fsp) {
- chain_fsp = fsp;
+ if ((fsp != NULL) && (req != NULL)) {
+ req->chain_fsp = fsp;
}
return fsp;
}
/****************************************************************************
- Reset the chained fsp - done at the start of a packet reply.
-****************************************************************************/
-
-void file_chain_reset(void)
-{
- chain_fsp = NULL;
-}
-
-/****************************************************************************
Duplicate the file handle part for a DOS or FCB open.
****************************************************************************/
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 32629fd392..be45d7ad7c 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -376,6 +376,7 @@ void init_smb_request(struct smb_request *req,
req->unread_bytes = unread_bytes;
req->encrypted = encrypted;
req->conn = conn_find(req->tid);
+ req->chain_fsp = NULL;
/* Ensure we have at least wct words and 2 bytes of bcc. */
if (smb_size + req->wct*2 > req_size) {
@@ -1486,7 +1487,6 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool enc
struct smb_request *req;
chain_size = 0;
- file_chain_reset();
reset_chain_p();
if (!(req = talloc(talloc_tos(), struct smb_request))) {
@@ -1733,6 +1733,7 @@ void chain_reply(struct smb_request *req)
smb_panic("could not allocate smb_request");
}
init_smb_request(req2, (uint8 *)inbuf2,0, req->encrypted);
+ req2->chain_fsp = req->chain_fsp;
/* process the request */
switch_message(smb_com2, req2, new_size);