diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/local.h | 2 | ||||
-rw-r--r-- | source3/include/smb.h | 2 | ||||
-rw-r--r-- | source3/smbd/ipc.c | 2 | ||||
-rw-r--r-- | source3/smbd/reply.c | 4 | ||||
-rw-r--r-- | source3/smbd/server.c | 18 | ||||
-rw-r--r-- | source3/utils/status.c | 2 |
6 files changed, 16 insertions, 14 deletions
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;i<MAX_OPEN_FILES;i++) + for (i=0;i<MAX_FNUMS;i++) if (Files[i].open && Files[i].print_file) { pstring wd; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index a0d1775b21..f6fd2ccd90 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1490,7 +1490,7 @@ int reply_ulogoffX(char *inbuf,char *outbuf,int length,int bufsize) open by this user */ if ((vuser != 0) && (lp_security() != SEC_SHARE)) { int i; - for (i=0;i<MAX_OPEN_FILES;i++) { + for (i=0;i<MAX_FNUMS;i++) { files_struct *fsp = &Files[i]; if ((fsp->vuid == 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;i++) + for (i=0;i<MAX_FNUMS;i++) if (OPEN_FNUM(i)) sync_file(i); } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 98f65ce6e9..9df2ed37bb 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -67,7 +67,7 @@ extern int dcelogin_atmost_once; extern DOM_SID global_machine_sid; connection_struct Connections[MAX_CONNECTIONS]; -files_struct Files[MAX_OPEN_FILES+MAX_OPEN_DIRECTORIES]; +files_struct Files[MAX_FNUMS]; /* * Indirection for file fd's. Needed as POSIX locking @@ -3145,7 +3145,7 @@ global_oplocks_open = %d\n", timestring(), dev, inode, global_oplocks_open)); /* We need to search the file open table for the entry containing this dev and inode, and ensure we have an oplock on it. */ - for( fnum = 0; fnum < MAX_OPEN_FILES; fnum++) + for( fnum = 0; fnum < MAX_FNUMS; fnum++) { if(OPEN_FNUM(fnum)) { @@ -4002,14 +4002,14 @@ int find_free_file(void ) increases the chance that the errant client will get an error rather than causing corruption */ if (first_file == 0) { - first_file = (getpid() ^ (int)time(NULL)) % MAX_OPEN_FILES; + first_file = (getpid() ^ (int)time(NULL)) % MAX_FNUMS; if (first_file == 0) first_file = 1; } - if (first_file >= MAX_OPEN_FILES) + if (first_file >= MAX_FNUMS) first_file = 1; - for (i=first_file;i<MAX_OPEN_FILES;i++) + for (i=first_file;i<MAX_FNUMS;i++) if (!Files[i].open && !Files[i].reserved) { memset(&Files[i], 0, sizeof(Files[i])); first_file = i+1; @@ -4035,7 +4035,7 @@ int find_free_file(void ) * files batch oplocked for quite a long time * after they have finished with them. */ - for (i=first_file;i<MAX_OPEN_FILES;i++) { + for (i=first_file;i<MAX_FNUMS;i++) { if(attempt_close_oplocked_file( &Files[i])) { memset(&Files[i], 0, sizeof(Files[i])); first_file = i+1; @@ -4044,7 +4044,7 @@ int find_free_file(void ) } } - for (i=1;i<MAX_OPEN_FILES;i++) { + for (i=1;i<MAX_FNUMS;i++) { if(attempt_close_oplocked_file( &Files[i])) { memset(&Files[i], 0, sizeof(Files[i])); first_file = i+1; @@ -4487,7 +4487,7 @@ close all open files for a connection static void close_open_files(int cnum) { int i; - for (i=0;i<MAX_OPEN_FILES;i++) + for (i=0;i<MAX_FNUMS;i++) if( Files[i].cnum == cnum && Files[i].open) { if(Files[i].is_directory) close_directory(i); @@ -5367,7 +5367,7 @@ static void init_structs(void ) string_init(&Connections[i].origpath,""); } - for (i=0;i<MAX_OPEN_FILES;i++) + for (i=0;i<MAX_FNUMS;i++) { Files[i].open = False; string_init(&Files[i].name,""); diff --git a/source3/utils/status.c b/source3/utils/status.c index 0a53dee62a..97f2ab3cde 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -57,7 +57,7 @@ unsigned int Ucrit_IsActive = 0; /* added by OH */ void become_root(BOOL save_dir) {} void unbecome_root(BOOL restore_dir) {} connection_struct Connections[MAX_CONNECTIONS]; -files_struct Files[MAX_OPEN_FILES]; +files_struct Files[MAX_FNUMS]; struct current_user current_user; |