first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
[gd/samba-autobuild/.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_SYSCALL_H
114 #include <sys/syscall.h>
115 #elif HAVE_SYSCALL_H
116 #include <syscall.h>
117 #endif
118
119 #ifdef HAVE_STRING_H
120 #include <string.h>
121 #endif
122
123 #ifdef HAVE_STRINGS_H
124 #include <strings.h>
125 #endif
126
127 #ifdef HAVE_MEMORY_H
128 #include <memory.h>
129 #endif
130
131 #ifdef MEM_MAN
132 #include "../mem_man/mem_man.h"
133 #else
134 #ifdef HAVE_MALLOC_H
135 #include <malloc.h>
136 #endif
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 #include <grp.h>
202
203 #ifdef HAVE_STDARG_H
204 #include <stdarg.h>
205 #else
206 #include <varargs.h>
207 #endif
208
209 #include <netinet/in.h>
210 #include <arpa/inet.h>
211 #include <netdb.h>
212 #include <syslog.h>
213 #include <sys/file.h>
214
215 #ifdef HAVE_NETINET_TCP_H
216 #include <netinet/tcp.h>
217 #endif
218
219 /*
220  * The next three defines are needed to access the IPTOS_* options
221  * on some systems.
222  */
223
224 #ifdef HAVE_NETINET_IN_SYSTM_H
225 #include <netinet/in_systm.h>
226 #endif
227
228 #ifdef HAVE_NETINET_IN_IP_H
229 #include <netinet/in_ip.h>
230 #endif
231
232 #ifdef HAVE_NETINET_IP_H
233 #include <netinet/ip.h>
234 #endif
235
236 #if defined(HAVE_TERMIOS_H)
237 /* POSIX terminal handling. */
238 #include <termios.h>
239 #elif defined(HAVE_TERMIO_H)
240 /* Older SYSV terminal handling - don't use if we can avoid it. */
241 #include <termio.h>
242 #elif defined(HAVE_SYS_TERMIO_H)
243 /* Older SYSV terminal handling - don't use if we can avoid it. */
244 #include <sys/termio.h>
245 #endif
246
247 #if HAVE_DIRENT_H
248 # include <dirent.h>
249 # define NAMLEN(dirent) strlen((dirent)->d_name)
250 #else
251 # define dirent direct
252 # define NAMLEN(dirent) (dirent)->d_namlen
253 # if HAVE_SYS_NDIR_H
254 #  include <sys/ndir.h>
255 # endif
256 # if HAVE_SYS_DIR_H
257 #  include <sys/dir.h>
258 # endif
259 # if HAVE_NDIR_H
260 #  include <ndir.h>
261 # endif
262 #endif
263
264 #ifdef HAVE_SYS_MMAN_H
265 #include <sys/mman.h>
266 #endif
267
268 #ifdef HAVE_SYSV_IPC
269 #include <sys/ipc.h>
270 #include <sys/shm.h>
271 #include <sys/sem.h>
272 #endif
273
274 #ifdef HAVE_NET_IF_H
275 #include <net/if.h>
276 #endif
277
278
279 #ifdef HAVE_SYS_MOUNT_H
280 #include <sys/mount.h>
281 #endif
282
283 #ifdef HAVE_SYS_VFS_H
284 #include <sys/vfs.h>
285 #endif
286
287 #ifdef HAVE_SYS_ACL_H
288 #include <sys/acl.h>
289 #endif
290
291 #ifdef HAVE_SYS_FS_S5PARAM_H 
292 #include <sys/fs/s5param.h>
293 #endif
294
295 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
296 #include <sys/filsys.h> 
297 #endif
298
299 #ifdef HAVE_SYS_STATFS_H
300 # include <sys/statfs.h>
301 #endif
302
303 #ifdef HAVE_DUSTAT_H              
304 #include <sys/dustat.h>
305 #endif
306
307 #ifdef HAVE_SYS_STATVFS_H          
308 #include <sys/statvfs.h>
309 #endif
310
311 #ifdef HAVE_SHADOW_H
312 #include <shadow.h>
313 #endif
314
315 #ifdef HAVE_GETPWANAM
316 #include <sys/label.h>
317 #include <sys/audit.h>
318 #include <pwdadj.h>
319 #endif
320
321 #ifdef HAVE_SYS_SECURITY_H
322 #include <sys/security.h>
323 #include <prot.h>
324 #define PASSWORD_LENGTH 16
325 #endif  /* HAVE_SYS_SECURITY_H */
326
327 #ifdef HAVE_COMPAT_H
328 #include <compat.h>
329 #endif
330
331 #ifdef HAVE_STROPTS_H
332 #include <stropts.h>
333 #endif
334
335 #ifdef HAVE_POLL_H
336 #include <poll.h>
337 #endif
338
339 #ifdef HAVE_SYS_CAPABILITY_H
340 #include <sys/capability.h>
341 #endif
342
343 #if defined(HAVE_RPC_RPC_H)
344 /*
345  * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h.
346  */
347 #if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT)
348 #undef AUTH_ERROR
349 #endif
350 #include <rpc/rpc.h>
351 #endif
352
353 #if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT)
354 #define HAVE_NETGROUP 1
355 #endif
356
357 #if defined (HAVE_NETGROUP)
358 #if defined(HAVE_RPCSVC_YP_PROT_H)
359 #include <rpcsvc/yp_prot.h>
360 #endif
361 #if defined(HAVE_RPCSVC_YPCLNT_H)
362 #include <rpcsvc/ypclnt.h>
363 #endif
364 #endif /* HAVE_NETGROUP */
365
366 /*
367  * Define VOLATILE if needed.
368  */
369
370 #if defined(HAVE_VOLATILE)
371 #define VOLATILE volatile
372 #else
373 #define VOLATILE
374 #endif
375
376 /*
377  * Define SIG_ATOMIC_T if needed.
378  */
379
380 #if defined(HAVE_SIG_ATOMIC_T_TYPE)
381 #define SIG_ATOMIC_T sig_atomic_t
382 #else
383 #define SIG_ATOMIC_T int
384 #endif
385
386 #ifndef uchar
387 #define uchar unsigned char
388 #endif
389
390 #ifdef HAVE_UNSIGNED_CHAR
391 #define schar signed char
392 #else
393 #define schar char
394 #endif
395
396 /*
397    Samba needs type definitions for int16, int32, uint16 and uint32.
398
399    Normally these are signed and unsigned 16 and 32 bit integers, but
400    they actually only need to be at least 16 and 32 bits
401    respectively. Thus if your word size is 8 bytes just defining them
402    as signed and unsigned int will work.
403 */
404
405 #ifndef uint8
406 #define uint8 unsigned char
407 #endif
408
409 #if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
410 #if (SIZEOF_SHORT == 4)
411 #define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
412 #else /* SIZEOF_SHORT != 4 */
413 #define int16 short
414 #endif /* SIZEOF_SHORT != 4 */
415 #endif
416
417 /*
418  * Note we duplicate the size tests in the unsigned 
419  * case as int16 may be a typedef from rpc/rpc.h
420  */
421
422 #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
423 #if (SIZEOF_SHORT == 4)
424 #define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
425 #else /* SIZEOF_SHORT != 4 */
426 #define uint16 unsigned short
427 #endif /* SIZEOF_SHORT != 4 */
428 #endif
429
430 #if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
431 #if (SIZEOF_INT == 4)
432 #define int32 int
433 #elif (SIZEOF_LONG == 4)
434 #define int32 long
435 #elif (SIZEOF_SHORT == 4)
436 #define int32 short
437 #endif
438 #endif
439
440 /*
441  * Note we duplicate the size tests in the unsigned 
442  * case as int32 may be a typedef from rpc/rpc.h
443  */
444
445 #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
446 #if (SIZEOF_INT == 4)
447 #define uint32 unsigned int
448 #elif (SIZEOF_LONG == 4)
449 #define uint32 unsigned long
450 #elif (SIZEOF_SHORT == 4)
451 #define uint32 unsigned short
452 #endif
453 #endif
454
455 /*
456  * Types for devices, inodes and offsets.
457  */
458
459 #ifndef SMB_DEV_T
460 #define SMB_DEV_T dev_t
461 #endif
462
463 /*
464  * Setup the correctly sized inode type.
465  */
466
467 #ifndef SMB_INO_T
468 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)
469 #    define SMB_INO_T ino64_t
470 #  else
471 #    define SMB_INO_T ino_t
472 #  endif
473 #endif
474
475 #ifndef LARGE_SMB_INO_T
476 #  if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)) || (defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8))
477 #    define LARGE_SMB_INO_T 1
478 #  endif
479 #endif
480
481 #ifdef LARGE_SMB_INO_T
482 #define SINO_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
483 #else 
484 #define SINO_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
485 #endif
486
487 #ifndef SMB_OFF_T
488 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
489 #    define SMB_OFF_T off64_t
490 #  else
491 #    define SMB_OFF_T off_t
492 #  endif
493 #endif
494
495 #define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
496
497 /*
498  * Set the define that tells us if we can do 64 bit
499  * NT SMB calls.
500  */
501
502 #ifndef LARGE_SMB_OFF_T
503 #  if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
504 #    define LARGE_SMB_OFF_T 1
505 #  endif
506 #endif
507
508 #ifdef LARGE_SMB_OFF_T
509 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
510 #else 
511 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
512 #endif
513
514 /*
515  * Type for stat structure.
516  */
517
518 #ifndef SMB_STRUCT_STAT
519 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
520 #    define SMB_STRUCT_STAT struct stat64
521 #  else
522 #    define SMB_STRUCT_STAT struct stat
523 #  endif
524 #endif
525
526 /*
527  * Type for dirent structure.
528  */
529
530 #ifndef SMB_STRUCT_DIRENT
531 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64)
532 #    define SMB_STRUCT_DIRENT struct dirent64
533 #  else
534 #    define SMB_STRUCT_DIRENT struct dirent
535 #  endif
536 #endif
537
538 /*
539  * Defines for 64 bit fcntl locks.
540  */
541
542 #ifndef SMB_STRUCT_FLOCK
543 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
544 #    define SMB_STRUCT_FLOCK struct flock64
545 #  else
546 #    define SMB_STRUCT_FLOCK struct flock
547 #  endif
548 #endif
549
550 #ifndef SMB_F_SETLKW
551 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
552 #    define SMB_F_SETLKW F_SETLKW64
553 #  else
554 #    define SMB_F_SETLKW F_SETLKW
555 #  endif
556 #endif
557
558 #ifndef SMB_F_SETLK
559 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
560 #    define SMB_F_SETLK F_SETLK64
561 #  else
562 #    define SMB_F_SETLK F_SETLK
563 #  endif
564 #endif
565
566 #ifndef SMB_F_GETLK
567 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
568 #    define SMB_F_GETLK F_GETLK64
569 #  else
570 #    define SMB_F_GETLK F_GETLK
571 #  endif
572 #endif
573
574 #if defined(HAVE_LONGLONG)
575 #define SMB_BIG_UINT unsigned long long
576 #define SMB_BIG_INT long long
577 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
578 #else
579 #define SMB_BIG_UINT unsigned long
580 #define SMB_BIG_INT long
581 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
582 #endif
583
584 #ifndef MIN
585 #define MIN(a,b) ((a)<(b)?(a):(b))
586 #endif
587
588 #ifndef MAX
589 #define MAX(a,b) ((a)>(b)?(a):(b))
590 #endif
591
592 #ifndef HAVE_STRERROR
593 extern char *sys_errlist[];
594 #define strerror(i) sys_errlist[i]
595 #endif
596
597 #ifndef HAVE_STRCHR
598 # define strchr                 index
599 # define strrchr                rindex
600 #endif
601
602 #ifndef HAVE_ERRNO_DECL
603 extern int errno;
604 #endif
605
606 #ifdef HAVE_BROKEN_GETGROUPS
607 #define GID_T int
608 #else
609 #define GID_T gid_t
610 #endif
611
612
613 /* Lists, trees, caching, datbase... */
614 #include "ubi_sLinkList.h"
615 #include "ubi_dLinkList.h"
616 #include "dlinklist.h"
617 #include "interfaces.h"
618
619 #ifdef HAVE_FNMATCH
620 #include <fnmatch.h>
621 #else
622 #include "fnmatch.h"
623 #endif
624
625 #ifndef UBI_BINTREE_H
626 #include "ubi_Cache.h"
627 #endif /* UBI_BINTREE_H */
628
629 #include "debugparse.h"
630
631 #include "version.h"
632 #include "smb.h"
633 #include "smbw.h"
634 #include "nameserv.h"
635
636 #include "byteorder.h"
637
638 #include "kanji.h"
639 #include "charset.h"
640
641 #include "nterr.h"
642
643 #ifdef WITH_PROFILE
644 #include "profile.h"
645 #endif
646
647 #ifndef MAXCODEPAGELINES
648 #define MAXCODEPAGELINES 256
649 #endif
650
651 /***** automatically generated prototypes *****/
652 #include "proto.h"
653
654 #ifdef strcpy
655 #undef strcpy
656 #endif /* strcpy */
657 #define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
658
659 #ifdef strcat
660 #undef strcat
661 #endif /* strcat */
662 #define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
663
664 #ifdef sprintf
665 #undef sprintf
666 #endif /* sprintf */
667 #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
668
669 #define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
670 #define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
671 #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
672 #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
673
674 #ifdef __COMPAR_FN_T
675 #define QSORT_CAST (__compar_fn_t)
676 #endif
677
678 #ifndef QSORT_CAST
679 #define QSORT_CAST (int (*)(const void *, const void *))
680 #endif
681
682 /* this guess needs to be improved (tridge) */
683 #if (defined(STAT_STATVFS) || defined(STAT_STATVFS64)) && !defined(SYSV)
684 #define SYSV 1
685 #endif
686
687 #ifndef DEFAULT_PRINTING
688 #ifdef HAVE_LIBCUPS
689 #define DEFAULT_PRINTING PRINT_CUPS
690 #define PRINTCAP_NAME "cups"
691 #elif defined(SYSV)
692 #define DEFAULT_PRINTING PRINT_SYSV
693 #define PRINTCAP_NAME "lpstat"
694 #else
695 #define DEFAULT_PRINTING PRINT_BSD
696 #define PRINTCAP_NAME "/etc/printcap"
697 #endif
698 #endif
699
700 #ifndef PRINTCAP_NAME
701 #define PRINTCAP_NAME "/etc/printcap"
702 #endif
703
704 #ifndef SIGCLD
705 #define SIGCLD SIGCHLD
706 #endif
707
708 #if (defined(HAVE_SYSV_IPC) || defined(HAVE_SHARED_MMAP))
709 #define FAST_SHARE_MODES 1
710 #endif
711
712 #ifndef MAP_FILE
713 #define MAP_FILE 0
714 #endif
715
716 #ifdef HAVE_SYSV_IPC
717 #ifndef HAVE_UNION_SEMUN
718 union semun {
719         int val;
720         struct semid_ds *buf;
721         unsigned short *array;
722 };
723 #endif
724 #endif
725
726 #if (!defined(WITH_NISPLUS) && !defined(WITH_LDAP))
727 #define USE_SMBPASS_DB 1
728 #endif
729
730 #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
731 #define OSF1_ENH_SEC 1
732 #endif
733
734 #ifndef ALLOW_CHANGE_PASSWORD
735 #if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
736 #define ALLOW_CHANGE_PASSWORD 1
737 #endif
738 #endif
739
740 /* what is the longest significant password available on your system? 
741  Knowing this speeds up password searches a lot */
742 #ifndef PASSWORD_LENGTH
743 #define PASSWORD_LENGTH 8
744 #endif
745
746 #ifdef REPLACE_INET_NTOA
747 #define inet_ntoa rep_inet_ntoa
748 #endif
749
750 #ifndef HAVE_PIPE
751 #define SYNC_DNS 1
752 #endif
753
754 #ifndef MAXPATHLEN
755 #define MAXPATHLEN 256
756 #endif
757
758 #ifndef SEEK_SET
759 #define SEEK_SET 0
760 #endif
761
762 #ifndef INADDR_LOOPBACK
763 #define INADDR_LOOPBACK 0x7f000001
764 #endif
765
766 #ifndef INADDR_NONE
767 #define INADDR_NONE 0xffffffff
768 #endif
769
770 #ifndef HAVE_CRYPT
771 #define crypt ufc_crypt
772 #endif
773
774 #ifndef O_ACCMODE
775 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
776 #endif
777
778 #if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
779 #define ULTRIX_AUTH 1
780 #endif
781
782 #ifdef HAVE_LIBREADLINE
783 #  ifdef HAVE_READLINE_READLINE_H
784 #    include <readline/readline.h>
785 #    ifdef HAVE_READLINE_HISTORY_H
786 #      include <readline/history.h>
787 #    endif
788 #  else
789 #    ifdef HAVE_READLINE_H
790 #      include <readline.h>
791 #      ifdef HAVE_HISTORY_H
792 #        include <history.h>
793 #      endif
794 #    else
795 #      undef HAVE_LIBREADLINE
796 #    endif
797 #  endif
798 #endif
799
800 #ifndef HAVE_STRDUP
801 char *strdup(const char *s);
802 #endif
803
804 #ifndef HAVE_MEMMOVE
805 void *memmove(void *dest,const void *src,int size);
806 #endif
807
808 #ifndef HAVE_INITGROUPS
809 int initgroups(char *name,gid_t id);
810 #endif
811
812 #ifndef HAVE_RENAME
813 int rename(const char *zfrom, const char *zto);
814 #endif
815
816 #ifndef HAVE_MKTIME
817 time_t mktime(struct tm *t);
818 #endif
819
820 #ifndef HAVE_FTRUNCATE
821 int ftruncate(int f,long l);
822 #endif
823
824 #ifndef HAVE_STRTOUL
825 unsigned long strtoul(const char *nptr, char **endptr, int base);
826 #endif
827
828 #if (defined(USE_SETRESUID) && !defined(HAVE_SETRESUID_DECL))
829 /* stupid glibc */
830 int setresuid(uid_t ruid, uid_t euid, uid_t suid);
831 #endif
832 #if (defined(USE_SETRESUID) && !defined(HAVE_SETRESGID_DECL))
833 int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
834 #endif
835
836 #if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
837 #define bzero(a,b) memset((a),'\0',(b))
838 #endif
839
840 #ifdef REPLACE_GETPASS
841 #define getpass(prompt) getsmbpass((prompt))
842 #endif
843
844 /*
845  * Some older systems seem not to have MAXHOSTNAMELEN
846  * defined.
847  */
848 #ifndef MAXHOSTNAMELEN
849 #define MAXHOSTNAMELEN 254
850 #endif
851
852 /* yuck, I'd like a better way of doing this */
853 #define DIRP_SIZE (256 + 32)
854
855 /*
856  * glibc on linux doesn't seem to have MSG_WAITALL
857  * defined. I think the kernel has it though..
858  */
859
860 #ifndef MSG_WAITALL
861 #define MSG_WAITALL 0
862 #endif
863
864 /* default socket options. Dave Miller thinks we should default to TCP_NODELAY
865    given the socket IO pattern that Samba uses */
866 #ifdef TCP_NODELAY
867 #define DEFAULT_SOCKET_OPTIONS "TCP_NODELAY"
868 #else
869 #define DEFAULT_SOCKET_OPTIONS ""
870 #endif
871
872 #endif /* _INCLUDES_H */