removed some obsolete configure tests (sysv ipc etc)
[kai/samba.git] / source3 / 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 #ifndef NO_CONFIG_H /* for some tests */
25 #include "config.h"
26 #endif
27
28 #include "local.h"
29
30 #ifdef AIX
31 #define DEFAULT_PRINTING PRINT_AIX
32 #define PRINTCAP_NAME "/etc/qconfig"
33 #endif
34
35 #ifdef HPUX
36 #define DEFAULT_PRINTING PRINT_HPUX
37 #endif
38
39 #ifdef QNX
40 #define DEFAULT_PRINTING PRINT_QNX
41 #endif
42
43 #ifdef SUNOS4
44 /* on SUNOS4 termios.h conflicts with sys/ioctl.h */
45 #undef HAVE_TERMIOS_H
46 #endif
47
48 #ifdef LINUX
49 #define DEFAULT_PRINTING PRINT_BSD
50 #define PRINTCAP_NAME "/etc/printcap"
51 #endif
52
53 #ifdef RELIANTUNIX
54 /*
55  * <unistd.h> has to be included before any other to get
56  * large file support on Reliant UNIX
57  */
58 #ifdef HAVE_UNISTD_H
59 #include <unistd.h>
60 #endif
61 #endif /* RELIANTUNIX */
62
63 #ifdef HAVE_SYSV_IPC
64 #define USE_SYSV_IPC
65 #endif
66
67 #ifdef HAVE_SHARED_MMAP
68 #define USE_SHARED_MMAP
69 #endif
70
71
72 /* if we have both SYSV IPC and shared mmap then we need to choose */
73 #if (defined(USE_SYSV_IPC) && defined(USE_SHARED_MMAP))
74 #  undef USE_SHARED_MMAP
75 #endif
76
77 #include <sys/types.h>
78
79 #ifdef TIME_WITH_SYS_TIME
80 #include <sys/time.h>
81 #include <time.h>
82 #else
83 #ifdef HAVE_SYS_TIME_H
84 #include <sys/time.h>
85 #else
86 #include <time.h>
87 #endif
88 #endif
89
90 #ifdef HAVE_SYS_RESOURCE_H
91 #include <sys/resource.h>
92 #endif
93
94 #ifdef HAVE_UNISTD_H
95 #include <unistd.h>
96 #endif
97
98 #include <stdio.h>
99 #include <stddef.h>
100
101 #ifdef HAVE_SYS_PARAM_H
102 #include <sys/param.h>
103 #endif
104
105 #ifdef HAVE_STDLIB_H
106 #include <stdlib.h>
107 #endif
108
109 #ifdef HAVE_SYS_SOCKET_H
110 #include <sys/socket.h>
111 #endif
112
113 #ifdef HAVE_SYS_UN_H
114 #include <sys/un.h>
115 #endif
116
117 #ifdef HAVE_SYS_SYSCALL_H
118 #include <sys/syscall.h>
119 #elif HAVE_SYSCALL_H
120 #include <syscall.h>
121 #endif
122
123 #ifdef HAVE_STRING_H
124 #include <string.h>
125 #endif
126
127 #ifdef HAVE_STRINGS_H
128 #include <strings.h>
129 #endif
130
131 #ifdef HAVE_MEMORY_H
132 #include <memory.h>
133 #endif
134
135 #ifdef HAVE_MALLOC_H
136 #include <malloc.h>
137 #endif
138
139 #ifdef HAVE_FCNTL_H
140 #include <fcntl.h>
141 #else
142 #ifdef HAVE_SYS_FCNTL_H
143 #include <sys/fcntl.h>
144 #endif
145 #endif
146
147 #include <sys/stat.h>
148
149 #ifdef HAVE_LIMITS_H
150 #include <limits.h>
151 #endif
152
153 #ifdef HAVE_SYS_IOCTL_H
154 #include <sys/ioctl.h>
155 #endif
156
157 #ifdef HAVE_SYS_FILIO_H
158 #include <sys/filio.h>
159 #endif
160
161 #include <signal.h>
162
163 #ifdef HAVE_SYS_WAIT_H
164 #include <sys/wait.h>
165 #endif
166 #ifdef HAVE_CTYPE_H
167 #include <ctype.h>
168 #endif
169 #ifdef HAVE_GRP_H
170 #include <grp.h>
171 #endif
172 #ifdef HAVE_SYS_PRIV_H
173 #include <sys/priv.h>
174 #endif
175 #ifdef HAVE_SYS_ID_H
176 #include <sys/id.h>
177 #endif
178
179 #include <errno.h>
180
181 #ifdef HAVE_UTIME_H
182 #include <utime.h>
183 #endif
184
185 #ifdef HAVE_SYS_SELECT_H
186 #include <sys/select.h>
187 #endif
188
189 #ifdef HAVE_SYS_MODE_H
190 /* apparently AIX needs this for S_ISLNK */
191 #ifndef S_ISLNK
192 #include <sys/mode.h>
193 #endif
194 #endif
195
196 #ifdef HAVE_GLOB_H
197 #include <glob.h>
198 #endif
199
200 #include <pwd.h>
201
202 #ifdef HAVE_STDARG_H
203 #include <stdarg.h>
204 #else
205 #include <varargs.h>
206 #endif
207
208 #include <netinet/in.h>
209 #include <arpa/inet.h>
210 #include <netdb.h>
211 #include <syslog.h>
212 #include <sys/file.h>
213
214 #ifdef HAVE_NETINET_TCP_H
215 #include <netinet/tcp.h>
216 #endif
217
218 /*
219  * The next three defines are needed to access the IPTOS_* options
220  * on some systems.
221  */
222
223 #ifdef HAVE_NETINET_IN_SYSTM_H
224 #include <netinet/in_systm.h>
225 #endif
226
227 #ifdef HAVE_NETINET_IN_IP_H
228 #include <netinet/in_ip.h>
229 #endif
230
231 #ifdef HAVE_NETINET_IP_H
232 #include <netinet/ip.h>
233 #endif
234
235 #if defined(HAVE_TERMIOS_H)
236 /* POSIX terminal handling. */
237 #include <termios.h>
238 #elif defined(HAVE_TERMIO_H)
239 /* Older SYSV terminal handling - don't use if we can avoid it. */
240 #include <termio.h>
241 #elif defined(HAVE_SYS_TERMIO_H)
242 /* Older SYSV terminal handling - don't use if we can avoid it. */
243 #include <sys/termio.h>
244 #endif
245
246 #if HAVE_DIRENT_H
247 # include <dirent.h>
248 # define NAMLEN(dirent) strlen((dirent)->d_name)
249 #else
250 # define dirent direct
251 # define NAMLEN(dirent) (dirent)->d_namlen
252 # if HAVE_SYS_NDIR_H
253 #  include <sys/ndir.h>
254 # endif
255 # if HAVE_SYS_DIR_H
256 #  include <sys/dir.h>
257 # endif
258 # if HAVE_NDIR_H
259 #  include <ndir.h>
260 # endif
261 #endif
262
263 #ifdef HAVE_SYS_MMAN_H
264 #include <sys/mman.h>
265 #endif
266
267 #ifdef HAVE_SYSV_IPC
268 #include <sys/ipc.h>
269 #include <sys/shm.h>
270 #include <sys/sem.h>
271
272 /*
273  * The following is needed if compiling
274  * with gcc on SGI IRIX 6.5.x systems as
275  * the structure packing for system calls is
276  * different between IRIX cc and gcc.
277  */
278
279 #ifdef NEED_SGI_SEMUN_HACK
280 union semun_hack {
281         int val;
282         struct semid_ds *buf;
283         unsigned short *array;
284        char __dummy[5];
285 };
286 #define semun semun_hack
287 #endif /* NEED_SGI_SEMUN_HACK */
288 #endif /* HAVE_SYSV_IPC */
289
290 #ifdef HAVE_NET_IF_H
291 #include <net/if.h>
292 #endif
293
294
295 #ifdef HAVE_SYS_MOUNT_H
296 #include <sys/mount.h>
297 #endif
298
299 #ifdef HAVE_SYS_VFS_H
300 #include <sys/vfs.h>
301 #endif
302
303 #ifdef HAVE_SYS_ACL_H
304 #include <sys/acl.h>
305 #endif
306
307 #ifdef HAVE_SYS_FS_S5PARAM_H 
308 #include <sys/fs/s5param.h>
309 #endif
310
311 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
312 #include <sys/filsys.h> 
313 #endif
314
315 #ifdef HAVE_SYS_STATFS_H
316 # include <sys/statfs.h>
317 #endif
318
319 #ifdef HAVE_DUSTAT_H              
320 #include <sys/dustat.h>
321 #endif
322
323 #ifdef HAVE_SYS_STATVFS_H          
324 #include <sys/statvfs.h>
325 #endif
326
327 #ifdef HAVE_SHADOW_H
328 #include <shadow.h>
329 #endif
330
331 #ifdef HAVE_GETPWANAM
332 #include <sys/label.h>
333 #include <sys/audit.h>
334 #include <pwdadj.h>
335 #endif
336
337 #ifdef HAVE_SYS_SECURITY_H
338 #include <sys/security.h>
339 #include <prot.h>
340 #define PASSWORD_LENGTH 16
341 #endif  /* HAVE_SYS_SECURITY_H */
342
343 #ifdef HAVE_COMPAT_H
344 #include <compat.h>
345 #endif
346
347 #ifdef HAVE_STROPTS_H
348 #include <stropts.h>
349 #endif
350
351 #ifdef HAVE_POLL_H
352 #include <poll.h>
353 #endif
354
355 #ifdef HAVE_SYS_CAPABILITY_H
356 #include <sys/capability.h>
357 #endif
358
359 #if defined(HAVE_RPC_RPC_H)
360 /*
361  * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h.
362  */
363 #if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT)
364 #undef AUTH_ERROR
365 #endif
366 #include <rpc/rpc.h>
367 #endif
368
369 #if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT)
370 #define HAVE_NETGROUP 1
371 #endif
372
373 #if defined (HAVE_NETGROUP)
374 #if defined(HAVE_RPCSVC_YP_PROT_H)
375 #include <rpcsvc/yp_prot.h>
376 #endif
377 #if defined(HAVE_RPCSVC_YPCLNT_H)
378 #include <rpcsvc/ypclnt.h>
379 #endif
380 #endif /* HAVE_NETGROUP */
381
382 /*
383  * Define VOLATILE if needed.
384  */
385
386 #if defined(HAVE_VOLATILE)
387 #define VOLATILE volatile
388 #else
389 #define VOLATILE
390 #endif
391
392 /*
393  * Define SIG_ATOMIC_T if needed.
394  */
395
396 #if defined(HAVE_SIG_ATOMIC_T_TYPE)
397 #define SIG_ATOMIC_T sig_atomic_t
398 #else
399 #define SIG_ATOMIC_T int
400 #endif
401
402 #ifndef uchar
403 #define uchar unsigned char
404 #endif
405
406 #ifdef HAVE_UNSIGNED_CHAR
407 #define schar signed char
408 #else
409 #define schar char
410 #endif
411
412 /*
413    Samba needs type definitions for int16, int32, uint16 and uint32.
414
415    Normally these are signed and unsigned 16 and 32 bit integers, but
416    they actually only need to be at least 16 and 32 bits
417    respectively. Thus if your word size is 8 bytes just defining them
418    as signed and unsigned int will work.
419 */
420
421 #ifndef uint8
422 #define uint8 unsigned char
423 #endif
424
425 #if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
426 #if (SIZEOF_SHORT == 4)
427 #define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
428 #else /* SIZEOF_SHORT != 4 */
429 #define int16 short
430 #endif /* SIZEOF_SHORT != 4 */
431 #endif
432
433 /*
434  * Note we duplicate the size tests in the unsigned 
435  * case as int16 may be a typedef from rpc/rpc.h
436  */
437
438 #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
439 #if (SIZEOF_SHORT == 4)
440 #define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
441 #else /* SIZEOF_SHORT != 4 */
442 #define uint16 unsigned short
443 #endif /* SIZEOF_SHORT != 4 */
444 #endif
445
446 #if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
447 #if (SIZEOF_INT == 4)
448 #define int32 int
449 #elif (SIZEOF_LONG == 4)
450 #define int32 long
451 #elif (SIZEOF_SHORT == 4)
452 #define int32 short
453 #endif
454 #endif
455
456 /*
457  * Note we duplicate the size tests in the unsigned 
458  * case as int32 may be a typedef from rpc/rpc.h
459  */
460
461 #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
462 #if (SIZEOF_INT == 4)
463 #define uint32 unsigned int
464 #elif (SIZEOF_LONG == 4)
465 #define uint32 unsigned long
466 #elif (SIZEOF_SHORT == 4)
467 #define uint32 unsigned short
468 #endif
469 #endif
470
471 /*
472  * Types for devices, inodes and offsets.
473  */
474
475 #ifndef SMB_DEV_T
476 #define SMB_DEV_T dev_t
477 #endif
478
479 /*
480  * Setup the correctly sized inode type.
481  */
482
483 #ifndef SMB_INO_T
484 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)
485 #    define SMB_INO_T ino64_t
486 #  else
487 #    define SMB_INO_T ino_t
488 #  endif
489 #endif
490
491 #ifndef LARGE_SMB_INO_T
492 #  if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)) || (defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8))
493 #    define LARGE_SMB_INO_T 1
494 #  endif
495 #endif
496
497 #ifdef LARGE_SMB_INO_T
498 #define SINO_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
499 #else 
500 #define SINO_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
501 #endif
502
503 #ifndef SMB_OFF_T
504 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
505 #    define SMB_OFF_T off64_t
506 #  else
507 #    define SMB_OFF_T off_t
508 #  endif
509 #endif
510
511 /* this should really be a 64 bit type if possible */
512 #define br_off SMB_BIG_UINT
513
514 #define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
515
516 /*
517  * Set the define that tells us if we can do 64 bit
518  * NT SMB calls.
519  */
520
521 #ifndef LARGE_SMB_OFF_T
522 #  if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
523 #    define LARGE_SMB_OFF_T 1
524 #  endif
525 #endif
526
527 #ifdef LARGE_SMB_OFF_T
528 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
529 #else 
530 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
531 #endif
532
533 /*
534  * Type for stat structure.
535  */
536
537 #ifndef SMB_STRUCT_STAT
538 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
539 #    define SMB_STRUCT_STAT struct stat64
540 #  else
541 #    define SMB_STRUCT_STAT struct stat
542 #  endif
543 #endif
544
545 /*
546  * Type for dirent structure.
547  */
548
549 #ifndef SMB_STRUCT_DIRENT
550 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64)
551 #    define SMB_STRUCT_DIRENT struct dirent64
552 #  else
553 #    define SMB_STRUCT_DIRENT struct dirent
554 #  endif
555 #endif
556
557 /*
558  * Defines for 64 bit fcntl locks.
559  */
560
561 #ifndef SMB_STRUCT_FLOCK
562 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
563 #    define SMB_STRUCT_FLOCK struct flock64
564 #  else
565 #    define SMB_STRUCT_FLOCK struct flock
566 #  endif
567 #endif
568
569 #ifndef SMB_F_SETLKW
570 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
571 #    define SMB_F_SETLKW F_SETLKW64
572 #  else
573 #    define SMB_F_SETLKW F_SETLKW
574 #  endif
575 #endif
576
577 #ifndef SMB_F_SETLK
578 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
579 #    define SMB_F_SETLK F_SETLK64
580 #  else
581 #    define SMB_F_SETLK F_SETLK
582 #  endif
583 #endif
584
585 #ifndef SMB_F_GETLK
586 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
587 #    define SMB_F_GETLK F_GETLK64
588 #  else
589 #    define SMB_F_GETLK F_GETLK
590 #  endif
591 #endif
592
593 #if defined(HAVE_LONGLONG)
594 #define SMB_BIG_UINT unsigned long long
595 #define SMB_BIG_INT long long
596 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
597 #else
598 #define SMB_BIG_UINT unsigned long
599 #define SMB_BIG_INT long
600 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
601 #endif
602
603 #define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8)
604
605 #ifndef MIN
606 #define MIN(a,b) ((a)<(b)?(a):(b))
607 #endif
608
609 #ifndef MAX
610 #define MAX(a,b) ((a)>(b)?(a):(b))
611 #endif
612
613 #ifndef HAVE_STRERROR
614 extern char *sys_errlist[];
615 #define strerror(i) sys_errlist[i]
616 #endif
617
618 #ifndef HAVE_STRCHR
619 # define strchr                 index
620 # define strrchr                rindex
621 #endif
622
623 #ifndef HAVE_ERRNO_DECL
624 extern int errno;
625 #endif
626
627 #ifdef HAVE_BROKEN_GETGROUPS
628 #define GID_T int
629 #else
630 #define GID_T gid_t
631 #endif
632
633 #ifndef NGROUPS_MAX
634 #define NGROUPS_MAX 32 /* Guess... */
635 #endif
636
637 /* Lists, trees, caching, datbase... */
638 #include "ubi_sLinkList.h"
639 #include "ubi_dLinkList.h"
640 #include "dlinklist.h"
641 #include "../tdb/tdb.h"
642 #include "talloc.h"
643 #include "interfaces.h"
644 #include "hash.h"
645
646 #ifdef HAVE_FNMATCH
647 #include <fnmatch.h>
648 #else
649 #include "fnmatch.h"
650 #endif
651
652 #ifndef UBI_BINTREE_H
653 #include "ubi_Cache.h"
654 #endif /* UBI_BINTREE_H */
655
656 #include "debugparse.h"
657
658 #include "version.h"
659 #include "smb.h"
660 #include "smbw.h"
661 #include "nameserv.h"
662
663 #include "byteorder.h"
664
665 #include "kanji.h"
666 #include "charset.h"
667
668 #include "nterr.h"
669
670 #include "msdfs.h"
671
672 #ifdef WITH_PROFILE
673 #include "profile.h"
674 #endif
675
676 #ifndef MAXCODEPAGELINES
677 #define MAXCODEPAGELINES 256
678 #endif
679
680 /*
681  * Type for wide character dirent structure.
682  * Only d_name is defined by POSIX.
683  */
684
685 typedef struct smb_wdirent {
686         wpstring        d_name;
687 } SMB_STRUCT_WDIRENT;
688
689 /*
690  * Type for wide character passwd structure.
691  */
692
693 typedef struct smb_wpasswd {
694         wfstring       pw_name;
695         char           *pw_passwd;
696         uid_t          pw_uid;
697         gid_t          pw_gid;
698         wpstring       pw_gecos;
699         wpstring       pw_dir;
700         wpstring       pw_shell;
701 } SMB_STRUCT_WPASSWD;
702
703 /* Defines for wisXXX functions. */
704 #define UNI_UPPER    0x1
705 #define UNI_LOWER    0x2
706 #define UNI_DIGIT    0x4
707 #define UNI_XDIGIT   0x8
708 #define UNI_SPACE    0x10
709
710 /***** automatically generated prototypes *****/
711 #include "proto.h"
712
713 /* String routines */
714
715 #include "safe_string.h"
716
717 #ifdef __COMPAR_FN_T
718 #define QSORT_CAST (__compar_fn_t)
719 #endif
720
721 #ifndef QSORT_CAST
722 #define QSORT_CAST (int (*)(const void *, const void *))
723 #endif
724
725 /* this guess needs to be improved (tridge) */
726 #if (defined(STAT_STATVFS) || defined(STAT_STATVFS64)) && !defined(SYSV)
727 #define SYSV 1
728 #endif
729
730 #ifndef DEFAULT_PRINTING
731 #ifdef HAVE_LIBCUPS
732 #define DEFAULT_PRINTING PRINT_CUPS
733 #define PRINTCAP_NAME "cups"
734 #elif defined(SYSV)
735 #define DEFAULT_PRINTING PRINT_SYSV
736 #define PRINTCAP_NAME "lpstat"
737 #else
738 #define DEFAULT_PRINTING PRINT_BSD
739 #define PRINTCAP_NAME "/etc/printcap"
740 #endif
741 #endif
742
743 #ifndef PRINTCAP_NAME
744 #define PRINTCAP_NAME "/etc/printcap"
745 #endif
746
747 #ifndef SIGCLD
748 #define SIGCLD SIGCHLD
749 #endif
750
751 #if (defined(HAVE_SYSV_IPC) || defined(HAVE_SHARED_MMAP))
752 #define FAST_SHARE_MODES 1
753 #endif
754
755 #ifndef MAP_FILE
756 #define MAP_FILE 0
757 #endif
758
759 #ifdef HAVE_SYSV_IPC
760 #ifndef HAVE_UNION_SEMUN
761 union semun {
762         int val;
763         struct semid_ds *buf;
764         unsigned short *array;
765 };
766 #endif
767 #endif
768
769 #if (!defined(WITH_NISPLUS) && !defined(WITH_LDAP))
770 #define USE_SMBPASS_DB 1
771 #endif
772
773 #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
774 #define OSF1_ENH_SEC 1
775 #endif
776
777 #ifndef ALLOW_CHANGE_PASSWORD
778 #if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
779 #define ALLOW_CHANGE_PASSWORD 1
780 #endif
781 #endif
782
783 /* what is the longest significant password available on your system? 
784  Knowing this speeds up password searches a lot */
785 #ifndef PASSWORD_LENGTH
786 #define PASSWORD_LENGTH 8
787 #endif
788
789 #ifdef REPLACE_INET_NTOA
790 #define inet_ntoa rep_inet_ntoa
791 #endif
792
793 #ifndef HAVE_PIPE
794 #define SYNC_DNS 1
795 #endif
796
797 #ifndef MAXPATHLEN
798 #define MAXPATHLEN 256
799 #endif
800
801 #ifndef SEEK_SET
802 #define SEEK_SET 0
803 #endif
804
805 #ifndef INADDR_LOOPBACK
806 #define INADDR_LOOPBACK 0x7f000001
807 #endif
808
809 #ifndef INADDR_NONE
810 #define INADDR_NONE 0xffffffff
811 #endif
812
813 #ifndef HAVE_CRYPT
814 #define crypt ufc_crypt
815 #endif
816
817 #ifndef O_ACCMODE
818 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
819 #endif
820
821 #if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
822 #define ULTRIX_AUTH 1
823 #endif
824
825 #ifdef HAVE_LIBREADLINE
826 #  ifdef HAVE_READLINE_READLINE_H
827 #    include <readline/readline.h>
828 #    ifdef HAVE_READLINE_HISTORY_H
829 #      include <readline/history.h>
830 #    endif
831 #  else
832 #    ifdef HAVE_READLINE_H
833 #      include <readline.h>
834 #      ifdef HAVE_HISTORY_H
835 #        include <history.h>
836 #      endif
837 #    else
838 #      undef HAVE_LIBREADLINE
839 #    endif
840 #  endif
841 #endif
842
843 #ifndef HAVE_STRDUP
844 char *strdup(const char *s);
845 #endif
846
847 #ifndef HAVE_MEMMOVE
848 void *memmove(void *dest,const void *src,int size);
849 #endif
850
851 #ifndef HAVE_INITGROUPS
852 int initgroups(char *name,gid_t id);
853 #endif
854
855 #ifndef HAVE_RENAME
856 int rename(const char *zfrom, const char *zto);
857 #endif
858
859 #ifndef HAVE_MKTIME
860 time_t mktime(struct tm *t);
861 #endif
862
863 #ifndef HAVE_FTRUNCATE
864 int ftruncate(int f,long l);
865 #endif
866
867 #ifndef HAVE_STRTOUL
868 unsigned long strtoul(const char *nptr, char **endptr, int base);
869 #endif
870
871 #if (defined(USE_SETRESUID) && !defined(HAVE_SETRESUID_DECL))
872 /* stupid glibc */
873 int setresuid(uid_t ruid, uid_t euid, uid_t suid);
874 #endif
875 #if (defined(USE_SETRESUID) && !defined(HAVE_SETRESGID_DECL))
876 int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
877 #endif
878
879 #if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
880 #define bzero(a,b) memset((a),'\0',(b))
881 #endif
882
883 #ifdef REPLACE_GETPASS
884 #define getpass(prompt) getsmbpass((prompt))
885 #endif
886
887 /*
888  * Some older systems seem not to have MAXHOSTNAMELEN
889  * defined.
890  */
891 #ifndef MAXHOSTNAMELEN
892 #define MAXHOSTNAMELEN 254
893 #endif
894
895 /* yuck, I'd like a better way of doing this */
896 #define DIRP_SIZE (256 + 32)
897
898 /*
899  * glibc on linux doesn't seem to have MSG_WAITALL
900  * defined. I think the kernel has it though..
901  */
902
903 #ifndef MSG_WAITALL
904 #define MSG_WAITALL 0
905 #endif
906
907 /* default socket options. Dave Miller thinks we should default to TCP_NODELAY
908    given the socket IO pattern that Samba uses */
909 #ifdef TCP_NODELAY
910 #define DEFAULT_SOCKET_OPTIONS "TCP_NODELAY"
911 #else
912 #define DEFAULT_SOCKET_OPTIONS ""
913 #endif
914
915 /* Load header file for libdl stuff */
916
917 #ifdef HAVE_LIBDL
918 #include <dlfcn.h>
919 #endif
920
921 #endif /* _INCLUDES_H */