JHT ==> Added extensions for PAM (Pluggable Authentication Module) support
[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-1995
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    This file does all the #includes's. This makes it easier to
25    port to a new unix. Hopefully a port will only have to edit the Makefile
26    and add a section for the new unix below.
27 */
28
29
30 /* the first OS dependent section is to setup what includes will be used.
31    the main OS dependent section comes later on 
32 */
33
34 #ifdef ALTOS
35 #define NO_UTIMEH
36 #endif
37
38 #ifdef MIPS
39 #define POSIX_H
40 #define NO_UTIMEH
41 #endif
42
43 #ifdef sun386
44 #define NO_UTIMEH
45 #endif
46
47 #ifdef NEXT2
48 #define NO_UTIMEH
49 #endif
50
51 #ifdef NEXT3_0
52 #define NO_UTIMEH
53 #define NO_UNISTDH
54 #endif
55
56 #ifdef APOLLO
57 #define NO_UTIMEH
58 #define NO_SYSMOUNTH
59 #define NO_UNISTDH
60 #endif
61
62 #ifdef AIX
63 #define NO_SYSMOUNTH
64 #endif
65
66 #ifdef M88K_R3
67 #define SVR3H
68 #define NO_RESOURCEH
69 #endif
70
71 #ifdef DNIX
72 #define NO_SYSMOUNTH
73 #define NO_NETIFH
74 #define NO_RESOURCEH
75 #define PRIME_NMBD 0
76 #define NO_SETGROUPS
77 #endif
78
79
80 #ifdef ISC
81 #define SYSSTREAMH
82 #define NO_RESOURCEH
83 #endif
84
85 #ifdef QNX
86 #define NO_RESOURCEH
87 #define NO_SYSMOUNTH
88 #define USE_MMAP 1
89 #ifdef __386__
90    #define __i386__
91 #endif
92 #endif
93
94 #ifdef NEWS42
95 #define NO_UTIMEH
96 #define NO_STRFTIME
97 #define NO_UTIMBUF
98 #define REPLACE_MKTIME
99 #define NO_TM_NAME
100 #endif
101
102 #ifdef OS2
103 #define NO_SYSMOUNTH
104 #define NO_NETIFH
105 #endif
106
107 #ifdef LYNX
108 #define NO_SYSMOUNTH
109 #endif
110
111
112 #if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
113 #define PASSWORD_LENGTH 16
114 #endif
115
116 /* here is the general includes section - with some ifdefs generated 
117    by the previous section 
118 */
119 #include "local.h"
120 #include <stdio.h>
121 #ifdef POSIX_STDLIBH
122 #include <posix/stdlib.h>
123 #else
124 #include <stdlib.h>
125 #endif
126 #include <ctype.h>
127 #include <time.h>
128 #ifndef NO_UTIMEH
129 #include <utime.h>
130 #endif
131 #include <sys/types.h>
132
133 #ifdef SVR3H
134 #include <sys/statfs.h>
135 #include <sys/stream.h>
136 #include <netinet/types.h>
137 #include <netinet/ether.h>
138 #include <netinet/ip_if.h>
139 #endif
140
141 #include <sys/socket.h>
142 #include <sys/ioctl.h>
143 #include <stddef.h>
144 #ifdef POSIX_H
145 #include <posix/utime.h>
146 #include <bsd/sys/time.h>
147 #include <bsd/netinet/in.h>
148 #else
149 #include <sys/time.h>
150 #include <netinet/in.h>
151 #endif 
152 #include <netdb.h>
153 #include <signal.h>
154 #include <errno.h>
155 #include <sys/file.h>
156 #include <sys/stat.h>
157 #include <sys/param.h>
158 #include <grp.h>
159 #ifndef NO_RESOURCEH
160 #include <sys/resource.h>
161 #endif
162 #ifndef NO_SYSMOUNTH
163 #include <sys/mount.h>
164 #endif
165 #include <pwd.h>
166 #ifdef __STDC__
167 #include <stdarg.h>
168 #else
169 #include <varargs.h>
170 #endif
171 #ifndef NO_UNISTDH
172 #include <unistd.h>
173 #endif
174 #include <sys/wait.h>
175 #ifdef SYSSTREAMH
176 #include <sys/stream.h>
177 #endif
178 #ifndef NO_NETIFH
179 #ifdef POSIX_H
180 #include <bsd/net/if.h>
181 #else
182 #include <net/if.h>
183 #endif
184 #endif
185
186 #if defined(GETPWANAM)
187 #include <sys/types.h>
188 #include <sys/label.h>
189 #include <sys/audit.h>
190 #include <pwdadj.h>
191 #endif
192
193 #if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(FreeBSD) && !defined(CONVEX)
194 #include <shadow.h>
195 #endif
196
197 #ifdef SYSLOG
198 #include <syslog.h>
199 #endif
200
201
202
203 /***************************************************************************
204 Here come some platform specific sections
205 ***************************************************************************/
206
207
208 #ifdef LINUX
209 #include <arpa/inet.h>
210 #include <dirent.h>
211 #include <string.h>
212 #include <sys/vfs.h>
213 #include <netinet/in.h>
214 #ifndef NO_ASMSIGNALH
215 #include <asm/signal.h>
216 #endif
217 #define SIGNAL_CAST (__sighandler_t)
218 #define USE_GETCWD
219 #define USE_SETSID
220 #define HAVE_BZERO
221 #define HAVE_MEMMOVE
222 #define USE_SIGPROCMASK
223 #define USE_WAITPID
224 #if 0
225 /* SETFS disabled until we can check on some bug reports */
226 #if _LINUX_C_LIB_VERSION_MAJOR >= 5
227 #define USE_SETFS
228 #endif
229 #endif
230 #ifdef SHADOW_PWD
231 #if _LINUX_C_LIB_VERSION_MAJOR < 5
232 #ifndef crypt
233 #define crypt pw_encrypt
234 #endif
235 #endif
236 #endif
237 #endif
238
239 #ifdef SUNOS4
240 #define SIGNAL_CAST (void (*)(int))
241 #include <netinet/tcp.h>
242 #include <dirent.h>
243 #include <sys/acct.h>
244 #include <sys/vfs.h>
245 #include <string.h>
246 #include <errno.h>
247 #include <sys/wait.h>
248 #include <signal.h>
249 /* #include <termios.h> */
250 #ifdef sun386
251 #define NO_STRFTIME
252 #define NO_UTIMBUF
253 #define mktime timelocal
254 typedef unsigned short mode_t;
255 #else
256 #include <utime.h>
257 #define NO_STRERROR
258 #endif
259 #define REPLACE_GETPASS
260 #define BSD_TERMIO
261 #define USE_SIGPROCMASK
262 #define USE_WAITPID
263 #endif
264
265
266 #ifdef SUNOS5
267 #include <fcntl.h>
268 #include <dirent.h>
269 #include <sys/acct.h>
270 #include <sys/statfs.h>
271 #include <sys/statvfs.h>
272 #include <sys/filio.h>
273 #include <sys/sockio.h>
274 #include <netinet/in_systm.h>
275 #include <netinet/tcp.h>
276 #include <netinet/ip.h>
277 #include <string.h>
278 #include <arpa/inet.h>
279 #include <rpcsvc/ypclnt.h>
280 #include <crypt.h> 
281 #include <termios.h>
282 extern int gettimeofday (struct timeval *, void *);
283 extern int gethostname (char *name, int namelen);
284 extern int innetgr (const char *, const char *, const char *, const char *);
285 #define USE_SETVBUF
286 #define SIGNAL_CAST (void (*)(int))
287 #ifndef SYSV
288 #define SYSV
289 #endif
290 #define USE_WAITPID
291 #define REPLACE_STRLEN
292 #define USE_STATVFS
293 #define USE_GETCWD
294 #define USE_SETSID
295 #define REPLACE_GETPASS
296 #define USE_SIGPROCMASK
297 #endif
298
299
300 #ifdef ULTRIX
301 #include <strings.h>
302 #include <nfs/nfs_clnt.h>
303 #include <nfs/vfs.h>
304 #include <netinet/tcp.h>
305 #ifdef ULTRIX_AUTH
306 #include <auth.h>
307 #endif
308 char *getwd(char *);
309 #define NOSTRDUP
310 #ifdef __STDC__
311 #define SIGNAL_CAST (void(*)(int))
312 #endif
313 #define USE_DIRECT
314 #define USE_WAITPID
315 #endif
316
317 #ifdef SGI
318 #include <netinet/tcp.h>
319 #include <sys/statfs.h>
320 #include <string.h>
321 #include <signal.h>
322 #ifndef SYSV
323 #define SYSV
324 #endif
325 #define SIGNAL_CAST (void (*)())
326 #define STATFS4
327 #define USE_WAITPID
328 #define USE_DIRECT
329 #endif
330
331 #ifdef SGI5
332 #include <netinet/tcp.h>
333 #include <sys/statvfs.h>
334 #include <string.h>
335 #include <signal.h>
336 #include <dirent.h>
337 #define USE_WAITPID
338 #define NETGROUP 
339 #ifndef SYSV
340 #define SYSV
341 #endif
342 #define SIGNAL_CAST (void (*)())
343 #define USE_STATVFS
344 #define USE_WAITPID
345 #endif
346
347
348 #ifdef MIPS
349 #include <bsd/net/soioctl.h>
350 #include <string.h>
351 #include <dirent.h>
352 #include <fcntl.h>
353 #include <sys/statfs.h>
354 #include <sys/wait.h>
355 #include <sys/termio.h>
356 #define SIGNAL_CAST (void (*)())
357 typedef int mode_t;
358 extern struct group *getgrnam();
359 extern struct passwd *getpwnam();
360 #define STATFS4
361 #define NO_STRERROR
362 #define REPLACE_STRSTR
363 #endif /* MIPS */
364
365
366
367 #ifdef DGUX
368 #include <string.h>
369 #include <dirent.h>
370 #include <sys/statfs.h>
371 #include <sys/statvfs.h>
372 #include <fcntl.h>
373 #include <termios.h>
374 #define SYSV
375 #define USE_WAITPID
376 #define SIGNAL_CAST (void (*)(int))
377 #define STATFS4
378 #define USE_GETCWD
379 #endif
380
381
382 #ifdef SVR4
383 #include <string.h>
384 #include <sys/dir.h>
385 #include <dirent.h>
386 #include <sys/statfs.h>
387 #include <sys/statvfs.h>
388 #include <sys/vfs.h>
389 #include <sys/filio.h>
390 #include <fcntl.h>
391 #include <sys/sockio.h>
392 #include <netinet/tcp.h>
393 #include <stropts.h>
394 #include <termios.h>
395 #define SYSV
396 #define USE_WAITPID
397 #define SIGNAL_CAST (void (*)(int))
398 #define USE_STATVFS
399 #define USE_GETCWD
400 #define USE_SETSID
401 #endif
402
403
404 #ifdef OSF1
405 #include <termios.h>
406 #include <strings.h>
407 #include <dirent.h>
408 char *getwd(char *);
409 char *mktemp(char *); /* No standard include */
410 #include <netinet/in.h>
411 #include <arpa/inet.h> /* both for inet_ntoa */
412 #define SIGNAL_CAST ( void (*) (int) )
413 #define STATFS3
414 #define USE_F_FSIZE
415 #include <netinet/tcp.h>
416 #ifdef OSF1_ENH_SEC
417 #include <pwd.h>
418 #include <sys/types.h>
419 #include <sys/security.h>
420 #include <prot.h>
421 #include <unistd.h>
422 #define PASSWORD_LENGTH 16
423 #define NEED_AUTH_PARAMETERS
424 #endif  /* OSF1_ENH_SEC */
425 #endif
426
427
428 #ifdef CLIX
429 #include <dirent.h>
430 #define SIGNAL_CAST     (void (*)())
431 #include <sys/fcntl.h>
432 #include <sys/statfs.h>
433 #include <string.h>
434 #define NO_EID
435 #define USE_WAITPID
436 #define STATFS4
437 #define NO_FSYNC
438 #define USE_GETCWD
439 #define USE_SETSID
440 #define REPLACE_GETPASS
441 #define NO_GETRLIMIT
442 #endif  /* CLIX */
443
444
445
446 #ifdef BSDI
447 #include <string.h>
448 #include <netinet/tcp.h>
449 #define SIGNAL_CAST (void (*)())
450 #define USE_DIRECT
451 #endif
452
453
454 #ifdef NETBSD
455 #include <strings.h>
456 #include <netinet/tcp.h>
457 /* you may not need this */
458 #define NO_GETSPNAM
459 #define SIGNAL_CAST (void (*)())
460 #define USE_DIRECT
461 #define REPLACE_INNETGR
462 #endif 
463
464
465
466 #ifdef FreeBSD
467 #include <strings.h>
468 #include <netinet/tcp.h>
469 #include <netinet/in_systm.h>
470 #include <netinet/ip.h>
471 #define SIGNAL_CAST (void (*)())
472 #define USE_SETVBUF
473 #define USE_SETSID
474 #define USE_GETCWD
475 #define USE_WAITPID
476 #define USE_DIRECT
477 #define HAVE_MEMMOVE
478 #define HAVE_BZERO
479 #define HAVE_GETTIMEOFDAY
480 #define HAVE_PATHCONF
481 #define HAVE_GETGRNAM 1
482 #endif 
483
484
485
486 #ifdef AIX
487 #include <strings.h>
488 #include <sys/dir.h>
489 #include <sys/select.h>
490 #include <dirent.h>
491 #include <sys/statfs.h>
492 #include <sys/vfs.h>
493 #include <sys/id.h>
494 #include <sys/priv.h>
495 #include <netinet/tcp.h>
496 #define SYSV
497 #define USE_WAITPID
498 #define USE_SIGBLOCK
499 #define SIGNAL_CAST (void (*)())
500 #define DEFAULT_PRINTING PRINT_AIX
501 /* we undef this because sys/param.h is broken in aix. uggh. */
502 #undef MAXHOSTNAMELEN
503 #endif
504
505
506 #ifdef HPUX
507 #include <string.h>
508 #include <dirent.h>
509 #include <fcntl.h>
510 #include <sys/vfs.h>
511 #include <sys/types.h>
512 #include <sys/termios.h>
513 #include <netinet/tcp.h>
514 #ifdef HPUX_10_TRUSTED
515 #include <hpsecurity.h>
516 #include <prot.h>
517 #define NEED_AUTH_PARAMETERS
518 #endif
519 #define SIGNAL_CAST (void (*)(__harg))
520 #define SELECT_CAST (int *)
521 #define SYSV
522 #define USE_WAITPID
523 #define WAIT3_CAST2 (int *)
524 #define USE_GETCWD
525 #define USE_SETSID
526 #define USE_SETRES
527 #define DEFAULT_PRINTING PRINT_HPUX
528 #define SIGCLD_IGNORE
529 #endif
530
531
532 #ifdef SEQUENT
533 #include <signal.h>
534 #include <string.h>
535 #include <dirent.h>
536 #include <sys/types.h>
537 #include <sys/statfs.h>
538 #include <sys/stat.h>
539 #include <sys/buf.h>
540 #include <sys/socket.h>
541 #include <unistd.h>
542 #include <fcntl.h>
543 #define SIGNAL_CAST (void (*)(int))
544 #define USE_WAITPID
545 #define USE_GETCWD
546 #define NO_EID
547 #define STATFS4
548 #define USE_DIRECT
549 #ifdef PTX4
550 #undef USE_DIRECT
551 #endif
552 #endif
553
554
555
556 #ifdef SEQUENT_PTX4
557 #include <string.h>
558 #include <sys/dir.h>
559 #include <dirent.h>
560 #include <sys/statfs.h>
561 #include <sys/statvfs.h>
562 #include <sys/vfs.h>
563 #include <fcntl.h>
564 #include <sys/sockio.h>
565 #include <netinet/tcp.h>
566 #include <stropts.h>
567 #include <termios.h>
568 #define SYSV
569 #define USE_WAITPID
570 #define SIGNAL_CAST (void (*)(int))
571 #define USE_STATVFS
572 #define USE_GETCWD
573 #ifndef seteuid
574 #define seteuid(uid) setreuid(-1,uid)
575 #endif
576 #ifndef setegid
577 #define setegid(gid) setregid(-1,gid)
578 #endif
579 #endif
580
581
582 #ifdef NEXT2
583 #include <sys/types.h>
584 #include <strings.h>
585 #include <dirent.h>
586 #include <sys/vfs.h>
587 #define bzero(b,len) memset(b,0,len)
588 #define mode_t int
589 #define NO_UTIMBUF
590 #include <libc.h>
591 #define NOSTRDUP
592 #define USE_DIRECT
593 #define USE_WAITPID
594 #endif 
595
596
597 #ifdef NEXT3_0
598 #include <strings.h>
599 #include <sys/dir.h>
600 #include <sys/vfs.h>
601 #define bzero(b,len) memset(b,0,len)
602 #define NO_UTIMBUF
603 #include <libc.h>
604 #define NOSTRDUP
605 #define USE_DIRECT
606 #define mode_t int
607 #define GID_TYPE int
608 #define gid_t int
609 #define pid_t int
610 #define SIGNAL_CAST (void (*)(int))
611 #define WAIT3_CAST1 (union wait *)
612 #define HAVE_GMTOFF
613 #endif
614
615
616
617 #ifdef APOLLO
618 #include <string.h>
619 #include <fcntl.h>
620 #include <sys/statfs.h>
621 #define NO_UTIMBUF
622 #define USE_DIRECT
623 #define USE_GETCWD
624 #define SIGNAL_CAST     (void (*)())
625 #define HAVE_FCNTL_LOCK 0
626 #define HAVE_GETTIMEOFDAY
627 #define STATFS4
628 #endif
629
630
631
632 #ifdef SCO
633 #include <sys/netinet/tcp.h>
634 #include <sys/netinet/in_systm.h>
635 #include <sys/netinet/ip.h>
636 #include <dirent.h>
637 #include <string.h>
638 #include <fcntl.h>
639 #include <sys/statfs.h>
640 #include <sys/stropts.h>
641 #include <limits.h>
642 #ifdef EVEREST
643 #include <unistd.h> 
644 #endif
645 #ifdef NETGROUP
646 #include <rpcsvc/ypclnt.h>
647 #endif
648 #ifdef SecureWare
649 #include <sys/security.h>
650 #include <sys/audit.h>
651 #include <prot.h>
652 #define crypt bigcrypt
653 #endif
654 #ifndef EVEREST
655  #define ftruncate(f,l) syscall(0x0a28,f,l)
656 #endif 
657 #define SIGNAL_CAST (void (*)(int))
658 #define USE_WAITPID
659 #define USE_GETCWD
660 #define USE_SETSID
661 #ifdef SCO3_2_2
662 #define NO_EID
663 #else
664 #ifndef EVEREST
665 #define USE_IFREQ
666 #endif
667 #endif
668 #define STATFS4
669 #define NO_FSYNC
670 #ifndef EVEREST
671 #define NO_INITGROUPS
672 #endif
673 #define HAVE_PATHCONF
674 #define NO_GETRLIMIT
675 #endif
676
677
678
679 /* Definitions for RiscIX */
680 #ifdef RiscIX
681 #define SIGNAL_CAST (void (*)(int))
682 #include <sys/dirent.h>
683 #include <sys/acct.h>
684 #include <sys/vfs.h>
685 #include <string.h>
686 #include <utime.h>
687 #include <signal.h>
688 #define HAVE_GETTIMEOFDAY
689 #define NOSTRCASECMP
690 #define NOSTRDUP
691 #endif
692
693
694
695 #ifdef ISC
696 #include <net/errno.h>
697 #include <string.h>
698 #include <sys/dir.h>
699 #include <dirent.h>
700 #include <sys/statfs.h>
701 #include <fcntl.h>
702 #include <sys/sioctl.h>
703 #include <stropts.h>
704 #include <limits.h>
705 #include <netinet/tcp.h>
706 #define FIONREAD FIORDCHK
707 #define SYSV
708 #define USE_WAITPID
709 #define SIGNAL_CAST (void (*)(int))
710 #define USE_GETCWD
711 #define USE_SETSID
712 #define USE_IFREQ
713 #define NO_FTRUNCATE
714 #define STATFS4
715 #define NO_FSYNC
716 #endif
717
718
719
720 #ifdef AUX
721 #include <fstab.h>
722 #include <string.h>
723 #include <dirent.h>
724 #include <sys/vfs.h>
725 #include <fcntl.h>
726 #include <termios.h>
727 #define SYSV
728 #define USE_WAITPID
729 #define SIGNAL_CAST (void (*)(int))
730 char *strdup (char *);
731 #define USE_GETCWD
732 #endif
733
734
735 #ifdef M88K_R3
736 #include <string.h>
737 #include <dirent.h>
738 #include <fcntl.h>
739 #include <termios.h>
740 #define STATFS4
741 #define SYSV
742 #define USE_WAITPID
743 #define SIGNAL_CAST (void (*)(int))
744 char *strdup (char *);
745 #define USE_GETCWD
746 #define NO_FSYNC
747 #define NO_EID
748 #endif
749
750
751 #ifdef DNIX
752 #include <dirent.h>
753 #include <string.h>
754 #include <fcntl.h>
755 #include <sys/statfs.h>
756 #include <sys/stropts.h>
757 #define NO_GET_BROADCAST
758 #define USE_WAITPID
759 #define USE_GETCWD
760 #define USE_SETSID
761 #define STATFS4
762 #define NO_EID
763 #define PF_INET AF_INET
764 #define NO_STRERROR
765 #define ftruncate(f,l) chsize(f,l)
766 #endif /* DNIX */
767
768 #ifdef CONVEX
769 #include <netinet/tcp.h>
770 #include <arpa/inet.h>
771 #include <dirent.h>
772 #include <string.h>
773 #include <sys/vfs.h>
774 #include <fcntl.h>
775 #define DONT_REINSTALL_SIG
776 #define USE_SIGBLOCK
777 #define USE_WAITPID
778 #define SIGNAL_CAST (_SigFunc_Ptr_t)
779 #define NO_GETSPNAM
780 #define HAVE_MEMMOVE
781 extern char *mktemp(char *);
782 extern int  fsync(int);
783 extern int  seteuid(uid_t);
784 extern int  setgroups(int, int *);
785 extern int  initgroups(char *, int);
786 extern int  statfs(char *, struct statfs *);
787 extern int  setegid(gid_t);
788 extern int  getopt(int, char *const *, const char *);
789 extern int  chroot(char *);
790 extern int  gettimeofday(struct timeval *, struct timezone *);
791 extern int  gethostname(char *, int);
792 extern char *crypt(char *, char *);
793 extern char *getpass(char *);
794 #endif
795
796
797 #ifdef CRAY
798 #define MAXPATHLEN 1024
799 #include <dirent.h>
800 #include <string.h>
801 #include <fcntl.h>
802 #include <sys/statfs.h>
803 #define SIGNAL_CAST (void (*)(int))
804 #define SIGCLD_IGNORE
805 #define HAVE_FCNTL_LOCK 1
806 #define USE_SETSID
807 #define STATFS4
808 #endif
809
810
811 #ifdef ALTOS
812 #include <unistd.h>
813 #include <string.h>
814 #include <dirent.h>
815 #include <sys/fcntl.h>
816 #include <sys/statfs.h>
817 #define        const
818 #define        uid_t           int
819 #define        gid_t           int
820 #define        mode_t          int
821 #define        ptrdiff_t       int
822 #define HAVE_GETGRNAM  0
823 #define NO_EID
824 #define NO_FSYNC
825 #define        NO_FTRUNCATE
826 #define        NO_GETRLIMIT
827 #define        NO_INITGROUPS
828 #define NO_SELECT
829 #define NO_SETGROUPS
830 #define NO_STRERROR
831 #define NO_STRFTIME
832 #define        NO_TM_NAME
833 #define NO_UTIMEH
834 #define NOSTRCASECMP
835 #define REPLACE_MKTIME
836 #define REPLACE_RENAME
837 #define REPLACE_STRSTR
838 #define STATFS4
839 #define        USE_GETCWD
840 #endif
841
842 #ifdef QNX
843 #define STATFS4
844 #include <sys/statfs.h>
845 #include <sys/select.h>
846 #include <signal.h>
847 #include <sys/dir.h>
848 #define SIGNAL_CAST (void (*)())
849 #define USE_WAITPID
850 #define NO_INITGROUPS
851 #define NO_SETGROUPS
852 #define HAVE_TIMEZONE
853 #define USE_GETCWD
854 #define USE_SETSID
855 #define HAVE_FCNTL_LOCK 1
856 #define DEFAULT_PRINTING PRINT_QNX
857 #endif
858
859
860 #ifdef NEWS42
861 #include <string.h>
862 #include <dirent.h>
863 #include <sys/vfs.h>
864 #include <sys/timeb.h>
865 typedef int mode_t;
866 #endif
867
868 #ifdef OS2
869 #include <dirent.h>
870 #include <sys/statfs.h>
871 #include <string.h>
872 #include <limits.h>
873 #define SIGNAL_CAST (void (*)())
874 #define HAVE_FCNTL_LOCK 0
875 #define USE_WAITPID
876 #define NO_GET_BROADCAST
877 #define NO_EID
878 #define NO_SETGROUPS
879 #define NO_INITGROUPS
880 #define NO_CRYPT
881 #define NO_STATFS
882 #define NO_CHROOT
883 #define NO_CHOWN
884 #define strcasecmp stricmp
885 #define strncasecmp strnicmp
886 #endif
887
888
889 #ifdef LYNX
890 #define SIGNAL_CAST (void (*)())
891 #define WAIT3_CAST1 (union wait *)
892 #define STATFS4
893 #include <fcntl.h>
894 #include <resource.h>
895 #include <stat.h>
896 #include <string.h>
897 #include <dirent.h>
898 #include <sys/statfs.h>
899 #define USE_GETCWD
900 #define USE_GETSID
901 #endif
902
903
904 #ifdef BOS
905 #define SIGNAL_CAST (void (*)(int))
906 #include <string.h>
907 #include <sys/dir.h>
908 #include <sys/select.h>
909 #include <dirent.h>
910 #include <fcntl.h>
911 #include <signal.h>
912 #include <sys/statfs.h>
913 #include <sys/bsdioctl.h>
914 #endif
915
916
917
918 /*******************************************************************
919 end of the platform specific sections
920 ********************************************************************/
921
922 #if defined(USE_MMAP) || FAST_SHARE_MODES
923 #include <sys/mman.h>
924 #endif
925
926 #ifdef SecureWare
927 #define NEED_AUTH_PARAMETERS
928 #endif
929
930 #ifdef REPLACE_GETPASS
931 extern char    *getsmbpass(char *);
932 #define getpass(s) getsmbpass(s)
933 #endif
934
935 #ifdef REPLACE_INNETGR
936 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
937 #endif
938
939 #ifndef FD_SETSIZE
940 #define FD_SETSIZE 255
941 #endif
942
943 #ifndef __STDC__
944 #define const
945 #endif
946
947 /* Now for some other grungy stuff */
948 #ifdef NO_GETSPNAM
949 struct spwd { /* fake shadow password structure */
950        char *sp_pwdp;
951 };
952 #endif
953
954 #ifndef HAVE_BZERO
955 #ifndef bzero
956 #define bzero(p,s) memset(p,0,s)
957 #endif
958 #endif
959
960 #ifndef HAVE_MEMMOVE
961 #ifndef memmove
962 #define memmove(d,s,n) MemMove(d,s,n)
963 #endif
964 #endif
965
966 #ifdef USE_DIRECT
967 #include <sys/dir.h>
968 #endif
969
970 /* some unixes have ENOTTY instead of TIOCNOTTY */
971 #ifndef TIOCNOTTY
972 #ifdef ENOTTY
973 #define TIOCNOTTY ENOTTY
974 #endif
975 #endif
976
977 #ifndef SIGHUP
978 #define SIGHUP 1
979 #endif
980
981 /* if undefined then use bsd or sysv printing */
982 #ifndef DEFAULT_PRINTING
983 #ifdef SYSV
984 #define DEFAULT_PRINTING PRINT_SYSV
985 #else
986 #define DEFAULT_PRINTING PRINT_BSD
987 #endif
988 #endif
989
990
991 #ifdef AFS_AUTH
992 #include <afs/stds.h>
993 #include <afs/kautils.h>
994 #endif
995
996 #ifdef DFS_AUTH
997 #include <dce/dce_error.h>
998 #include <dce/sec_login.h>
999 #endif
1000
1001 #ifdef NO_UTIMBUF
1002 struct utimbuf {
1003   time_t actime;
1004   time_t modtime;
1005 };
1006 #endif
1007
1008 #ifdef NO_STRERROR
1009 #ifndef strerror
1010 extern char *sys_errlist[];
1011 #define strerror(i) sys_errlist[i]
1012 #endif
1013 #endif
1014
1015 #ifndef perror
1016 #define perror(m) printf("%s: %s\n",m,strerror(errno))
1017 #endif
1018
1019 #ifndef MAXHOSTNAMELEN
1020 #define MAXHOSTNAMELEN 255
1021 #endif
1022
1023 #include "version.h"
1024 #include "smb.h"
1025 #include "nameserv.h"
1026 #include "proto.h"
1027 #include "byteorder.h"
1028
1029 #include "kanji.h"
1030 #include "charset.h"
1031
1032 #ifndef S_IFREG
1033 #define S_IFREG 0100000
1034 #endif
1035
1036 #ifndef S_ISREG
1037 #define S_ISREG(x) ((S_IFREG & x)!=0)
1038 #endif
1039
1040 #ifndef S_ISDIR
1041 #define S_ISDIR(x) ((S_IFDIR & x)!=0)
1042 #endif
1043
1044 #ifdef UFC_CRYPT
1045 #define crypt ufc_crypt
1046 #endif
1047
1048 #ifdef REPLACE_STRLEN
1049 #define strlen(s) Strlen(s)
1050 #endif
1051
1052 #ifdef REPLACE_STRSTR
1053 #define strstr(s,p) Strstr(s,p)
1054 #endif
1055
1056 #ifdef REPLACE_MKTIME
1057 #define mktime(t) Mktime(t)
1058 #endif
1059
1060 #ifndef NGROUPS_MAX
1061 #define NGROUPS_MAX 128
1062 #endif
1063
1064 #ifndef EDQUOT
1065 #define EDQUOT ENOSPC
1066 #endif
1067
1068 #ifndef HAVE_GETGRNAM
1069 #define HAVE_GETGRNAM 1
1070 #endif
1071
1072 #ifndef SOL_TCP
1073 #define SOL_TCP 6
1074 #endif
1075
1076 /* default to using ftruncate workaround as this is safer than assuming
1077 it works and getting lots of bug reports */
1078 #ifndef FTRUNCATE_CAN_EXTEND
1079 #define FTRUNCATE_CAN_EXTEND 0
1080 #endif
1081
1082 /* maybe this unix doesn't separate RD and WR locks? */
1083 #ifndef F_RDLCK
1084 #define F_RDLCK F_WRLCK
1085 #endif
1086
1087 #ifndef ENOTSOCK
1088 #define ENOTSOCK EINVAL
1089 #endif
1090
1091 #ifndef SIGCLD
1092 #define SIGCLD SIGCHLD
1093 #endif 
1094
1095 #ifndef MAP_FILE
1096 #define MAP_FILE 0
1097 #endif
1098
1099 #ifndef HAVE_FCNTL_LOCK
1100 #define HAVE_FCNTL_LOCK 1
1101 #endif
1102
1103 #ifndef WAIT3_CAST2
1104 #define WAIT3_CAST2 (struct rusage *)
1105 #endif
1106
1107 #ifndef WAIT3_CAST1
1108 #define WAIT3_CAST1 (int *)
1109 #endif
1110
1111 #ifndef QSORT_CAST
1112 #define QSORT_CAST (int (*)())
1113 #endif
1114
1115 /* this is a rough check to see if this machine has a lstat() call.
1116    it is not guaranteed to work */
1117 #if !(defined(S_ISLNK) || defined(S_IFLNK))
1118 #define lstat stat
1119 #endif
1120
1121 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1122 #ifndef errno
1123 extern int errno;
1124 #endif 
1125
1126
1127 #ifdef NO_EID
1128 #define geteuid() getuid()
1129 #define getegid() getgid()
1130 #define seteuid(x) setuid(x)
1131 #define setegid(x) setgid(x)
1132 #endif
1133
1134
1135 #if (HAVE_FCNTL_LOCK == 0)
1136 /* since there is no locking available, system includes  */
1137 /* for DomainOS 10.4 do not contain any of the following */
1138 /* #define's. So, to satisfy the compiler, add these     */
1139 /* #define's, although they arn't really necessary.      */
1140 #define F_GETLK 0
1141 #define F_SETLK 0
1142 #define F_WRLCK 0
1143 #define F_UNLCK 0
1144 #endif /* HAVE_FCNTL_LOCK == 0 */
1145
1146 #ifdef NOSTRCASECMP
1147 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1148 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1149 #endif
1150
1151 #ifndef strcpy
1152 #define strcpy(dest,src) StrCpy(dest,src)
1153 #endif
1154
1155
1156 /* possibly wrap the malloc calls */
1157 #if WRAP_MALLOC
1158
1159 /* undo the old malloc def if necessary */
1160 #ifdef malloc
1161 #define xx_old_malloc malloc
1162 #undef malloc
1163 #endif
1164
1165 #define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
1166
1167 /* undo the old realloc def if necessary */
1168 #ifdef realloc
1169 #define xx_old_realloc realloc
1170 #undef realloc
1171 #endif
1172
1173 #define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
1174
1175 /* undo the old free def if necessary */
1176 #ifdef free
1177 #define xx_old_free free
1178 #undef free
1179 #endif
1180
1181 #define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
1182
1183 /* and the malloc prototypes */
1184 void *malloc_wrapped(int,char *,int);
1185 void *realloc_wrapped(void *,int,char *,int);
1186 void free_wrapped(void *,char *,int);
1187
1188 #endif
1189
1190
1191 #if WRAP_MEMCPY
1192 /* undo the old memcpy def if necessary */
1193 #ifdef memcpy
1194 #define xx_old_memcpy memcpy
1195 #undef memcpy
1196 #endif
1197
1198 #define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
1199 void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
1200 #endif
1201
1202 #endif