From f5866fd4ba8da9acde87c7f9da8f1a242540e287 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 22 Jul 1998 13:59:19 +0000 Subject: Fixed bug found by Richard Sharpe. After increasing files_struct size by MAX_OPEN_DIRECTORIES for nttrans I forgot to update the code that enumerates the array. Created new MAX_FNUMS in local.h, changed all code that iterates through the files_struct array to use this. (sorry Richard). Jeremy. (This used to be commit 339b10222269d71c7a493cc08b7b1bfd35fd55fc) --- source3/include/local.h | 2 ++ source3/include/smb.h | 2 +- source3/smbd/ipc.c | 2 +- source3/smbd/reply.c | 4 ++-- source3/smbd/server.c | 18 +++++++++--------- source3/utils/status.c | 2 +- 6 files changed, 16 insertions(+), 14 deletions(-) (limited to 'source3') diff --git a/source3/include/local.h b/source3/include/local.h index 4a69325b77..a55af443ec 100644 --- a/source3/include/local.h +++ b/source3/include/local.h @@ -42,6 +42,8 @@ file handle per directory, but large numbers do use more memory */ #define MAX_OPEN_DIRECTORIES 64 +#define MAX_FNUMS (MAX_OPEN_FILES+MAX_OPEN_DIRECTORIES) + /* Default size of shared memory used for share mode locking */ #ifndef SHMEM_SIZE #define SHMEM_SIZE (1024*(MAX_OPEN_FILES+MAX_OPEN_DIRECTORIES)) diff --git a/source3/include/smb.h b/source3/include/smb.h index 921cb4284d..7079198a40 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -781,7 +781,7 @@ struct parm_struct #endif /* LOCKING_VERSION */ /* these are useful macros for checking validity of handles */ -#define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_OPEN_FILES)) +#define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < MAX_FNUMS)) #define OPEN_FNUM(fnum) (VALID_FNUM(fnum) && Files[fnum].open && !Files[fnum].is_directory) #define VALID_CNUM(cnum) (((cnum) >= 0) && ((cnum) < MAX_CONNECTIONS)) #define OPEN_CNUM(cnum) (VALID_CNUM(cnum) && Connections[cnum].open) diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index cbacca3b83..8b06fc91a3 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -1983,7 +1983,7 @@ static BOOL api_PrintJobInfo(int cnum,uint16 vuid,char *param,char *data, become_root(True); - for (i=0;ivuid == vuid) && fsp->open) { if(!fsp->is_directory) @@ -2396,7 +2396,7 @@ int reply_flush(char *inbuf,char *outbuf, int dum_size, int dum_buffsize) if (fnum == 0xFFFF) { int i; - for (i=0;i= MAX_OPEN_FILES) + if (first_file >= MAX_FNUMS) first_file = 1; - for (i=first_file;i