summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-08-17 03:52:05 +0000
committerAndrew Tridgell <tridge@samba.org>1998-08-17 03:52:05 +0000
commit8978aae69699ccab76fdf95037948b1cc7e7c286 (patch)
tree19d2fdbc1da4d4353d226a81960f500ac06c0359 /source3
parentf2d538a105a61ce6d2852700fc328e15ac158827 (diff)
downloadsamba-8978aae69699ccab76fdf95037948b1cc7e7c286.tar.gz
samba-8978aae69699ccab76fdf95037948b1cc7e7c286.tar.bz2
samba-8978aae69699ccab76fdf95037948b1cc7e7c286.zip
much cleaner chain pointer handling for both files and pipes.
the chain pointer is now stored as a static and is set whenever a handle is created or extracted. This also makes the code less error prone. (This used to be commit 068a862982bea726e8d7b1b4065d510b9840a272)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h6
-rw-r--r--source3/include/smb.h5
-rw-r--r--source3/libsmb/nmblib.c2
-rw-r--r--source3/locking/locking.c13
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c15
-rw-r--r--source3/smbd/files.c55
-rw-r--r--source3/smbd/nttrans.c7
-rw-r--r--source3/smbd/pipes.c2
-rw-r--r--source3/smbd/reply.c53
-rw-r--r--source3/smbd/server.c5
-rw-r--r--source3/smbd/trans2.c5
11 files changed, 81 insertions, 87 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index cda824c7d0..e00ddbb79d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1857,10 +1857,9 @@ BOOL api_netlog_rpc(pipes_struct *p, prs_struct *data);
/*The following definitions come from rpc_server/srv_pipe_hnd.c */
void reset_chain_p(void);
-void set_chain_p(pipes_struct *new_p);
void init_rpc_pipe_hnd(void);
pipes_struct *open_rpc_pipe_p(char *pipe_name,
- connection_struct *conn, uint16 vuid);
+ connection_struct *conn, uint16 vuid);
int read_pipe(pipes_struct *p, char *data, uint32 pos, int n);
char *get_rpc_pipe_hnd_name(pipes_struct *p);
BOOL set_rpc_pipe_hnd_state(pipes_struct *p, uint16 device_state);
@@ -1957,12 +1956,13 @@ file_fd_struct *fd_get_already_open(struct stat *sbuf);
file_fd_struct *fd_get_new(void);
void file_close_conn(connection_struct *conn);
void file_init(void);
-files_struct *file_fsp(int fnum);
void file_close_user(int vuid);
files_struct *file_find_dit(int dev, int inode, struct timeval *tval);
files_struct *file_find_print(void);
void file_sync_all(connection_struct *conn);
void file_free(files_struct *fsp);
+files_struct *file_fsp(char *buf, int where);
+void file_chain_reset(void);
/*The following definitions come from smbd/groupname.c */
diff --git a/source3/include/smb.h b/source3/include/smb.h
index e99eb30023..2f2363ba71 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -602,11 +602,6 @@ typedef struct files_struct
char *fsp_name;
} files_struct;
-/* this macro should always be used to extract an fnum (smb_fid) from
- a packet to ensure chaining works correctly */
-#define GETFSP(buf,where) (chain_fsp?chain_fsp:file_fsp(SVAL(buf,where)))
-
-
/* Domain controller authentication protocol info */
struct dcinfo
{
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index c887ff55de..9390302ab2 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -26,8 +26,6 @@ extern int DEBUGLEVEL;
int num_good_sends = 0;
int num_good_receives = 0;
-extern pstring scope;
-extern struct in_addr ipzero;
static struct opcode_names {
char *nmb_opcode_name;
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index cdaeea6d7e..8737a12e17 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -61,7 +61,7 @@ static ubi_slList blocking_lock_queue = { NULL, (ubi_slNodePtr)&blocking_lock_qu
BOOL push_blocking_lock_request( char *inbuf, int length, int lock_timeout, int lock_num)
{
blocking_lock_record *blr;
- files_struct *fsp = GETFSP(inbuf,smb_vwv2);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv2);
/*
* Now queue an entry on the blocking lock queue. We setup
@@ -98,12 +98,11 @@ for fnum = %d, name = %s\n", blr->expire_time, fsp->fnum, fsp->name ));
static void blocking_lock_reply_success(blocking_lock_record *blr)
{
extern int chain_size;
- extern files_struct *chain_fsp;
extern char *OutBuffer;
char *outbuf = OutBuffer;
int bufsize = BUFFER_SIZE;
char *inbuf = blr->inbuf;
- files_struct *fsp = GETFSP(inbuf,smb_vwv2);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv2);
int outsize = 0;
construct_reply_common(inbuf, outbuf);
@@ -117,7 +116,7 @@ static void blocking_lock_reply_success(blocking_lock_record *blr)
* that here and must set up the chain info manually.
*/
- chain_fsp = fsp;
+ file_set_chain(fsp);
chain_size = 0;
outsize = chain_reply(inbuf,outbuf,blr->length,bufsize);
@@ -140,7 +139,7 @@ static void blocking_lock_reply_error(blocking_lock_record *blr, int eclass, int
char *outbuf = OutBuffer;
int bufsize = BUFFER_SIZE;
char *inbuf = blr->inbuf;
- files_struct *fsp = GETFSP(inbuf,smb_vwv2);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv2);
uint16 num_ulocks = SVAL(inbuf,smb_vwv6);
uint16 num_locks = SVAL(inbuf,smb_vwv7);
uint32 count, offset;
@@ -175,7 +174,7 @@ static BOOL blocking_lock_record_process(blocking_lock_record *blr)
{
char *inbuf = blr->inbuf;
unsigned char locktype = CVAL(inbuf,smb_vwv3);
- files_struct *fsp = GETFSP(inbuf,smb_vwv2);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv2);
uint16 num_ulocks = SVAL(inbuf,smb_vwv6);
uint16 num_locks = SVAL(inbuf,smb_vwv7);
uint32 count, offset;
@@ -250,7 +249,7 @@ void process_blocking_lock_queue(time_t t)
*/
while(blr != NULL) {
- files_struct *fsp = GETFSP(blr->inbuf,smb_vwv2);
+ files_struct *fsp = file_fsp(blr->inbuf,smb_vwv2);
uint16 vuid = (lp_security() == SEC_SHARE) ? UID_FIELD_INVALID :
SVAL(blr->inbuf,smb_uid);
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index dfc4eeba5f..368bf013a0 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -51,14 +51,6 @@ void reset_chain_p(void)
}
/****************************************************************************
- sets chain pipe-file handle
-****************************************************************************/
-void set_chain_p(pipes_struct *new_p)
-{
- chain_p = new_p;
-}
-
-/****************************************************************************
initialise pipe handle states...
****************************************************************************/
void init_rpc_pipe_hnd(void)
@@ -136,7 +128,7 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
DEBUG(4,("Opened pipe %s with handle %x (pipes_open=%d)\n",
pipe_name, i, pipes_open));
- set_chain_p(p);
+ chain_p = p;
return p;
}
@@ -335,7 +327,10 @@ pipes_struct *get_rpc_pipe(int pnum)
pipes_struct *p;
for (p=Pipes;p;p=p->next) {
- if (p->pnum == pnum) return p;
+ if (p->pnum == pnum) {
+ chain_p = p;
+ return p;
+ }
}
return NULL;
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index bc3ea880bf..e66e53e6ed 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -35,6 +35,10 @@ static struct bitmap *fd_bmap;
static files_struct *Files;
+/* a fsp to use when chaining */
+static files_struct *chain_fsp = NULL;
+
+
/*
* Indirection for file fd's. Needed as POSIX locking
* is based on file/process, not fd/process.
@@ -106,6 +110,8 @@ files_struct *file_new(void )
DEBUG(5,("allocated file structure %d (%d used)\n",
i, files_used));
+
+ chain_fsp = fsp;
return fsp;
}
@@ -238,21 +244,6 @@ void file_init(void)
/****************************************************************************
-find a fsp given a fnum
-****************************************************************************/
-files_struct *file_fsp(int fnum)
-{
- files_struct *fsp;
-
- for (fsp=Files;fsp;fsp=fsp->next) {
- if (fsp->fnum == fnum) return fsp;
- }
-
- return NULL;
-}
-
-
-/****************************************************************************
close files open by a specified vuid
****************************************************************************/
void file_close_user(int vuid)
@@ -375,5 +366,39 @@ void file_free(files_struct *fsp)
information */
memset(fsp, 0, sizeof(*fsp));
+ if (fsp == chain_fsp) chain_fsp = NULL;
+
free(fsp);
}
+
+
+/****************************************************************************
+get a fsp from a packet given the offset of a 16 bit fnum
+****************************************************************************/
+files_struct *file_fsp(char *buf, int where)
+{
+ int fnum;
+ files_struct *fsp;
+
+ if (chain_fsp) return chain_fsp;
+
+ fnum = SVAL(buf, where);
+
+ for (fsp=Files;fsp;fsp=fsp->next) {
+ if (fsp->fnum == fnum) {
+ chain_fsp = fsp;
+ return fsp;
+ }
+ }
+
+ return NULL;
+}
+
+
+/****************************************************************************
+reset the chained fsp - done at the start of a packet reply
+****************************************************************************/
+void file_chain_reset(void)
+{
+ chain_fsp = NULL;
+}
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 31bfac25c8..89efd7ccd7 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -24,7 +24,6 @@
extern int DEBUGLEVEL;
extern int Protocol;
-extern files_struct *chain_fsp;
extern int Client;
extern int oplock_sock;
extern int smb_read_error;
@@ -665,8 +664,6 @@ int reply_ntcreate_and_X(connection_struct *conn,
SCVAL(p,0,fsp->is_directory ? 1 : 0);
}
- chain_fsp = fsp;
-
DEBUG(5,("reply_ntcreate_and_X: open name = %s\n",
fsp?fsp->fsp_name:"NULL"));
@@ -941,7 +938,7 @@ static int call_nt_transact_rename(connection_struct *conn,
{
char *params = *ppparams;
pstring new_name;
- files_struct *fsp = GETFSP(params, 0);
+ files_struct *fsp = file_fsp(params, 0);
BOOL replace_if_exists = (SVAL(params,2) & RENAME_REPLACE_IF_EXISTS) ? True : False;
uint32 fname_len = MIN((((uint32)IVAL(inbuf,smb_nt_TotalParameterCount)-4)),
((uint32)sizeof(new_name)-1));
@@ -1166,7 +1163,7 @@ static int call_nt_transact_notify_change(connection_struct *conn,
change_notify_buf *cnbp;
struct stat st;
- fsp = GETFSP(setup,4);
+ fsp = file_fsp(setup,4);
DEBUG(3,("call_nt_transact_notify_change\n"));
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index 84e31894a3..fed5c2bd17 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -138,8 +138,6 @@ int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize)
DEBUG(3,("readX pnum=%04x min=%d max=%d nread=%d\n",
p->pnum, smb_mincnt, smb_maxcnt, nread));
- set_chain_p(p);
-
return chain_reply(inbuf,outbuf,length,bufsize);
}
/****************************************************************************
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index e62c0bd576..6b91d9d152 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -33,7 +33,6 @@ extern int Protocol;
extern int DEBUGLEVEL;
extern int max_send;
extern int max_recv;
-extern files_struct *chain_fsp;
extern char magic_char;
extern BOOL case_sensitive;
extern BOOL case_preserve;
@@ -1425,8 +1424,6 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
SSVAL(outbuf,smb_vwv8,rmode);
SSVAL(outbuf,smb_vwv11,smb_action);
- chain_fsp = fsp;
-
return chain_reply(inbuf,outbuf,length,bufsize);
}
@@ -1773,7 +1770,7 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
return -1;
}
- fsp = GETFSP(inbuf,smb_vwv0);
+ fsp = file_fsp(inbuf,smb_vwv0);
startpos = IVAL(inbuf,smb_vwv1);
maxcount = SVAL(inbuf,smb_vwv3);
@@ -1862,7 +1859,7 @@ int reply_lockread(connection_struct *conn, char *inbuf,char *outbuf, int dum_si
uint32 startpos, numtoread;
int eclass;
uint32 ecode;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_READ(fsp);
@@ -1905,7 +1902,7 @@ int reply_read(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
char *data;
uint32 startpos;
int outsize = 0;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_READ(fsp);
@@ -1945,7 +1942,7 @@ int reply_read(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
****************************************************************************/
int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int length,int bufsize)
{
- files_struct *fsp = GETFSP(inbuf,smb_vwv2);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv2);
uint32 smb_offs = IVAL(inbuf,smb_vwv3);
int smb_maxcnt = SVAL(inbuf,smb_vwv5);
int smb_mincnt = SVAL(inbuf,smb_vwv6);
@@ -1979,8 +1976,6 @@ int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
DEBUG( 3, ( "readX fnum=%d min=%d max=%d nread=%d\n",
fsp->fnum, smb_mincnt, smb_maxcnt, nread ) );
- chain_fsp = fsp;
-
return chain_reply(inbuf,outbuf,length,bufsize);
}
@@ -1998,7 +1993,7 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int dum_s
char *data=NULL;
BOOL write_through;
int tcount;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_WRITE(fsp);
@@ -2100,7 +2095,7 @@ int reply_writeunlock(connection_struct *conn, char *inbuf,char *outbuf, int dum
uint32 numtowrite,startpos;
int eclass;
uint32 ecode;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_WRITE(fsp);
@@ -2153,7 +2148,7 @@ int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int dum_size,i
int outsize = 0;
int startpos;
char *data;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_WRITE(fsp);
@@ -2203,7 +2198,7 @@ int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int dum_size,i
****************************************************************************/
int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int length,int bufsize)
{
- files_struct *fsp = GETFSP(inbuf,smb_vwv2);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv2);
uint32 smb_offs = IVAL(inbuf,smb_vwv3);
int smb_dsize = SVAL(inbuf,smb_vwv10);
int smb_doff = SVAL(inbuf,smb_vwv11);
@@ -2246,8 +2241,6 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng
DEBUG(3,("writeX fnum=%d num=%d wrote=%d\n",
fsp->fnum, smb_dsize, nwritten));
- chain_fsp = fsp;
-
if (lp_syncalways(SNUM(conn)) || write_through)
sync_file(conn,fsp);
@@ -2264,7 +2257,7 @@ int reply_lseek(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
int32 res= -1;
int mode,umode;
int outsize = 0;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_ERROR(fsp);
@@ -2300,7 +2293,7 @@ int reply_lseek(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
int reply_flush(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
int outsize = set_message(outbuf,0,0,True);
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
if (fsp) {
CHECK_FSP(fsp,conn);
@@ -2349,7 +2342,7 @@ int reply_close(connection_struct *conn,
return reply_pipe_close(conn, inbuf,outbuf);
}
- fsp = GETFSP(inbuf,smb_vwv0);
+ fsp = file_fsp(inbuf,smb_vwv0);
/*
* We can only use CHECK_FSP if we know it's not a directory.
@@ -2406,7 +2399,7 @@ int reply_writeclose(connection_struct *conn,
int startpos;
char *data;
time_t mtime;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_WRITE(fsp);
@@ -2452,7 +2445,7 @@ int reply_lock(connection_struct *conn,
uint32 count,offset;
int eclass;
uint32 ecode;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_ERROR(fsp);
@@ -2479,7 +2472,7 @@ int reply_unlock(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
uint32 count,offset;
int eclass;
uint32 ecode;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_ERROR(fsp);
@@ -2629,7 +2622,7 @@ int reply_printclose(connection_struct *conn,
char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
int outsize = set_message(outbuf,0,0,True);
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_ERROR(fsp);
@@ -2724,7 +2717,7 @@ int reply_printwrite(connection_struct *conn, char *inbuf,char *outbuf, int dum_
int numtowrite;
int outsize = set_message(outbuf,0,0,True);
char *data;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
if (!CAN_PRINT(conn))
return(ERROR(ERRDOS,ERRnoaccess));
@@ -3490,7 +3483,7 @@ int reply_setdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
****************************************************************************/
int reply_lockingX(connection_struct *conn, char *inbuf,char *outbuf,int length,int bufsize)
{
- files_struct *fsp = GETFSP(inbuf,smb_vwv2);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv2);
unsigned char locktype = CVAL(inbuf,smb_vwv3);
#if 0
unsigned char oplocklevel = CVAL(inbuf,smb_vwv3+1);
@@ -3606,8 +3599,6 @@ dev = %x, inode = %x\n",
DEBUG( 3, ( "lockingX fnum=%d type=%d num_locks=%d num_ulocks=%d\n",
fsp->fnum, (unsigned int)locktype, num_locks, num_ulocks ) );
- chain_fsp = fsp;
-
return chain_reply(inbuf,outbuf,length,bufsize);
}
@@ -3625,7 +3616,7 @@ int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length,
int max_per_packet;
int tcount;
int pad;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
/* this function doesn't seem to work - disable by default */
if (!lp_readbmpx())
@@ -3692,7 +3683,7 @@ int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int dum_s
uint32 startpos;
int tcount, write_through, smb_doff;
char *data;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_WRITE(fsp);
@@ -3785,7 +3776,7 @@ int reply_writebs(connection_struct *conn, char *inbuf,char *outbuf, int dum_siz
char *data;
write_bmpx_struct *wbms;
BOOL send_response = False;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
CHECK_FSP(fsp,conn);
CHECK_WRITE(fsp);
@@ -3859,7 +3850,7 @@ int reply_setattrE(connection_struct *conn, char *inbuf,char *outbuf, int dum_si
{
struct utimbuf unix_times;
int outsize = 0;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
outsize = set_message(outbuf,0,0,True);
@@ -3912,7 +3903,7 @@ int reply_getattrE(connection_struct *conn, char *inbuf,char *outbuf, int dum_si
struct stat sbuf;
int outsize = 0;
int mode;
- files_struct *fsp = GETFSP(inbuf,smb_vwv0);
+ files_struct *fsp = file_fsp(inbuf,smb_vwv0);
outsize = set_message(outbuf,11,0,True);
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index e6117000a4..f160b590dc 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -81,9 +81,6 @@ int max_send = BUFFER_SIZE;
*/
int max_recv = BUFFER_SIZE;
-/* a fsp to use when chaining */
-files_struct *chain_fsp = NULL;
-
/* number of open connections */
static int num_connections_open = 0;
@@ -4699,7 +4696,7 @@ int construct_reply(char *inbuf,char *outbuf,int size,int bufsize)
smb_last_time = time(NULL);
chain_size = 0;
- chain_fsp = NULL;
+ file_chain_reset();
reset_chain_p();
if (msg_type != 0)
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 72ad7ec12b..2789282771 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -32,7 +32,6 @@ extern int oplock_sock;
extern int smb_read_error;
extern fstring local_machine;
extern int global_oplock_break;
-extern files_struct *chain_fsp;
/****************************************************************************
Send the required number of replies back.
@@ -1209,7 +1208,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
BOOL bad_path = False;
if (tran_call == TRANSACT2_QFILEINFO) {
- files_struct *fsp = GETFSP(params,0);
+ files_struct *fsp = file_fsp(params,0);
info_level = SVAL(params,2);
CHECK_FSP(fsp,conn);
@@ -1434,7 +1433,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
return(ERROR(ERRSRV,ERRaccess));
if (tran_call == TRANSACT2_SETFILEINFO) {
- files_struct *fsp = GETFSP(params,0);
+ files_struct *fsp = file_fsp(params,0);
info_level = SVAL(params,2);
CHECK_FSP(fsp,conn);