1 | #ifndef _INCLUDES_H
|
---|
2 | #define _INCLUDES_H
|
---|
3 | /*
|
---|
4 | Unix SMB/CIFS implementation.
|
---|
5 | Machine customisation and include handling
|
---|
6 | Copyright (C) Andrew Tridgell 1994-1998
|
---|
7 | Copyright (C) 2002 by Martin Pool <mbp@samba.org>
|
---|
8 |
|
---|
9 | This program is free software; you can redistribute it and/or modify
|
---|
10 | it under the terms of the GNU General Public License as published by
|
---|
11 | the Free Software Foundation; either version 3 of the License, or
|
---|
12 | (at your option) any later version.
|
---|
13 |
|
---|
14 | This program is distributed in the hope that it will be useful,
|
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
17 | GNU General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU General Public License
|
---|
20 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #include "../replace/replace.h"
|
---|
24 |
|
---|
25 | #if _SAMBA_BUILD_ == 4
|
---|
26 | # undef _SAMBA_BUILD_
|
---|
27 | # define _SAMBA_BUILD_ 3
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | /* make sure we have included the correct config.h */
|
---|
31 | #ifndef NO_CONFIG_H /* for some tests */
|
---|
32 | #ifndef CONFIG_H_IS_FROM_SAMBA
|
---|
33 | #error "make sure you have removed all config.h files from standalone builds!"
|
---|
34 | #error "the included config.h isn't from samba!"
|
---|
35 | #endif
|
---|
36 | #endif /* NO_CONFIG_H */
|
---|
37 |
|
---|
38 | /* only do the C++ reserved word check when we compile
|
---|
39 | to include --with-developer since too many systems
|
---|
40 | still have comflicts with their header files (e.g. IRIX 6.4) */
|
---|
41 |
|
---|
42 | #if !defined(__cplusplus) && defined(DEVELOPER) && defined(__linux__)
|
---|
43 | #define class #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
|
---|
44 | #define private #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
|
---|
45 | #define public #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
|
---|
46 | #define protected #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
|
---|
47 | #define template #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
|
---|
48 | #define this #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
|
---|
49 | #define new #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
|
---|
50 | #define delete #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
|
---|
51 | #define friend #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | #include "local.h"
|
---|
55 |
|
---|
56 | #ifdef SUNOS4
|
---|
57 | /* on SUNOS4 termios.h conflicts with sys/ioctl.h */
|
---|
58 | #undef HAVE_TERMIOS_H
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | #ifdef RELIANTUNIX
|
---|
62 | /*
|
---|
63 | * <unistd.h> has to be included before any other to get
|
---|
64 | * large file support on Reliant UNIX. Yes, it's broken :-).
|
---|
65 | */
|
---|
66 | #ifdef HAVE_UNISTD_H
|
---|
67 | #include <unistd.h>
|
---|
68 | #endif
|
---|
69 | #endif /* RELIANTUNIX */
|
---|
70 |
|
---|
71 | #include "system/dir.h"
|
---|
72 | #include "system/locale.h"
|
---|
73 | #include "system/time.h"
|
---|
74 | #include "system/wait.h"
|
---|
75 |
|
---|
76 | #if defined(HAVE_RPC_RPC_H)
|
---|
77 | /*
|
---|
78 | * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h.
|
---|
79 | */
|
---|
80 | #if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT)
|
---|
81 | #undef AUTH_ERROR
|
---|
82 | #endif
|
---|
83 | /*
|
---|
84 | * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in <netinet/tcp.h> which
|
---|
85 | * was included above. However <rpc/rpc.h> includes <sys/xti.h> which defines
|
---|
86 | * them again without checking if they already exsist. This generates
|
---|
87 | * two "Redefinition of macro" warnings for every single .c file that is
|
---|
88 | * compiled.
|
---|
89 | */
|
---|
90 | #if defined(HPUX) && defined(TCP_NODELAY)
|
---|
91 | #undef TCP_NODELAY
|
---|
92 | #endif
|
---|
93 | #if defined(HPUX) && defined(TCP_MAXSEG)
|
---|
94 | #undef TCP_MAXSEG
|
---|
95 | #endif
|
---|
96 | #include <rpc/rpc.h>
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | #if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT)
|
---|
100 | #define HAVE_NETGROUP 1
|
---|
101 | #endif
|
---|
102 |
|
---|
103 | #if defined (HAVE_NETGROUP)
|
---|
104 | #if defined(HAVE_RPCSVC_YP_PROT_H)
|
---|
105 | /*
|
---|
106 | * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in <netinet/tcp.h> which
|
---|
107 | * was included above. However <rpc/rpc.h> includes <sys/xti.h> which defines
|
---|
108 | * them again without checking if they already exsist. This generates
|
---|
109 | * two "Redefinition of macro" warnings for every single .c file that is
|
---|
110 | * compiled.
|
---|
111 | */
|
---|
112 | #if defined(HPUX) && defined(TCP_NODELAY)
|
---|
113 | #undef TCP_NODELAY
|
---|
114 | #endif
|
---|
115 | #if defined(HPUX) && defined(TCP_MAXSEG)
|
---|
116 | #undef TCP_MAXSEG
|
---|
117 | #endif
|
---|
118 | #include <rpcsvc/yp_prot.h>
|
---|
119 | #endif
|
---|
120 | #if defined(HAVE_RPCSVC_YPCLNT_H)
|
---|
121 | #include <rpcsvc/ypclnt.h>
|
---|
122 | #endif
|
---|
123 | #endif /* HAVE_NETGROUP */
|
---|
124 |
|
---|
125 | #ifndef HAVE_KRB5_H
|
---|
126 | #undef HAVE_KRB5
|
---|
127 | #endif
|
---|
128 |
|
---|
129 | #ifndef HAVE_LDAP_H
|
---|
130 | #undef HAVE_LDAP
|
---|
131 | #endif
|
---|
132 |
|
---|
133 | #if HAVE_SYS_ATTRIBUTES_H
|
---|
134 | #include <sys/attributes.h>
|
---|
135 | #endif
|
---|
136 |
|
---|
137 | #ifndef ENOATTR
|
---|
138 | #if defined(ENODATA)
|
---|
139 | #define ENOATTR ENODATA
|
---|
140 | #else
|
---|
141 | #define ENOATTR ENOENT
|
---|
142 | #endif
|
---|
143 | #endif
|
---|
144 |
|
---|
145 | /* mutually exclusive (SuSE 8.2) */
|
---|
146 | #if HAVE_ATTR_XATTR_H
|
---|
147 | #include <attr/xattr.h>
|
---|
148 | #elif HAVE_SYS_XATTR_H
|
---|
149 | #include <sys/xattr.h>
|
---|
150 | #endif
|
---|
151 |
|
---|
152 | #ifdef HAVE_SYS_EA_H
|
---|
153 | #include <sys/ea.h>
|
---|
154 | #endif
|
---|
155 |
|
---|
156 | #ifdef HAVE_SYS_EXTATTR_H
|
---|
157 | #include <sys/extattr.h>
|
---|
158 | #endif
|
---|
159 |
|
---|
160 | #ifdef HAVE_SYS_UIO_H
|
---|
161 | #include <sys/uio.h>
|
---|
162 | #endif
|
---|
163 |
|
---|
164 | #if HAVE_LANGINFO_H
|
---|
165 | #include <langinfo.h>
|
---|
166 | #endif
|
---|
167 |
|
---|
168 | #if HAVE_NETGROUP_H
|
---|
169 | #include <netgroup.h>
|
---|
170 | #endif
|
---|
171 |
|
---|
172 | #if defined(HAVE_AIO_H) && defined(WITH_AIO)
|
---|
173 | #include <aio.h>
|
---|
174 | #endif
|
---|
175 |
|
---|
176 | /* Special macros that are no-ops except when run under Valgrind on
|
---|
177 | * x86. They've moved a little bit from valgrind 1.0.4 to 1.9.4 */
|
---|
178 | #if HAVE_VALGRIND_MEMCHECK_H
|
---|
179 | /* memcheck.h includes valgrind.h */
|
---|
180 | #include <valgrind/memcheck.h>
|
---|
181 | #elif HAVE_VALGRIND_H
|
---|
182 | #include <valgrind.h>
|
---|
183 | #endif
|
---|
184 |
|
---|
185 | /* we support ADS if we want it and have krb5 and ldap libs */
|
---|
186 | #if defined(WITH_ADS) && defined(HAVE_KRB5) && defined(HAVE_LDAP)
|
---|
187 | #define HAVE_ADS
|
---|
188 | #endif
|
---|
189 |
|
---|
190 | /*
|
---|
191 | * Define additional missing types
|
---|
192 | */
|
---|
193 | #if defined(AIX)
|
---|
194 | typedef sig_atomic_t SIG_ATOMIC_T;
|
---|
195 | #else
|
---|
196 | typedef sig_atomic_t volatile SIG_ATOMIC_T;
|
---|
197 | #endif
|
---|
198 |
|
---|
199 | #ifndef uchar
|
---|
200 | #define uchar unsigned char
|
---|
201 | #endif
|
---|
202 |
|
---|
203 | /*
|
---|
204 | Samba needs type definitions for int16, int32, uint16 and uint32.
|
---|
205 |
|
---|
206 | Normally these are signed and unsigned 16 and 32 bit integers, but
|
---|
207 | they actually only need to be at least 16 and 32 bits
|
---|
208 | respectively. Thus if your word size is 8 bytes just defining them
|
---|
209 | as signed and unsigned int will work.
|
---|
210 | */
|
---|
211 |
|
---|
212 | #ifndef uint8
|
---|
213 | #define uint8 uint8_t
|
---|
214 | #endif
|
---|
215 |
|
---|
216 | #if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
|
---|
217 | # define int16 int16_t
|
---|
218 | /* needed to work around compile issue on HP-UX 11.x */
|
---|
219 | # define _INT16 1
|
---|
220 | #endif
|
---|
221 |
|
---|
222 | /*
|
---|
223 | * Note we duplicate the size tests in the unsigned
|
---|
224 | * case as int16 may be a typedef from rpc/rpc.h
|
---|
225 | */
|
---|
226 |
|
---|
227 |
|
---|
228 | #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
|
---|
229 | # define uint16 uint16_t
|
---|
230 | #endif
|
---|
231 |
|
---|
232 | #if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
|
---|
233 | # define int32 int32_t
|
---|
234 | # ifndef _INT32
|
---|
235 | /* needed to work around compile issue on HP-UX 11.x */
|
---|
236 | # define _INT32 1
|
---|
237 | # endif
|
---|
238 | #endif
|
---|
239 |
|
---|
240 | /*
|
---|
241 | * Note we duplicate the size tests in the unsigned
|
---|
242 | * case as int32 may be a typedef from rpc/rpc.h
|
---|
243 | */
|
---|
244 |
|
---|
245 | #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
|
---|
246 | # define uint32 uint32_t
|
---|
247 | #endif
|
---|
248 |
|
---|
249 | /*
|
---|
250 | * check for 8 byte long long
|
---|
251 | */
|
---|
252 |
|
---|
253 | #if !defined(uint64)
|
---|
254 | # define uint64 uint64_t
|
---|
255 | #endif
|
---|
256 |
|
---|
257 | #if !defined(int64)
|
---|
258 | # define int64 int64_t
|
---|
259 | #endif
|
---|
260 |
|
---|
261 |
|
---|
262 | /*
|
---|
263 | * Types for devices, inodes and offsets.
|
---|
264 | */
|
---|
265 |
|
---|
266 | #ifndef SMB_DEV_T
|
---|
267 | # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)
|
---|
268 | # define SMB_DEV_T dev64_t
|
---|
269 | # else
|
---|
270 | # define SMB_DEV_T dev_t
|
---|
271 | # endif
|
---|
272 | #endif
|
---|
273 |
|
---|
274 | #ifndef LARGE_SMB_DEV_T
|
---|
275 | # if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)) || (defined(SIZEOF_DEV_T) && (SIZEOF_DEV_T == 8))
|
---|
276 | # define LARGE_SMB_DEV_T 1
|
---|
277 | # endif
|
---|
278 | #endif
|
---|
279 |
|
---|
280 | #ifdef LARGE_SMB_DEV_T
|
---|
281 | #define SDEV_T_VAL(p, ofs, v) (SIVAL((p),(ofs),(v)&0xFFFFFFFF), SIVAL((p),(ofs)+4,(v)>>32))
|
---|
282 | #define DEV_T_VAL(p, ofs) ((SMB_DEV_T)(((uint64_t)(IVAL((p),(ofs))))| (((uint64_t)(IVAL((p),(ofs)+4))) << 32)))
|
---|
283 | #else
|
---|
284 | #define SDEV_T_VAL(p, ofs, v) (SIVAL((p),(ofs),v),SIVAL((p),(ofs)+4,0))
|
---|
285 | #define DEV_T_VAL(p, ofs) ((SMB_DEV_T)(IVAL((p),(ofs))))
|
---|
286 | #endif
|
---|
287 |
|
---|
288 | /*
|
---|
289 | * Setup the correctly sized inode type.
|
---|
290 | */
|
---|
291 |
|
---|
292 | #ifndef SMB_INO_T
|
---|
293 | # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)
|
---|
294 | # define SMB_INO_T ino64_t
|
---|
295 | # else
|
---|
296 | # define SMB_INO_T ino_t
|
---|
297 | # endif
|
---|
298 | #endif
|
---|
299 |
|
---|
300 | #ifndef LARGE_SMB_INO_T
|
---|
301 | # if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)) || (defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8))
|
---|
302 | # define LARGE_SMB_INO_T 1
|
---|
303 | # endif
|
---|
304 | #endif
|
---|
305 |
|
---|
306 | #ifdef LARGE_SMB_INO_T
|
---|
307 | #define SINO_T_VAL(p, ofs, v) SBVAL(p, ofs, v)
|
---|
308 | #define INO_T_VAL(p, ofs) ((SMB_INO_T)BVAL(p, ofs))
|
---|
309 | #else
|
---|
310 | #define SINO_T_VAL(p, ofs, v) SBVAL(p, ofs, ((uint64_t)(v)) & UINT32_MAX)
|
---|
311 | #define INO_T_VAL(p, ofs) ((SMB_INO_T)(IVAL((p),(ofs))))
|
---|
312 | #endif
|
---|
313 |
|
---|
314 | #ifndef SMB_OFF_T
|
---|
315 | # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
|
---|
316 | # define SMB_OFF_T off64_t
|
---|
317 | # else
|
---|
318 | # define SMB_OFF_T off_t
|
---|
319 | # endif
|
---|
320 | #endif
|
---|
321 |
|
---|
322 | /* TODO: remove this macros */
|
---|
323 | #define SBIG_UINT(p, ofs, v) SBVAL(p, ofs, v)
|
---|
324 | #define BIG_UINT(p, ofs) BVAL(p, ofs)
|
---|
325 | #define IVAL2_TO_SMB_BIG_UINT(p, ofs) BVAL(p, ofs)
|
---|
326 |
|
---|
327 | /* this should really be a 64 bit type if possible */
|
---|
328 | typedef uint64_t br_off;
|
---|
329 |
|
---|
330 | #define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
|
---|
331 |
|
---|
332 | /*
|
---|
333 | * Set the define that tells us if we can do 64 bit
|
---|
334 | * NT SMB calls.
|
---|
335 | */
|
---|
336 |
|
---|
337 | #ifndef LARGE_SMB_OFF_T
|
---|
338 | # if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
|
---|
339 | # define LARGE_SMB_OFF_T 1
|
---|
340 | # endif
|
---|
341 | #endif
|
---|
342 |
|
---|
343 | #ifdef LARGE_SMB_OFF_T
|
---|
344 | #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
|
---|
345 | #define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32))
|
---|
346 | #define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF) )))
|
---|
347 | #else
|
---|
348 | #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
|
---|
349 | #define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,v),SIVAL(p,ofs,0))
|
---|
350 | #define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint32)(IVAL((buf),(off)))) & 0xFFFFFFFF )))
|
---|
351 | #endif
|
---|
352 |
|
---|
353 | #ifndef HAVE_BLKSIZE_T
|
---|
354 | /* This is mainly for HP/UX which defines st_blksize as long */
|
---|
355 | typedef long blksize_t;
|
---|
356 | #endif
|
---|
357 |
|
---|
358 | #ifndef HAVE_BLKCNT_T
|
---|
359 | /* This is mainly for HP/UX which doesn't have blkcnt_t */
|
---|
360 | typedef long blkcnt_t;
|
---|
361 | #endif
|
---|
362 |
|
---|
363 | /*
|
---|
364 | * Type for stat structure.
|
---|
365 | */
|
---|
366 |
|
---|
367 | struct stat_ex {
|
---|
368 | dev_t st_ex_dev;
|
---|
369 | ino_t st_ex_ino;
|
---|
370 | mode_t st_ex_mode;
|
---|
371 | nlink_t st_ex_nlink;
|
---|
372 | uid_t st_ex_uid;
|
---|
373 | gid_t st_ex_gid;
|
---|
374 | dev_t st_ex_rdev;
|
---|
375 | off_t st_ex_size;
|
---|
376 | struct timespec st_ex_atime;
|
---|
377 | struct timespec st_ex_mtime;
|
---|
378 | struct timespec st_ex_ctime;
|
---|
379 | struct timespec st_ex_btime; /* birthtime */
|
---|
380 | /* Is birthtime real, or was it calculated ? */
|
---|
381 | bool st_ex_calculated_birthtime;
|
---|
382 | blksize_t st_ex_blksize;
|
---|
383 | blkcnt_t st_ex_blocks;
|
---|
384 |
|
---|
385 | uint32_t st_ex_flags;
|
---|
386 | uint32_t st_ex_mask;
|
---|
387 |
|
---|
388 | /*
|
---|
389 | * Add space for VFS internal extensions. The initial user of this
|
---|
390 | * would be the onefs modules, passing the snapid from the stat calls
|
---|
391 | * to the file_id_create call. Maybe we'll have to expand this later,
|
---|
392 | * but the core of Samba should never look at this field.
|
---|
393 | */
|
---|
394 | uint64_t vfs_private;
|
---|
395 | };
|
---|
396 |
|
---|
397 | typedef struct stat_ex SMB_STRUCT_STAT;
|
---|
398 |
|
---|
399 | /*
|
---|
400 | * Type for dirent structure.
|
---|
401 | */
|
---|
402 |
|
---|
403 | #ifndef SMB_STRUCT_DIRENT
|
---|
404 | # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64)
|
---|
405 | # define SMB_STRUCT_DIRENT struct dirent64
|
---|
406 | # else
|
---|
407 | # define SMB_STRUCT_DIRENT struct dirent
|
---|
408 | # endif
|
---|
409 | #endif
|
---|
410 |
|
---|
411 | /*
|
---|
412 | * Type for DIR structure.
|
---|
413 | */
|
---|
414 |
|
---|
415 | #ifndef SMB_STRUCT_DIR
|
---|
416 | # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIR64)
|
---|
417 | # define SMB_STRUCT_DIR DIR64
|
---|
418 | # else
|
---|
419 | # define SMB_STRUCT_DIR DIR
|
---|
420 | # endif
|
---|
421 | #endif
|
---|
422 |
|
---|
423 | /*
|
---|
424 | * Defines for 64 bit fcntl locks.
|
---|
425 | */
|
---|
426 |
|
---|
427 | #ifndef SMB_STRUCT_FLOCK
|
---|
428 | # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
|
---|
429 | # define SMB_STRUCT_FLOCK struct flock64
|
---|
430 | # else
|
---|
431 | # define SMB_STRUCT_FLOCK struct flock
|
---|
432 | # endif
|
---|
433 | #endif
|
---|
434 |
|
---|
435 | #ifndef SMB_F_SETLKW
|
---|
436 | # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
|
---|
437 | # define SMB_F_SETLKW F_SETLKW64
|
---|
438 | # else
|
---|
439 | # define SMB_F_SETLKW F_SETLKW
|
---|
440 | # endif
|
---|
441 | #endif
|
---|
442 |
|
---|
443 | #ifndef SMB_F_SETLK
|
---|
444 | # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
|
---|
445 | # define SMB_F_SETLK F_SETLK64
|
---|
446 | # else
|
---|
447 | # define SMB_F_SETLK F_SETLK
|
---|
448 | # endif
|
---|
449 | #endif
|
---|
450 |
|
---|
451 | #ifndef SMB_F_GETLK
|
---|
452 | # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
|
---|
453 | # define SMB_F_GETLK F_GETLK64
|
---|
454 | # else
|
---|
455 | # define SMB_F_GETLK F_GETLK
|
---|
456 | # endif
|
---|
457 | #endif
|
---|
458 |
|
---|
459 | /*
|
---|
460 | * Type for aiocb structure.
|
---|
461 | */
|
---|
462 |
|
---|
463 | #ifndef SMB_STRUCT_AIOCB
|
---|
464 | # if defined(WITH_AIO)
|
---|
465 | # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64)
|
---|
466 | # define SMB_STRUCT_AIOCB struct aiocb64
|
---|
467 | # else
|
---|
468 | # define SMB_STRUCT_AIOCB struct aiocb
|
---|
469 | # endif
|
---|
470 | # else
|
---|
471 | # define SMB_STRUCT_AIOCB int /* AIO not being used but we still need the define.... */
|
---|
472 | # endif
|
---|
473 | #endif
|
---|
474 |
|
---|
475 | enum timestamp_set_resolution {
|
---|
476 | TIMESTAMP_SET_SECONDS = 0,
|
---|
477 | TIMESTAMP_SET_MSEC,
|
---|
478 | TIMESTAMP_SET_NT_OR_BETTER
|
---|
479 | };
|
---|
480 |
|
---|
481 | /* Our own fstrings */
|
---|
482 |
|
---|
483 | /*
|
---|
484 | --------------
|
---|
485 | / \
|
---|
486 | / REST \
|
---|
487 | / IN \
|
---|
488 | / PEACE \
|
---|
489 | / \
|
---|
490 | | The infamous pstring |
|
---|
491 | | |
|
---|
492 | | |
|
---|
493 | | 7 December |
|
---|
494 | | |
|
---|
495 | | 2007 |
|
---|
496 | *| * * * | *
|
---|
497 | _________)/\\_//(\/(/\)/\//\/\///|_)_______
|
---|
498 | */
|
---|
499 |
|
---|
500 | #ifndef FSTRING_LEN
|
---|
501 | #define FSTRING_LEN 256
|
---|
502 | typedef char fstring[FSTRING_LEN];
|
---|
503 | #endif
|
---|
504 |
|
---|
505 | /* Lists, trees, caching, database... */
|
---|
506 | #include "../lib/util/util.h"
|
---|
507 | #include "../lib/util/util_net.h"
|
---|
508 | #include "../lib/util/xfile.h"
|
---|
509 | #include "../lib/util/memory.h"
|
---|
510 | #include "../lib/util/attr.h"
|
---|
511 | #include "../lib/util/tsort.h"
|
---|
512 | #include "../lib/util/dlinklist.h"
|
---|
513 |
|
---|
514 | #include <talloc.h>
|
---|
515 |
|
---|
516 | #include "event.h"
|
---|
517 |
|
---|
518 | #include "../lib/util/data_blob.h"
|
---|
519 | #include "../lib/util/time.h"
|
---|
520 | #include "../lib/util/debug.h"
|
---|
521 | #include "../lib/util/debug_s3.h"
|
---|
522 |
|
---|
523 | #include "../libcli/util/ntstatus.h"
|
---|
524 | #include "../libcli/util/error.h"
|
---|
525 | #include "../lib/util/charset/charset.h"
|
---|
526 | #include "dynconfig.h"
|
---|
527 | #include "locking.h"
|
---|
528 | #include "smb_perfcount.h"
|
---|
529 | #include "smb.h"
|
---|
530 | #include "../lib/util/byteorder.h"
|
---|
531 |
|
---|
532 | #include "module.h"
|
---|
533 | #include "../lib/util/talloc_stack.h"
|
---|
534 | #include "../lib/util/smb_threads.h"
|
---|
535 | #include "../lib/util/smb_threads_internal.h"
|
---|
536 |
|
---|
537 | /***** prototypes *****/
|
---|
538 | #ifndef NO_PROTO_H
|
---|
539 | #include "proto.h"
|
---|
540 | #endif
|
---|
541 |
|
---|
542 | /* String routines */
|
---|
543 |
|
---|
544 | #include "srvstr.h"
|
---|
545 | #include "safe_string.h"
|
---|
546 |
|
---|
547 | #ifndef SIGCLD
|
---|
548 | #define SIGCLD SIGCHLD
|
---|
549 | #endif
|
---|
550 |
|
---|
551 | #ifndef SIGRTMIN
|
---|
552 | #define SIGRTMIN NSIG
|
---|
553 | #endif
|
---|
554 |
|
---|
555 | #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
|
---|
556 | #define OSF1_ENH_SEC 1
|
---|
557 | #endif
|
---|
558 |
|
---|
559 | #if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
|
---|
560 | #define ULTRIX_AUTH 1
|
---|
561 | #endif
|
---|
562 |
|
---|
563 | /* yuck, I'd like a better way of doing this */
|
---|
564 | #define DIRP_SIZE (256 + 32)
|
---|
565 |
|
---|
566 | /* default socket options. Dave Miller thinks we should default to TCP_NODELAY
|
---|
567 | given the socket IO pattern that Samba uses */
|
---|
568 | #ifdef TCP_NODELAY
|
---|
569 | #define DEFAULT_SOCKET_OPTIONS "TCP_NODELAY"
|
---|
570 | #else
|
---|
571 | #define DEFAULT_SOCKET_OPTIONS ""
|
---|
572 | #endif
|
---|
573 |
|
---|
574 | /* dmalloc -- free heap debugger (dmalloc.org). This should be near
|
---|
575 | * the *bottom* of include files so as not to conflict. */
|
---|
576 | #ifdef ENABLE_DMALLOC
|
---|
577 | # include <dmalloc.h>
|
---|
578 | #endif
|
---|
579 |
|
---|
580 |
|
---|
581 | #define MAX_SEC_CTX_DEPTH 8 /* Maximum number of security contexts */
|
---|
582 |
|
---|
583 |
|
---|
584 | #ifdef GLIBC_HACK_FCNTL64
|
---|
585 | /* this is a gross hack. 64 bit locking is completely screwed up on
|
---|
586 | i386 Linux in glibc 2.1.95 (which ships with RedHat 7.0). This hack
|
---|
587 | "fixes" the problem with the current 2.4.0test kernels
|
---|
588 | */
|
---|
589 | #define fcntl fcntl64
|
---|
590 | #undef F_SETLKW
|
---|
591 | #undef F_SETLK
|
---|
592 | #define F_SETLK 13
|
---|
593 | #define F_SETLKW 14
|
---|
594 | #endif
|
---|
595 |
|
---|
596 |
|
---|
597 | /* add varargs prototypes with printf checking */
|
---|
598 | /*PRINTFLIKE2 */
|
---|
599 | int fdprintf(int , const char *, ...) PRINTF_ATTRIBUTE(2,3);
|
---|
600 | /*PRINTFLIKE1 */
|
---|
601 | int d_printf(const char *, ...) PRINTF_ATTRIBUTE(1,2);
|
---|
602 | /*PRINTFLIKE2 */
|
---|
603 | int d_fprintf(FILE *f, const char *, ...) PRINTF_ATTRIBUTE(2,3);
|
---|
604 |
|
---|
605 | /* PRINTFLIKE2 */
|
---|
606 | void sys_adminlog(int priority, const char *format_str, ...) PRINTF_ATTRIBUTE(2,3);
|
---|
607 |
|
---|
608 | /* PRINTFLIKE2 */
|
---|
609 | int fstr_sprintf(fstring s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
|
---|
610 |
|
---|
611 | int d_vfprintf(FILE *f, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
|
---|
612 |
|
---|
613 | int smb_xvasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
|
---|
614 |
|
---|
615 | int asprintf_strupper_m(char **strp, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
|
---|
616 | char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
|
---|
617 |
|
---|
618 | /*
|
---|
619 | * Veritas File System. Often in addition to native.
|
---|
620 | * Quotas different.
|
---|
621 | */
|
---|
622 | #if defined(HAVE_SYS_FS_VX_QUOTA_H)
|
---|
623 | #define VXFS_QUOTA
|
---|
624 | #endif
|
---|
625 |
|
---|
626 | #ifndef XATTR_CREATE
|
---|
627 | #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
|
---|
628 | #endif
|
---|
629 |
|
---|
630 | #ifndef XATTR_REPLACE
|
---|
631 | #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
|
---|
632 | #endif
|
---|
633 |
|
---|
634 | #ifdef TRUE
|
---|
635 | #undef TRUE
|
---|
636 | #endif
|
---|
637 | #define TRUE __ERROR__XX__DONT_USE_TRUE
|
---|
638 |
|
---|
639 | #ifdef FALSE
|
---|
640 | #undef FALSE
|
---|
641 | #endif
|
---|
642 | #define FALSE __ERROR__XX__DONT_USE_FALSE
|
---|
643 |
|
---|
644 | /* If we have blacklisted mmap() try to avoid using it accidentally by
|
---|
645 | undefining the HAVE_MMAP symbol. */
|
---|
646 |
|
---|
647 | #ifdef MMAP_BLACKLIST
|
---|
648 | #undef HAVE_MMAP
|
---|
649 | #endif
|
---|
650 |
|
---|
651 | #ifndef CONST_DISCARD
|
---|
652 | #define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr)))
|
---|
653 | #endif
|
---|
654 |
|
---|
655 | void smb_panic( const char *why ) _NORETURN_;
|
---|
656 | void dump_core(void) _NORETURN_;
|
---|
657 | void exit_server(const char *const reason) _NORETURN_;
|
---|
658 | void exit_server_cleanly(const char *const reason) _NORETURN_;
|
---|
659 | void exit_server_fault(void) _NORETURN_;
|
---|
660 |
|
---|
661 | /* samba3 doesn't use uwrap yet */
|
---|
662 | #define uwrap_enabled() 0
|
---|
663 |
|
---|
664 | #define BASE_RID (0x000003E8L)
|
---|
665 |
|
---|
666 | #endif /* _INCLUDES_H */
|
---|