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