s3: Replace an if with a boolean short circuit
[Samba/gebeck_regimport.git] / source3 / include / local.h
blob653c6714c25ba30937f7e893bf70dddde6f1aef3
1 /* Copyright (C) 1995-1998 Samba-Team */
2 /* Copyright (C) 1998 John H Terpstra <jht@aquasoft.com.au> */
4 /* local definitions for file server */
5 #ifndef _LOCAL_H
6 #define _LOCAL_H
8 /* Yves Gaige <yvesg@hptnodur.grenoble.hp.com> requested this set this */
9 /* to a maximum of 8 if old smb clients break because of long printer names. */
10 #define MAXPRINTERLEN 15
12 /* max number of directories open at once */
13 /* note that with the new directory code this no longer requires a
14 file handle per directory, but large numbers do use more memory */
15 #define MAX_OPEN_DIRECTORIES 256
17 /* max number of directory handles */
18 /* As this now uses the bitmap code this can be
19 quite large. */
20 #define MAX_DIRECTORY_HANDLES 2048
22 /* maximum number of file caches per smbd */
23 #define MAX_WRITE_CACHES 10
26 * Fudgefactor required for open tdb's, etc.
29 #ifndef MAX_OPEN_FUDGEFACTOR
30 #define MAX_OPEN_FUDGEFACTOR 20
31 #endif
34 * Minimum number of open files needed for Windows7 to
35 * work correctly. A little conservative but better that
36 * than run out of fd's.
39 #ifndef MIN_OPEN_FILES_WINDOWS
40 #define MIN_OPEN_FILES_WINDOWS 16384
41 #endif
44 * Default number of maximum open files per smbd. This is
45 * also limited by the maximum available file descriptors
46 * per process and can also be set in smb.conf as "max open files"
47 * in the [global] section.
50 #ifndef MAX_OPEN_FILES
51 #define MAX_OPEN_FILES (MIN_OPEN_FILES_WINDOWS + MAX_OPEN_FUDGEFACTOR)
52 #endif
54 #define WORDMAX 0xFFFF
56 /* the maximum password length before we declare a likely attack */
57 #define MAX_PASS_LEN 200
59 /* separators for lists */
60 #define LIST_SEP " \t,;\n\r"
62 /* wchar separators for lists */
63 #define LIST_SEP_W wchar_list_sep
65 /* this is where browse lists are kept in the lock dir */
66 #define SERVER_LIST "browse.dat"
68 /* shall filenames with illegal chars in them get mangled in long
69 filename listings? */
70 #define MANGLE_LONG_FILENAMES
72 /* define this if you want to stop spoofing with .. and soft links
73 NOTE: This also slows down the server considerably */
74 #define REDUCE_PATHS
76 /* the size of the directory cache */
77 #define DIRCACHESIZE 20
79 /* what default type of filesystem do we want this to show up as in a
80 NT file manager window? */
81 #define FSTYPE_STRING "NTFS"
83 /* the default guest account - normally set in the Makefile or smb.conf */
84 #ifndef GUEST_ACCOUNT
85 #define GUEST_ACCOUNT "nobody"
86 #endif
88 /* user to test password server with as invalid in security=server mode. */
89 #ifndef INVALID_USER_PREFIX
90 #define INVALID_USER_PREFIX "sambatest"
91 #endif
93 /* the default pager to use for the client "more" command. Users can
94 override this with the PAGER environment variable */
95 #ifndef PAGER
96 #define PAGER "more"
97 #endif
99 /* the size of the uid cache used to reduce valid user checks */
100 #define VUID_CACHE_SIZE 32
102 /* the following control timings of various actions. Don't change
103 them unless you know what you are doing. These are all in seconds */
104 #define DEFAULT_SMBD_TIMEOUT (60*60*24*7)
105 #define SMBD_RELOAD_CHECK (180)
106 #define IDLE_CLOSED_TIMEOUT (60)
107 #define DPTR_IDLE_TIMEOUT (120)
108 #define SMBD_SELECT_TIMEOUT (60)
109 #define NMBD_SELECT_LOOP (10)
110 #define BROWSE_INTERVAL (60)
111 #define REGISTRATION_INTERVAL (10*60)
112 #define NMBD_INETD_TIMEOUT (120)
113 #define NMBD_MAX_TTL (24*60*60)
114 #define LPQ_LOCK_TIMEOUT (5)
115 #define NMBD_INTERFACES_RELOAD (120)
116 #define NMBD_UNEXPECTED_TIMEOUT (15)
117 #define SMBD_HOUSEKEEPING_INTERVAL SMBD_SELECT_TIMEOUT
119 /* the following are in milliseconds */
120 #define LOCK_RETRY_TIMEOUT (100)
122 /* do you want to dump core (carefully!) when an internal error is
123 encountered? Samba will be careful to make the core file only
124 accessible to root */
125 #define DUMP_CORE 1
127 /* shall we support browse requests via a FIFO to nmbd? */
128 #define ENABLE_FIFO 1
130 /* how long (in miliseconds) to wait for a socket connect to happen */
131 #define LONG_CONNECT_TIMEOUT 30000
132 #define SHORT_CONNECT_TIMEOUT 5000
134 /* the default netbios keepalive timeout */
135 #define DEFAULT_KEEPALIVE 300
137 /* the directory to sit in when idle */
138 /* #define IDLE_DIR "/" */
140 /* Timout (in seconds) to wait for an oplock break
141 message to return from the client. */
143 #define OPLOCK_BREAK_TIMEOUT 30
145 /* Timout (in seconds) to add to the oplock break timeout
146 to wait for the smbd to smbd message to return. */
148 #define OPLOCK_BREAK_TIMEOUT_FUDGEFACTOR 2
150 /* the read preciction code has been disabled until some problems with
151 it are worked out */
152 #define USE_READ_PREDICTION 0
154 /* Minimum length of allowed password when changing UNIX password. */
155 #define MINPASSWDLENGTH 5
157 /* maximum ID number used for session control. This cannot be larger
158 than 62*62 for the current code */
159 #define MAX_SESSION_ID 3000
161 /* For the benifit of PAM and the 'session exec' scripts, we fake up a terminal
162 name. This can be in one of two forms: The first for systems not using
163 utmp (and therefore not constrained as to length or the need for a number
164 < 3000 or so) and the second for systems with this 'well behaved terminal
165 like name' constraint.
168 #ifndef SESSION_TEMPLATE
169 /* Paramaters are 'pid' and 'vuid' */
170 #define SESSION_TEMPLATE "smb/%lu/%llu"
171 #endif
173 #ifndef SESSION_UTMP_TEMPLATE
174 #define SESSION_UTMP_TEMPLATE "smb/%d"
175 #endif
177 /* the maximum age in seconds of a password. Should be a lp_ parameter */
178 #define MAX_PASSWORD_AGE (21*24*60*60)
180 /* Default allocation roundup. */
181 #define SMB_ROUNDUP_ALLOCATION_SIZE 0x100000
183 /* shall we deny oplocks to clients that get timeouts? */
184 #define FASCIST_OPLOCK_BACKOFF 1
186 /* this enables the "rabbit pellet" fix for SMBwritebraw */
187 #define RABBIT_PELLET_FIX 1
189 /* Max number of open RPC pipes. */
190 #define MAX_OPEN_PIPES 2048
192 /* Tuning for server auth mutex. */
193 #define CLI_AUTH_TIMEOUT 5000 /* In milli-seconds. */
194 #define NUM_CLI_AUTH_CONNECT_RETRIES 3
195 /* Number in seconds to wait for the mutex. This must be less than 30 seconds. */
196 #define SERVER_MUTEX_WAIT_TIME ( ((NUM_CLI_AUTH_CONNECT_RETRIES) * ((CLI_AUTH_TIMEOUT)/1000)) + 5)
197 /* Number in seconds for winbindd to wait for the mutex. Make this 2 * smbd wait time. */
198 #define WINBIND_SERVER_MUTEX_WAIT_TIME (( ((NUM_CLI_AUTH_CONNECT_RETRIES) * ((CLI_AUTH_TIMEOUT)/1000)) + 5)*2)
200 /* Buffer size to use when printing backtraces */
201 #define BACKTRACE_STACK_SIZE 64
203 /* size of listen() backlog in smbd */
204 #define SMBD_LISTEN_BACKLOG 50
206 /* Number of microseconds to wait before a sharing violation. */
207 #define SHARING_VIOLATION_USEC_WAIT 950000
209 /* Number of microseconds to wait before a updating the write time (2 secs). */
210 #define WRITE_TIME_UPDATE_USEC_DELAY 2000000
212 #define MAX_LDAP_REPLICATION_SLEEP_TIME 5000 /* In milliseconds. */
214 /* tdb hash size for the open database. */
215 #define SMB_OPEN_DATABASE_TDB_HASH_SIZE 10007
217 /* Characters we disallow in sharenames. */
218 #define INVALID_SHARENAME_CHARS "%<>*?|/\\+=;:\","
220 /* Seconds between connection attempts to a remote server. */
221 #define FAILED_CONNECTION_CACHE_TIMEOUT (LONG_CONNECT_TIMEOUT * 2 / 1000)
223 /* Default hash size for the winbindd cache. */
224 #define WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE 5000
226 /* Windows minimum lock resolution timeout in ms */
227 #define WINDOWS_MINIMUM_LOCK_TIMEOUT_MS 200
229 /* Maximum size of RPC data we will accept for one call. */
230 #define MAX_RPC_DATA_SIZE (15*1024*1024)
232 #define CLIENT_NDR_PADDING_SIZE 8
233 #define SERVER_NDR_PADDING_SIZE 8
235 #define DEFAULT_SMB2_MAX_READ (1024*1024)
236 #define DEFAULT_SMB2_MAX_WRITE (1024*1024)
237 #define DEFAULT_SMB2_MAX_TRANSACT (1024*1024)
238 #define DEFAULT_SMB2_MAX_CREDITS 8192
239 #define DEFAULT_SMB2_MAX_CREDIT_BITMAP_FACTOR 2
241 #endif