summaryrefslogtreecommitdiff
path: root/source3/smbd/files.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/files.c')
-rw-r--r--source3/smbd/files.c28
1 files changed, 9 insertions, 19 deletions
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.
****************************************************************************/