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);
size_t unread_bytes;
bool encrypted;
connection_struct *conn;
+ struct files_struct *chain_fsp;
};
/* Defines for the sent_oplock_break field above. */
* sitting around....
*/
chain_size = 0;
- file_chain_reset();
fsp = blr->fsp;
conn = conn_find(SVAL(blr->inbuf,smb_tid));
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;
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
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. */
{
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.
****************************************************************************/
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) {
struct smb_request *req;
chain_size = 0;
- file_chain_reset();
reset_chain_p();
if (!(req = talloc(talloc_tos(), struct smb_request))) {
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);