5d050bf627a4d59e4c88c9c24f9a17a935a2885f
[samba.git] / source / include / includes.h
1 #ifndef _INCLUDES_H
2 #define _INCLUDES_H
3 /* 
4    Unix SMB/Netbios implementation.
5    Version 1.9.
6    Machine customisation and include handling
7    Copyright (C) Andrew Tridgell 1994-1998
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 2 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, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24 #include "config.h"
25 #include "local.h"
26
27 #ifdef AIX
28 #define DEFAULT_PRINTING PRINT_AIX
29 #endif
30
31 #ifdef HPUX
32 #define DEFAULT_PRINTING PRINT_HPUX
33 #endif
34
35 #ifdef QNX
36 #define DEFAULT_PRINTING PRINT_QNX
37 #endif
38
39 #ifdef SUNOS4
40 #define REPLACE_GETPASS
41 /* on SUNOS4 termios.h conflicts with sys/ioctl.h */
42 #undef HAVE_TERMIOS_H
43 #endif
44
45 #ifdef SUNOS5
46 #define REPLACE_GETPASS
47 #endif
48
49
50 #include <sys/types.h>
51
52 #ifdef TIME_WITH_SYS_TIME
53 #include <sys/time.h>
54 #include <time.h>
55 #else
56 #ifdef HAVE_SYS_TIME_H
57 #include <sys/time.h>
58 #else
59 #include <time.h>
60 #endif
61 #endif
62
63 #ifdef HAVE_SYS_RESOURCE_H
64 #include <sys/resource.h>
65 #endif
66
67 #ifdef HAVE_UNISTD_H
68 #include <unistd.h>
69 #endif
70
71 #include <stdio.h>
72 #include <stddef.h>
73
74 #ifdef HAVE_SYS_PARAM_H
75 #include <sys/param.h>
76 #endif
77
78 #ifdef HAVE_STDLIB_H
79 #include <stdlib.h>
80 #endif
81
82 #ifdef HAVE_SYS_SOCKET_H
83 #include <sys/socket.h>
84 #endif
85
86 #ifdef HAVE_STRING_H
87 #include <string.h>
88 #endif
89
90 #ifdef HAVE_STRINGS_H
91 #include <strings.h>
92 #endif
93
94 #ifdef HAVE_MEMORY_H
95 #include <memory.h>
96 #endif
97
98 #ifdef HAVE_MALLOC_H
99 #include <malloc.h>
100 #endif
101
102 #ifdef HAVE_FCNTL_H
103 #include <fcntl.h>
104 #else
105 #ifdef HAVE_SYS_FCNTL_H
106 #include <sys/fcntl.h>
107 #endif
108 #endif
109
110 #include <sys/stat.h>
111
112 #ifdef HAVE_LIMITS_H
113 #include <limits.h>
114 #endif
115
116 #ifdef HAVE_SYS_IOCTL_H
117 #include <sys/ioctl.h>
118 #endif
119
120 #ifdef HAVE_SYS_FILIO_H
121 #include <sys/filio.h>
122 #endif
123
124 #include <signal.h>
125
126 #ifdef HAVE_SYS_WAIT_H
127 #include <sys/wait.h>
128 #endif
129 #ifdef HAVE_CTYPE_H
130 #include <ctype.h>
131 #endif
132 #ifdef HAVE_GRP_H
133 #include <grp.h>
134 #endif
135 #ifdef HAVE_SYS_ID_H
136 #include <sys/id.h>
137 #endif
138
139 #include <errno.h>
140
141 #ifdef HAVE_UTIME_H
142 #include <utime.h>
143 #endif
144
145 #ifdef HAVE_SYS_SELECT_H
146 #include <sys/select.h>
147 #endif
148
149 #ifdef HAVE_SYS_MODE_H
150 /* apparently AIX needs this for S_ISLNK */
151 #ifndef S_ISLNK
152 #include <sys/mode.h>
153 #endif
154 #endif
155
156 #ifdef HAVE_GLOB
157 #include <glob.h>
158 #endif
159
160 #include <pwd.h>
161 #include <grp.h>
162
163 #ifdef HAVE_STDARG_H
164 #include <stdarg.h>
165 #else
166 #include <varargs.h>
167 #endif
168
169 #include <netinet/in.h>
170 #include <arpa/inet.h>
171 #include <netdb.h>
172 #include <syslog.h>
173 #include <sys/file.h>
174
175 #ifdef HAVE_NETINET_TCP_H
176 #include <netinet/tcp.h>
177 #endif
178
179 #ifdef HAVE_TERMIOS_H
180 #include <termios.h>
181 #endif
182
183 #if HAVE_DIRENT_H
184 # include <dirent.h>
185 # define NAMLEN(dirent) strlen((dirent)->d_name)
186 #else
187 # define dirent direct
188 # define NAMLEN(dirent) (dirent)->d_namlen
189 # if HAVE_SYS_NDIR_H
190 #  include <sys/ndir.h>
191 # endif
192 # if HAVE_SYS_DIR_H
193 #  include <sys/dir.h>
194 # endif
195 # if HAVE_NDIR_H
196 #  include <ndir.h>
197 # endif
198 #endif
199
200 #ifdef HAVE_SHARED_MMAP
201 #include <sys/mman.h>
202 #endif
203
204 #ifdef HAVE_SYSV_IPC
205 #include <sys/ipc.h>
206 #include <sys/shm.h>
207 #include <sys/sem.h>
208 #endif
209
210 #ifdef HAVE_NET_IF_H
211 #include <net/if.h>
212 #endif
213
214
215 #ifdef HAVE_SYS_MOUNT_H
216 #include <sys/mount.h>
217 #endif
218
219 #ifdef HAVE_SYS_VFS_H
220 #include <sys/vfs.h>
221 #endif
222
223 #ifdef HAVE_SYS_FS_S5PARAM_H 
224 #include <sys/fs/s5param.h>
225 #endif
226
227 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
228 #include <sys/filsys.h> 
229 #endif
230
231 #ifdef HAVE_SYS_STATFS_H
232 # include <sys/statfs.h>
233 #endif
234
235 #ifdef HAVE_DUSTAT_H              
236 #include <sys/dustat.h>
237 #endif
238
239 #ifdef HAVE_SYS_STATVFS_H          
240 #include <sys/statvfs.h>
241 #endif
242
243 #ifdef HAVE_SHADOW_H
244 #include <shadow.h>
245 #endif
246
247 #ifdef HAVE_SYS_SECURITY_H
248 #include <sys/security.h>
249 #include <prot.h>
250 #define PASSWORD_LENGTH 16
251 #endif  /* HAVE_SYS_SECURITY_H */
252
253 #ifdef HAVE_COMPAT_H
254 #include <compat.h>
255 #endif
256
257 #ifdef HAVE_RPCSVC_YPCLNT_H
258 #include <rpcsvc/ypclnt.h>
259 #endif
260
261 #ifndef uchar
262 #define uchar unsigned char
263 #endif
264
265 #ifdef HAVE_UNSIGNED_CHAR
266 #define schar signed char
267 #else
268 #define schar char
269 #endif
270
271 #ifndef int32
272 #if (SIZEOF_INT == 4)
273 #define int32 int
274 #elif (SIZEOF_LONG == 4)
275 #define int32 long
276 #elif (SIZEOF_SHORT == 4)
277 #define int32 short
278 #endif
279 #endif
280
281 #ifndef uint32
282 #define uint32 unsigned int32
283 #endif
284
285 #ifndef MIN
286 #define MIN(a,b) ((a)<(b)?(a):(b))
287 #endif
288
289 #ifndef MAX
290 #define MAX(a,b) ((a)>(b)?(a):(b))
291 #endif
292
293 #ifndef HAVE_STRERROR
294 extern char *sys_errlist[];
295 #define strerror(i) sys_errlist[i]
296 #endif
297
298 #ifndef HAVE_STRCHR
299 # define strchr                 index
300 # define strrchr                rindex
301 #endif
302
303 #ifndef HAVE_ERRNO_DECL
304 extern int errno;
305 #endif
306
307 #ifdef HAVE_BROKEN_GETGROUPS
308 #define GID_T int
309 #else
310 #define GID_T gid_t
311 #endif
312
313
314 /* Lists, trees, caching, datbase... */
315 #include "ubi_sLinkList.h"
316 #include "ubi_dLinkList.h"
317 #include "dlinklist.h"
318
319 #ifndef UBI_BINTREE_H
320 #include "ubi_Cache.h"
321 #endif /* UBI_BINTREE_H */
322
323 #include "version.h"
324 #include "smb.h"
325 #include "nameserv.h"
326
327 #include "byteorder.h"
328
329 #include "kanji.h"
330 #include "charset.h"
331
332 #include "nterr.h"
333
334 #ifndef MAXCODEPAGELINES
335 #define MAXCODEPAGELINES 256
336 #endif
337
338 /***** automatically generated prototypes *****/
339 #include "proto.h"
340
341 #ifdef strcpy
342 #undef strcpy
343 #endif /* strcpy */
344 #define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
345
346 #ifdef strcat
347 #undef strcat
348 #endif /* strcat */
349 #define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
350
351 #ifdef sprintf
352 #undef sprintf
353 #endif /* sprintf */
354 #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
355
356 #define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
357 #define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
358 #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
359 #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
360
361 #ifdef __COMPAR_FN_T
362 #define QSORT_CAST (__compar_fn_t)
363 #endif
364
365 #ifndef QSORT_CAST
366 #define QSORT_CAST (int (*)(const void *, const void *))
367 #endif
368
369 /* this guess needs to be improved (tridge) */
370 #if defined(STAT_STATVFS) && !defined(SYSV)
371 #define SYSV 1
372 #endif
373
374 #ifndef DEFAULT_PRINTING
375 #ifdef SYSV
376 #define DEFAULT_PRINTING PRINT_SYSV
377 #else
378 #define DEFAULT_PRINTING PRINT_BSD
379 #endif
380 #endif
381
382 #ifndef SIGCLD
383 #define SIGCLD SIGCHLD
384 #endif
385
386 #if (defined(HAVE_SYSV_IPC) || defined(HAVE_SHARED_MMAP))
387 #define FAST_SHARE_MODES 1
388 #endif
389
390 #ifndef MAP_FILE
391 #define MAP_FILE 0
392 #endif
393
394 #ifdef HAVE_SYSV_IPC
395 #ifndef HAVE_UNION_SEMUN
396 union semun {
397         int val;
398         struct semid_ds *buf;
399         unsigned short *array;
400 };
401 #endif
402 #endif
403
404 #if (!defined(WITH_NISPLUS) && !defined(WITH_LDAP))
405 #define USE_SMBPASS_DB 1
406 #endif
407
408 #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
409 #define OSF1_ENH_SEC 1
410 #endif
411
412 #if defined(HAVE_PAM_AUTHENTICATE) && defined(HAVE_SECURITY_PAM_APPL_H)
413 #define HAVE_PAM 1
414 #endif
415
416 #if defined(HAVE_YP_GET_DEFAULT_DOMAIN)
417 #define HAVE_NETGROUP 1
418 #endif
419
420 #ifndef ALLOW_CHANGE_PASSWORD
421 #if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
422 #define ALLOW_CHANGE_PASSWORD 1
423 #endif
424 #endif
425
426 /* what is the longest significant password available on your system? 
427  Knowing this speeds up password searches a lot */
428 #ifndef PASSWORD_LENGTH
429 #define PASSWORD_LENGTH 8
430 #endif
431
432 #ifdef REPLACE_INET_NTOA
433 #define inet_ntoa rep_inet_ntoa
434 #endif
435
436 #ifndef HAVE_PIPE
437 #define SYNC_DNS 1
438 #endif
439
440 #ifndef MAXPATHLEN
441 #define MAXPATHLEN 256
442 #endif
443
444 #ifndef SEEK_SET
445 #define SEEK_SET 0
446 #endif
447
448 #ifndef INADDR_LOOPBACK
449 #define INADDR_LOOPBACK 0x7f000001
450 #endif
451
452 #ifndef INADDR_NONE
453 #define INADDR_NONE 0xffffffff
454 #endif
455
456 #ifndef HAVE_CRYPT
457 #define crypt ufc_crypt
458 #endif
459
460 #if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
461 #define ULTRIX_AUTH 1
462 #endif
463
464 #ifndef HAVE_STRDUP
465 char *strdup(const char *s);
466 #endif
467
468 #ifndef HAVE_MEMMOVE
469 void *memmove(void *dest,const void *src,int size);
470 #endif
471
472 #ifndef HAVE_INITGROUPS
473 int initgroups(char *name,gid_t id);
474 #endif
475
476 #ifndef HAVE_RENAME
477 int rename(const char *zfrom, const char *zto);
478 #endif
479
480 #ifndef HAVE_MKTIME
481 time_t mktime(struct tm *t);
482 #endif
483
484 #ifndef HAVE_FTRUNCATE
485 int ftruncate(int f,long l);
486 #endif
487
488 #if (defined(HAVE_SETRESUID) && !defined(HAVE_SETRESUID_DECL))
489 /* stupid glibc */
490 int setresuid(uid_t ruid, uid_t euid, uid_t suid);
491 int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
492 #endif
493
494 #if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
495 #define bzero(a,b) memset((a),'\0',(b))
496 #endif
497
498 #endif /* _INCLUDES_H */